diff --git a/frontend/src/adk/client.ts b/frontend/src/adk/client.ts index 835948dbc..b180efed5 100644 --- a/frontend/src/adk/client.ts +++ b/frontend/src/adk/client.ts @@ -5035,14 +5035,38 @@ export interface GeneratedAgentTestRun { planHash?: string; } +const GENERATED_AGENT_PROJECT_TIMEOUT_MS = 60_000; + +function isGeneratedAgentProjectDeadlineError(error: unknown): boolean { + if (!error || typeof error !== "object") return false; + const name = "name" in error ? (error as { name?: unknown }).name : undefined; + if (name === "TimeoutError") return true; + if (name !== "AbortError") return false; + const message = "message" in error ? (error as { message?: unknown }).message : ""; + return typeof message !== "string" || message === "" || /abort/i.test(message); +} + export async function generateAgentProject( draft: AgentDraft, ): Promise { - const res = await apiFetch("/web/generated-agent-projects", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ draft }), - }); + let res: Response; + try { + res = await apiFetch( + "/web/generated-agent-projects", + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ draft }), + }, + {}, + GENERATED_AGENT_PROJECT_TIMEOUT_MS, + ); + } catch (error) { + if (isGeneratedAgentProjectDeadlineError(error)) { + throw new Error(adkT("client.generateProjectTimedOut")); + } + throw error; + } if (!res.ok) { throw new Error(await httpErrorMessage(res, adkT("client.generateProjectFailed"))); } diff --git a/frontend/src/i18n/resources/en-US/adk.json b/frontend/src/i18n/resources/en-US/adk.json index 1dc15af7c..fa9d07a2e 100644 --- a/frontend/src/i18n/resources/en-US/adk.json +++ b/frontend/src/i18n/resources/en-US/adk.json @@ -519,6 +519,7 @@ "checkRuntimeUpdateFailed": "Failed to check Runtime update capability (HTTP {{status}}). Try again later.", "loadRuntimeDetailFailed": "Failed to load Runtime details", "generateProjectFailed": "Failed to generate the project", + "generateProjectTimedOut": "Generating the publish preview project timed out. Please try again.", "generateAgentConfigFailed": "Failed to generate the Agent configuration", "createDebugRunFailed": "Failed to create the debug run", "createDebugSessionFailed": "Failed to create the debug session", diff --git a/frontend/src/i18n/resources/zh-CN/adk.json b/frontend/src/i18n/resources/zh-CN/adk.json index 5c999460b..ad885a9a3 100644 --- a/frontend/src/i18n/resources/zh-CN/adk.json +++ b/frontend/src/i18n/resources/zh-CN/adk.json @@ -519,6 +519,7 @@ "checkRuntimeUpdateFailed": "检查 Runtime 更新能力失败(HTTP {{status}}),请稍后重试。", "loadRuntimeDetailFailed": "加载 Runtime 详情失败", "generateProjectFailed": "生成项目失败", + "generateProjectTimedOut": "生成发布预览项目超时,请稍后重试。", "generateAgentConfigFailed": "生成 Agent 配置失败", "createDebugRunFailed": "创建调试运行失败", "createDebugSessionFailed": "创建调试会话失败", diff --git a/frontend/tests/timeout.test.mjs b/frontend/tests/timeout.test.mjs index 85bab7cfb..7cf0d7b12 100644 --- a/frontend/tests/timeout.test.mjs +++ b/frontend/tests/timeout.test.mjs @@ -71,3 +71,23 @@ test("generated-agent creation deadline exceeds both backend readiness windows", /apiFetch\([\s\S]*?\},\s*\{\},\s*GENERATED_AGENT_TEST_RUN_TIMEOUT_MS,\s*\)/, ); }); + +test("generated-agent project creation uses its own publish preview deadline", () => { + const declaration = clientSource.match( + /const GENERATED_AGENT_PROJECT_TIMEOUT_MS = ([\d_]+);/, + ); + assert.ok(declaration, "generated project creation needs a dedicated deadline"); + const timeoutMs = Number(declaration[1].replaceAll("_", "")); + assert.equal(timeoutMs, 60_000); + + const generateProject = functionSource( + "export async function generateAgentProject", + "export interface GeneratedAgentDraftResult", + ); + assert.match( + generateProject, + /apiFetch\([\s\S]*?"\/web\/generated-agent-projects"[\s\S]*?\},\s*\{\},\s*GENERATED_AGENT_PROJECT_TIMEOUT_MS,\s*\)/, + ); + assert.match(generateProject, /isGeneratedAgentProjectDeadlineError\(error\)/); + assert.match(generateProject, /adkT\("client\.generateProjectTimedOut"\)/); +}); diff --git a/veadk/webui/assets/app/index-BmMpDYni.js b/veadk/webui/assets/app/index-DqtAF7kX.js similarity index 89% rename from veadk/webui/assets/app/index-BmMpDYni.js rename to veadk/webui/assets/app/index-DqtAF7kX.js index 5ae27a64e..64b37bba6 100644 --- a/veadk/webui/assets/app/index-BmMpDYni.js +++ b/veadk/webui/assets/app/index-DqtAF7kX.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visualizations/mermaid/mermaid.core-CY863Aa9.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-0G66QVoM.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css","assets/chunks/QuickAgentCreateDialog-BCSVtM6Z.js","assets/styles/QuickAgentCreateDialog-DGsLIlOX.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visualizations/mermaid/mermaid.core-IM_oNPTV.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-Cf5zyDfH.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css","assets/chunks/QuickAgentCreateDialog-DWWlpaW1.js","assets/styles/QuickAgentCreateDialog-DGsLIlOX.css"])))=>i.map(i=>d[i]); var l7e=Object.defineProperty;var xW=e=>{throw TypeError(e)};var c7e=(e,t,n)=>t in e?l7e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rn=(e,t,n)=>c7e(e,typeof t!="symbol"?t+"":t,n),wW=(e,t,n)=>t.has(e)||xW("Cannot "+n);var Za=(e,t,n)=>(wW(e,t,"read from private field"),n?n.call(e):t.get(e)),OW=(e,t,n)=>t.has(e)?xW("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),SM=(e,t,n,i)=>(wW(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function u7e(e,t){for(var n=0;ni[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();var ym=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ew(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qae={exports:{}},YR={};/** * @license React * react-jsx-runtime.production.js @@ -13,7 +13,7 @@ var l7e=Object.defineProperty;var xW=e=>{throw TypeError(e)};var c7e=(e,t,n)=>t Raw response: {{response}}`,errorWithRawResponse:`{{context}} Raw response: -{{response}}`,loadArkApiKeysFailed:"Failed to load Ark API keys",loadModelsFailed:"Failed to load models",runtimeAccessDenied:"This account cannot access the Runtime. Refresh the list or sign in again.",privateRuntimeUnavailable:"The Runtime was deployed, but this Studio cannot access the private Runtime. Use a Studio connected to the same VPC, or deploy with public or public plus VPC access.",runtimeTemporarilyUnavailable:"The Runtime was deployed, but Studio cannot connect yet. The gateway domain may still be propagating, or the current network or DNS cannot reach it. Try connecting again later from Manage Agents.",runtimeConnectionUnsupported:"The Runtime Agent Server does not provide a connection endpoint. Confirm that the Runtime is ready and compatible.",runtimeConnectionDenied:"The Runtime rejected the connection request. Check its authentication configuration.",listAgentsFailed:"Failed to load Agents",invalidListAppsJson:"Runtime /list-apps returned unreadable JSON.",invalidListAppsFormat:"Runtime /list-apps returned an invalid format; expected a non-empty string array.",createSessionFailedWithStatus:"Failed to create session ({{status}})",createSessionFailed:"Failed to create session",getSessionFailed:"Failed to load session",getSessionFailedWithDetail:"Failed to load session ({{status}}): {{detail}}",feedbackRuntimeOnly:"Feedback sync is supported only for sessions connected to an AgentKit Runtime",feedbackRegionMissing:"The Runtime region is missing, so feedback cannot be submitted",submitFeedbackFailed:"Failed to submit feedback",loadEvaluationSetsFailed:"Failed to load evaluation sets",loadAutoEvaluationStatusFailed:"Failed to load automatic evaluation status",loadOptimizationsFailed:"Failed to load optimization suggestions",deleteEvaluationCaseFailed:"Failed to delete the evaluation case",downloadFileFailed:"Failed to download the file",fileUnavailable:"File content is unavailable",uploadFileFailed:"File upload failed",traceDisabled:"Tracing is not enabled for this Agent. Enable it in the console first.",loadTraceFailed:"Failed to load trace data",contentTypeMissing:"Content-Type missing",traceNonJson:"Trace failed: the server returned a non-JSON response ({{contentType}}). Check the Studio API proxy configuration",invalidTraceFormat:"Trace failed: invalid response format",submitIssueFeedbackFailed:"Failed to submit issue feedback",issueFeedbackNotConfirmed:"Failed to submit issue feedback: the server did not confirm the submission",noPreviewableAgent:"This Runtime does not provide an Agent that can be previewed.",agentSearchFailed:"Agent search failed",emptySseBody:"HTTP 200 with an empty SSE response body.",noDisplayableSseReply:"HTTP 200, but the SSE response did not contain a displayable model reply.",firstSseEventTimeout:"No SSE event was received within 60 seconds. Try again later, and review the Runtime, model, or gateway logs.",runSessionFailed:"Session run failed",runSseFailedWithDetail:"run_sse failed ({{status}}): {{detail}}",checkRuntimeNameFailed:"Failed to check the Runtime name",invalidRuntimeNameCheck:"Failed to check the Runtime name: invalid response format",loadCloudResourcesFailed:"Failed to load cloud resources",invalidCloudResources:"The cloud resource list response has an invalid format",invalidEnvironmentMount:"The environment mount response has an invalid format",environmentMountMismatch:"The environment mount response does not match the request",environmentMountNetworkFailed:"Unable to connect to Studio, so the environment was not mounted. Check your network and try again.",environmentMountFailed:"Failed to mount the environment",clipboardUnsupported:"This browser does not support writing to the clipboard.",clipboardWriteFailed:"Unable to write to the clipboard. Check clipboard permissions.",loadSystemInfoFailed:"Failed to load system information",invalidSystemInfo:"The system information response has an invalid format",invalidEnvironmentBuild:"The environment build response has an invalid format",invalidEnvironmentBuildStep:"The environment build step response has an invalid format",invalidEnvironmentManifest:"The environment manifest response has an invalid format",invalidImageRepository:"The environment image repository response has an invalid format",invalidCodeRepository:"The environment code repository response has an invalid format",invalidImageSource:"The environment image source response has an invalid format",invalidEnvironment:"The environment response has an invalid format",invalidWorkspace:"The workspace response has an invalid format",loadWorkspacesFailed:"Failed to load workspaces",invalidWorkspaceList:"The workspace list response has an invalid format",saveWorkspaceFailed:"Failed to save the workspace",deleteWorkspaceFailed:"Failed to delete the workspace",loadEnvironmentsFailed:"Failed to load environments",invalidEnvironmentList:"The environment list response has an invalid format",probeRepositoryFailed:"Failed to inspect the code repository",invalidRepositoryProbe:"The code repository inspection response has an invalid format",exportEnvironmentCodeFailed:"Failed to export the environment share code",invalidEnvironmentCode:"The environment share code response has an invalid format",inspectEnvironmentCodeFailed:"Failed to inspect the environment share code",invalidEnvironmentCodeInspection:"The environment share code inspection response has an invalid format",importEnvironmentCodeFailed:"Failed to import the environment share code",invalidEnvironmentCodeImport:"The environment share code import response has an invalid format",studioUnavailable:"Unable to connect to Studio. Confirm that the backend is running and try again.",saveEnvironmentFailed:"Failed to save the environment",deleteEnvironmentFailed:"Failed to delete the environment",startEnvironmentBuildFailed:"Failed to start the environment build",loadEnvironmentBuildFailed:"Failed to load environment build details",loadEnvironmentManifestFailed:"Failed to load the environment manifest",invalidEnvironmentResource:"The environment resource response has an invalid format",loadEnvironmentResourcesFailed:"Failed to load environment build resources",updateCodexSandboxFailed:"Failed to update Codex Sandbox",invalidCodexSandboxUpdate:"The Codex Sandbox update response has an invalid format",loadUserPoolsFailed:"Failed to load user pools",invalidUserPoolList:"The user pool list response has an invalid format",syncGithubFailed:"Failed to sync GitHub code ({{status}})",validatingMigrationArtifact:"Validating migration artifact",uploadingCodePackage:"Uploading code package",migrationArtifactValidated:"Migration artifact validated",codePackageUploaded:"Code package uploaded",deploymentProgress:{preparing:"Preparing deployment",uploading:"Uploading the code package",building:"Building the image",buildLogsSyncing:"Building the image. Build logs are up to date.",buildLogsComplete:"Build log sync complete.",buildFailedLogsSynced:"Image build failed. Final build logs are available.",buildLogsUnavailable:"Build logs are temporarily unavailable.",finalBuildLogsUnavailable:"Final build logs are temporarily unavailable.",deploying:"Deploying the service",publishing:"Publishing the service",evaluating:"Creating evaluation sets",updating:"Updating the Runtime configuration",completing:"Finalizing deployment",github:"Configuring GitHub delivery",inProgress:"Deployment in progress"},deploymentFailed:"Deployment failed",deploymentDisconnected:"Deployment failed: connection interrupted",deploymentMissingAgentName:"Deployment failed: Agent name missing from response",deploymentMissingConnection:"Deployment failed: AgentKit connection information missing from response",cancelDeploymentFailed:"Failed to cancel deployment ({{status}})",loadFailed:"Failed to load ({{status}})",loadPermissionsFailed:"Failed to load permissions ({{status}})",invalidPermissionResponse:"The permission service returned an unreadable response",checkStudioUpdateFailed:"Failed to check for Studio updates ({{status}})",studioUpdatePreflightFailed:"Studio update permission check failed ({{status}})",submitStudioUpdateFailed:"Failed to submit the Studio update ({{status}})",loadAgentUsageFailed:"Failed to load Agent usage",notProvided:"Not provided",agentUsageNonJson:"Failed to load Agent usage: the server returned a non-JSON response (HTTP {{status}}, Content-Type: {{contentType}}). ",checkStudioGateway:"Confirm that the current service is running in Studio mode and check the proxy or gateway configuration.",agentUsageInvalidJson:"Failed to load Agent usage: the server returned invalid JSON (HTTP {{status}}, Content-Type: {{contentType}}). ",retryCheckGateway:"Try again later. If the problem persists, check the proxy or gateway configuration.",loadCronJobsFailed:"Failed to load scheduled tasks",loadCronJobFailed:"Failed to load scheduled task details",createCronJobFailed:"Failed to create the scheduled task",updateCronJobFailed:"Failed to update the scheduled task",enableCronJobFailed:"Failed to enable the scheduled task",pauseCronJobFailed:"Failed to pause the scheduled task",runCronJobFailed:"Failed to run the scheduled task now",loadCronHistoryFailed:"Failed to load execution history",stopCronRunFailed:"Failed to stop the execution",deleteCronJobFailed:"Failed to delete the scheduled task",loadRuntimeFailed:"Failed to load the Runtime",loadLocalToolsFailed:"Failed to load local tools",connectDynamicRouteFailed:"Failed to connect the Studio dynamic route",a2aProbeDenied:"The Runtime rejected the A2A probe. Check the Runtime authentication configuration.",loadA2aCardFailed:"Failed to load the A2A Agent Card",loadRuntimeApiKeyFailed:"Failed to load the Runtime API key",runtimeApiKeyMissing:"The Runtime did not return a usable API key",loadMcpCredentialsFailed:"Failed to load MCP authentication",invalidMcpCredentials:"Studio returned invalid MCP authentication data",deleteFailed:"Delete failed ({{status}})",runtimeManageForbidden:"This account cannot manage the Runtime.",runtimeNotFound:"The Runtime does not exist or has been deleted.",runtimeUnavailable:"This account cannot access the Runtime.",checkRuntimeUpdateFailed:"Failed to check Runtime update capability (HTTP {{status}}). Try again later.",loadRuntimeDetailFailed:"Failed to load Runtime details",generateProjectFailed:"Failed to generate the project",generateAgentConfigFailed:"Failed to generate the Agent configuration",createDebugRunFailed:"Failed to create the debug run",createDebugSessionFailed:"Failed to create the debug session",loadDebugTraceFailed:"Failed to load the debug trace",invalidDebugTrace:"Failed to load the debug trace: invalid response format",debugRunFailed:"Debug run failed",cleanupDebugRunFailed:"Failed to clean up the debug run"},ule={loadFailed:"Failed to load conversation mode capabilities (HTTP {{status}})",invalidResponse:"The conversation mode capabilities response has an invalid format"},dle={nonJson:"{{fallback}}: the server returned a non-JSON response (HTTP {{status}}, {{contentType}}){{detail}}"},fle={busy:"The workspace is busy. Try again shortly",notFound:"Workspace not found",duplicates:"Multiple personal workspace sessions were found. Contact your administrator",timeout:"Workspace recovery timed out. Your projects are retained. Try again",unavailable:"The workspace cannot be restored right now. Your projects are retained. Try again",persistence:"Persistence is not enabled for this Sandbox. Check the workspace configuration",startup:"Workspace startup failed. Check the Sandbox status",exists:"This project already exists. Open it from the project list",directory:"Project directory not found",configuration:"Configure the workspace Sandbox image first",state:"Could not check workspace status. Try again",list:"Could not restore the workspace or load projects. Try again",create:"Project initialization failed. Check that the image is available and try again",open:"Could not restore the workspace or open the project. Try again",connection:"Could not connect to the workspace. Try again",invalidWorkspaceUrl:"The workspace returned an invalid URL",operation:"Project operation failed. Try again",invalidProjectUrl:"The project URL is invalid",listFallback:"Could not load projects",connectionState:"Could not connect to the workspace. Try again"},hle={reporting:"Completing delivery details",packaging:"Preparing artifacts",savingVersion:"Saving version",finishing:"Finishing request",submitResult:"Submit build result",requestFailed:"Task request failed. Please retry.",invalidResponse:"Invalid task state response.",eventGap:"Restoring missing task output.",reconnecting:"Reconnecting. Existing output is preserved.",input:{pending:"Queued",sending:"Confirming delivery",delivered:"Delivered",withdrawn:"Not sent"},plan:"Execution plan",diff:"File changes",preparing:"Preparing task",preparingEnvironment:"Preparing development environment…",connectingEnvironment:"Connecting to development environment…",processing:"Processing request",thinking:"Thinking",read:"Read file · {{target}}",listFiles:"List directory · {{target}}",search:"Search · {{target}}",command:"Run command · {{target}}",editFiles:"Edit files · {{target}}",webSearch:"Search web · {{target}}",processSummary:"Processed {{count}} items",duration:"{{seconds}}s",durationUnits:{milliseconds:"{{value}} ms",hours:"{{value}} h",minutes:"{{value}} min",seconds:"{{value}} s"},failedTools:"{{count}} tools failed",toolFailed:"Failed",toolCalls:"{{count}} tool calls",turnDuration:"Turn elapsed {{duration}}",toolDuration:"Tool time {{duration}}",toolDurationPartial:"Recorded tool time {{duration}}",toolDurationHelp:"Sum of tool durations. Parallel calls can exceed turn elapsed time.",turnStatus:{completed:"Completed",failed:"Failed",interrupted:"Interrupted",cancelled:"Interrupted",unavailable:"Task ended"},notReported:"Not reported",partial:"Recorded",partialHelp:"Usage for this turn may be incomplete.",tokenDetails:"Turn token usage",model:"Turn model",totalTokens:"Total",inputTokens:"Input",cachedInputTokens:"Cached input",uncachedInputTokens:"Uncached input",cacheWriteInputTokens:"Cache write",outputTokens:"Output",reasoningOutputTokens:"Reasoning output",cacheHitRate:"Input cache hit rate",tokenHelp:"Cached input and reasoning output are subsets of input and output. Uncached input = input − cached input."},ple={common:Vae,agentkitCli:Hae,cloudRegion:qae,connections:Wae,feishuBot:Kae,requestError:Gae,runSse:Xae,runtimeLogs:Yae,search:Zae,skills:Jae,sse:ele,identity:tle,github:nle,video:ile,websiteIntegration:rle,knowledge:sle,intelligentDevelopment:ole,migrations:ale,sandbox:lle,client:cle,newChatCapabilities:ule,jsonResponse:dle,workspaceProjects:fle,developmentRuns:hle},h7e=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:Hae,client:cle,cloudRegion:qae,common:Vae,connections:Wae,default:ple,developmentRuns:hle,feishuBot:Kae,github:nle,identity:tle,intelligentDevelopment:ole,jsonResponse:dle,knowledge:sle,migrations:ale,newChatCapabilities:ule,requestError:Gae,runSse:Xae,runtimeLogs:Yae,sandbox:lle,search:Zae,skills:Jae,sse:ele,video:ile,websiteIntegration:rle,workspaceProjects:fle},Symbol.toStringTag,{value:"Module"})),mle="Agent reviews",gle="Request access for everyone in your organization",ble="Close",yle="Refresh",vle="Status",xle="Applicant",wle="Submitted",Ole="Current version",kle="Model",Sle="Returned by",Ele="Approved by",Cle="Reviewed",Tle="Agent description",Ale="Application notes",_le="Return reason",jle="Review comment",Nle="Return reason (required)",Rle="Content changed after submission; return and submit again",Ile="Withdraw to edit this Agent, then submit a new request to publish it",Ple="Other users will lose access to this Agent. Unpublish it?",Dle="Cancel",Mle="Confirm",Lle="Saving",$le="Unpublish",Fle="Withdraw request",Ble="Approve",Ule="Publish for everyone",Qle="Request publication",zle="Everyone",Vle={pending:"Pending",approved:"Approved",returned:"Returned",withdrawn:"Withdrawn"},Hle="Search agents or applicants",qle="Region",Wle="All statuses",Kle="Agent",Gle="Actions",Xle="Review application",Yle="Application details",Zle="No matching applications",Jle="No Agent review requests",ece="{{count}} / {{limit}} characters",p7e={title:mle,dialogDescription:gle,close:ble,refresh:yle,statusTitle:vle,submitter:xle,submittedAt:wle,version:Ole,model:kle,returnedBy:Sle,approvedBy:Ele,reviewedAt:Cle,description:Tle,message:Ale,reason:_le,comment:jle,reasonRequired:Nle,contentChanged:Rle,withdrawConfirm:Ile,unpublishConfirm:Ple,cancel:Dle,confirm:Mle,saving:Lle,unpublish:$le,withdraw:Fle,return:"Return",approve:Ble,publish:Ule,submit:Qle,private:"Private",enterprise:zle,status:Vle,search:Hle,region:qle,all:Wle,agent:Kle,actions:Gle,review:Xle,details:Yle,noMatches:Zle,empty:Jle,textCount:ece},m7e=Object.freeze(Object.defineProperty({__proto__:null,actions:Gle,agent:Kle,all:Wle,approve:Ble,approvedBy:Ele,cancel:Dle,close:ble,comment:jle,confirm:Mle,contentChanged:Rle,default:p7e,description:Tle,details:Yle,dialogDescription:gle,empty:Jle,enterprise:zle,message:Ale,model:kle,noMatches:Zle,publish:Ule,reason:_le,reasonRequired:Nle,refresh:yle,region:qle,returnedBy:Sle,review:Xle,reviewedAt:Cle,saving:Lle,search:Hle,status:Vle,statusTitle:vle,submit:Qle,submittedAt:wle,submitter:xle,textCount:ece,title:mle,unpublish:$le,unpublishConfirm:Ple,version:Ole,withdraw:Fle,withdrawConfirm:Ile},Symbol.toStringTag,{value:"Module"})),tce={backToEvaluationCase:"Back to evaluation case",cancel:"Cancel",copied:"Copied",copy:"Copy",exportConversation:"Export conversation",retry:"Retry"},nce={title:"How would you like to add an Agent?",subtitle:"Choose the approach that best fits your project.",quickCreate:{title:"Create from scratch",description:"Build an Agent with intelligent, custom, template, or workflow modes."},intelligent:{title:"Intelligent mode",description:"Describe your goal, then build, debug, and validate the Agent interactively."},package:{title:"Add and deploy a code package",description:"Upload an Agent project archive, review the code, and deploy it to AgentKit Runtime."},migrate:{title:"Migrate an existing project",description:"Migrate an existing LangChain, Dify, or similar project to AgentKit Runtime."}},ice={subject:{file:"file changes",command:"command execution"},decision:{accept:"Allowed {{subject}} once",acceptForSession:"Allowed {{subject}} for this session",decline:"Declined {{subject}}",cancel:"Cancelled approval for {{subject}}"},details:{command:"Command",grantRoot:"Authorized path",cwd:"Working directory"}},rce={noDescription:"No description",region:"Region",unknownAgent:"Unknown Agent"},sce={agentTransfer:"Agent handoff",annotationHint:"Model response; select text to add an annotation",continueBranch:"Continue with “{{branch}}”",emptyResponse:"This response has no displayable content.",subagentDescription:"Working on a task handed off by the primary Agent."},oce={title:"Configure {{provider}} credentials",prefix:"Agent Workspace requires {{provider}} credentials. Set",and:"and",suffix:"in the runtime environment, then retry."},ace={buildRunning:{title:"A build is still running",description:"Leaving will stop this build. The session will remain available in your history.",confirm:"Stop and leave"},deleteThread:{title:"Delete Codex session",description:"Delete “{{name}}” and remove it from your session history?",confirm:"Delete"},returnToCreate:{title:"Return to the create page?",description:"Your current entries will be lost.",confirm:"Return"}},lce={additionalAgentDeleteFailures:"; {{count}} more failed",agentDeleteFailures:"Failed to delete {{count}} Agents: {{failures}}{{suffix}}",agentToolsMissing:"This Agent is missing required tools: {{tools}}",buildStopUnconfirmed:"You left the development environment, but Studio could not confirm that the build stopped. It may still be running; check its status in session history later.",builtinAgentSendFailed:"Failed to send to the built-in Agent: {{message}}",bytePlusEvaluationUnsupported:"AgentKit evaluation sets are not currently supported on BytePlus",clipboardUnsupported:"This browser does not support writing to the clipboard.",cloudCodexEmptyReply:"The cloud Codex task ended without a response. Send the task again.",cloudCodexSessionMissing:"The cloud Codex session has not appeared in the list yet. Try again shortly.",deploymentRuntimeIdMissing:"Deployment completed without returning a Runtime ID.",environmentExpired:"The selected environment is no longer available. Refresh and select it again.",environmentsLoadFailed:"Failed to load environments",evaluationCaseSessionMissing:"This evaluation case has no session reference and cannot be opened.",evaluationUnsupportedForReply:"This response cannot be added to an evaluation set",firstFrameRequired:"Add a first-frame image before generating from first and last frames.",incompletePromptOptimization:"The prompt optimization result is incomplete. Run the optimization again.",intelligentCapabilityCheckFailed:"Failed to check intelligent development capabilities (HTTP {{status}})",intelligentSessionCreateFailed:"Failed to create the intelligent development session",invalidIntelligentCapability:"The intelligent development capability response is invalid.",localBffToolsNotConfigured:"No tools are configured for the local Studio BFF.",localToolsLoadFailed:"Failed to load local tools",loginPopupBlocked:"The browser blocked the sign-in window. Allow pop-ups and try again.",loginPopupClosed:"The sign-in window was closed. Sign in again to continue.",mediaTooLarge:"{{fileName}} exceeds this platform's media size limit.",mountEnvironmentFailed:"Failed to mount the environment",noConnectedSandbox:"No Sandbox is currently connected.",noCreateAgentPermission:"Your account does not have permission to add Agents.",noManageAgentPermission:"Your account does not have permission to manage Agents.",noOptimizationBaseline:"There is no pre-optimization version available for comparison.",oauthUrlMissing:"The event does not include an authorization URL.",onlyCloudAgentUpdatable:"Only deployed cloud Agents can be updated.",optimizationVersionMissing:"The project version for this optimization could not be found. It may have been deleted.",persistentStorageNotConfigured:"Persistent storage has not been configured by an administrator",readDraftFailed:"Unable to read local drafts. Try again.",runtimeAgentNameMissing:"The Runtime is missing an Agent name and cannot be updated.",runtimeBffToolsDisabled:"BFF tool capabilities are not enabled for this Runtime Agent.",runtimeDeploymentConfigUnavailable:"The Runtime's original deployment configuration cannot be restored, so it cannot be updated safely.",runtimeMissingForConnection:"Runtime information is missing, so the Agent cannot be connected.",runtimeRegionMissingForDelete:"The Runtime is missing region information and cannot be deleted.",runtimeRegionMissingForUpdate:"The Runtime is missing region information and cannot be updated.",runtimeUpdateUnsupported:"This Runtime does not support in-place updates.",sandboxRuntimeUnavailable:"This Agent does not have an available Sandbox Runtime.",sandboxToolsUnavailable:"The current Studio BFF does not provide Sandbox execution tools.",saveDraftLocationRejected:"The browser could not save the current draft location. Check site storage permissions and try again.",saveDraftRejected:"The browser could not save the draft. Try again.",selectSkillToOptimize:"Select a Skill to optimize first.",sessionMissingForMount:"The current session does not exist, so an environment cannot be mounted.",sessionNotReady:"The session is not ready yet.",sessionUnavailable:"The current session is unavailable. Close it and try again.",sourceNotReady:"The source is not ready yet. Return to the conversation to continue.",textVideoRejectsReferences:"Text-to-video does not use reference media. Remove the images or videos first.",videoEditRequiresVideo:"Add the video you want to edit first.",videoExtendRequiresVideo:"Add a source video before extending it.",videoGenerationFailed:"Video generation failed. Try again later.",videoModeUnsupported:"The selected video mode is not supported on this platform.",videoPreviewMissing:"The video task completed, but the server did not return a preview URL.",videoReferenceRequired:"Add at least one reference image or video."},cce={like:"Like",removeLike:"Remove like",dislike:"Dislike",removeDislike:"Remove dislike",reportIssue:"Report an issue",traceFlameGraph:"Tracing flame graph"},uce={0:"What would you like to work on today?",1:"How can I help?",2:"What would you like me to look into?",3:"Ask me anything",4:"Hi, let's get started",5:"Start a new conversation",6:"What should we tackle first?",7:"Tell me what you have in mind",8:"Where should we begin?",9:"What can I help you with?",10:"Ready to move this forward?",11:"What's most important right now?",12:"Let's get something done today",13:"I'm ready when you are",intelligentDevelopment:"Give your ideas room to grow"},dce={agentCapabilities:"Checking Agent capabilities…",session:"Loading session…"},fce={cancelled:"Authorization was cancelled.",pasteCallbackUrl:"After authorization, paste the full callback URL from your browser's address bar:",popupBlocked:"The browser blocked the authorization window. Allow pop-ups and try again.",unsupportedUrl:"The authorization URL is not HTTP or HTTPS and was blocked."},hce={volcengine:"Volcengine"},pce={checkingPersistence:"Checking persistent storage…",exitDevelopment:"Exit development",fileUploaded:"Uploaded a file to the Sandbox",filesUploaded:"Uploaded {{count}} files to the Sandbox",intelligentDevelopment:"Intelligent development",mode:{readOnly:"Read only",workspaceWrite:"Workspace write",fullAccess:"Full access"},approvalPolicy:{untrusted:"Untrusted commands only",onRequest:"Ask when needed",never:"Never ask"},reviewer:{user:"Ask me",autoReview:"Automatic review"},labels:{approvalPolicy:"Approval policy",file:"File",fileNumber:"File {{number}}",mode:"Sandbox mode",networkAccess:"Network access",reviewer:"Approval method",workingDirectory:"Working directory"},network:{allowed:"Allowed",disabled:"Off"},permissionsUpdated:"Updated Codex permissions for this Sandbox session",persistenceUnknown:"Unable to verify persistent storage",stoppedReady:"Stopped. You can continue typing.",uploadedFilesPrompt:"The following files were uploaded to the current Sandbox workspace. Use them in this task:",workspaceUpdated:"Workspace updated"},mce={addAgent:"Add Agent",addFromPackage:"Add from code package",agent:"Agent",automations:"Automations",createAgent:"Create Agent",createSkill:"Create Skill",cronJobs:"Cronjob",issueFeedback:"Issue feedback",library:"Library",migrateAgent:"Migrate Agent",newConversation:"New conversation",optimizeSkill:"Optimize {{name}}",search:"Search",skill:"Skill",skillLibrary:"Skill library",systemInfo:"System information",updateAgent:"Update {{name}}",codeProjects:"Code projects",reviewCenter:"Review center"},gce={title:"Create from workspace",description:"Create and manage code projects, then develop and debug in VS Code"},bce={actions:tce,addAgent:nce,approval:ice,common:rce,conversation:sce,credentials:oce,dialogs:ace,errors:lce,feedback:cce,greetings:uce,loading:dce,oauth:fce,providers:hce,sandbox:pce,titles:mce,workspaceProjectEntry:gce},g7e=Object.freeze(Object.defineProperty({__proto__:null,actions:tce,addAgent:nce,approval:ice,common:rce,conversation:sce,credentials:oce,default:bce,dialogs:ace,errors:lce,feedback:cce,greetings:uce,loading:dce,oauth:fce,providers:hce,sandbox:pce,titles:mce,workspaceProjectEntry:gce},Symbol.toStringTag,{value:"Module"})),yce="Automations",vce="Connect development tools and extend your Agents with automated workflows",xce="Search automations",wce="Automation categories",Oce={development:"Development",channels:"Messaging channels"},kce="{{category}} automations",Sce="Open {{name}}",Ece="Available only in local deployments",Cce="No matching automations",Tce="Try searching for another name",Ace="Back to automations",_ce={"coding-agents":{name:"Configure coding agents",badge:"Local",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},template:{name:"Import starter project",description:"Create a minimal Agent project in your repository with continuous delivery to AgentKit Runtime.",title:"Import starter project",subtitle:"Add a ready-to-run basic Agent and continuous delivery configuration to your repository",panel:"This creates a pull request containing the basic project and AgentKit Runtime delivery workflow.",submitLabel:"Import template and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: import AgentKit basic template",description:"Import a basic Agent project with the AgentKit Studio App Server and add continuous delivery to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:"agentkit-basic-agent",help:"The basic project will be added here; app.py mounts the complete Studio App Server and serves as the entry point"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},delivery:{name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: continuously publish to AgentKit Runtime",description:"Add a GitHub Actions workflow that continuously publishes updates from the target branch to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},review:{name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",regionHelp:"",pullRequest:{title:"chore: configure automated PR review",description:"Add a GitHub Actions workflow that reviews same-repository pull requests in an isolated Sandbox and publishes the result as a GitHub review. Configure the required workflow secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},sandboxToolId:{label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"The AgentKit CodeEnv used for each review"},modelName:{label:"Review model",placeholder:"review-model",help:"The code review model name injected into the Sandbox"},modelBaseUrl:{label:"Model API URL",placeholder:"https://ark.example.com/api/v3",help:"Must be an OpenAI-compatible HTTPS endpoint"}}},"gitlab-review":{name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."},feishu:{name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},"website-integration":{name:"Website integration",description:"Embed an AgentKit Runtime on your website as a floating chat window."}},jce={required:"Required",optional:"Optional",region:"Region",tokenLabel:"GitHub Token",getToken:"Get token",createToken:"Create GitHub token",tokenPlaceholder:"Requires write access to repository contents and pull requests",tokenWorkflowPlaceholder:"Requires write access to contents, pull requests, and workflows",hideToken:"Hide token",showToken:"Show token",tokenHelp:"The token is used only for this submission. It is not stored in the browser or written to the pull request.",tokenWorkflowHelp:"This token is used only to create the configuration PR. It is not a general Sandbox requirement and is not stored in the browser or written to the PR.",prCreated:"PR #{{number}} created",configPrCreated:"Configuration PR #{{number}} created",configPrNextStep:"After it is merged, later pull requests in the same repository will trigger reviews automatically.",viewOnGitHub:"View on GitHub",viewConfigPr:"View configuration PR",secretsHeading:"Before merging the pull request, configure these GitHub Actions secrets in the repository:",secretsConfigHeading:"Before merging the configuration PR, add runtime secrets to the target repository",openSecrets:"Open Secrets settings",secretsPath:"Path: Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"A PR review configuration will be added for {{repository}}",repositoryReviewHelp:"GitHub App will validate pull requests for {{repository}}",secretPair:"{{accessKey}}, {{secretKey}} (required)",sessionToken:"{{sessionToken}} (required when using temporary credentials)",requiredSecret:"{{name}} (required)",temporaryCredentialRequired:" (required when using temporary credentials)",requiredSuffix:" (required)",submitting:"Creating PR…",validation:{required:"This field is required",repository:"Enter owner/repository or a full GitHub repository URL",baseBranch:"The target branch format is invalid",projectPath:"Enter a relative path within the repository",runtimeId:"The Runtime ID format is invalid",sandboxToolId:"The Sandbox Tool ID format is invalid",modelName:"The model name format is invalid",modelBaseUrlSafe:"Enter an HTTPS URL without credentials, query parameters, or fragments",modelBaseUrl:"Enter a valid HTTPS URL",runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}}},Nce={title:"Configure coding agents",description:"Install the AgentKit skills bundled with Studio globally for local coding clients.",retry:"Retry",clients:{ariaLabel:"Select coding agents",title:"Local clients",detectAgain:"Detect again",detecting:"Detecting local clients…",detected:"Client detected",available:"Available",unavailable:"Not detected"},skills:{ariaLabel:"Select bundled skills",title:"Bundled skills",viewFiles:"View files",items:{"veadk-agent-development":{name:"VeADK Agent development",description:"Build and refine Agents with VeADK."},"agentkit-cli":{name:"AgentKit CLI",description:"Manage and deploy AgentKit resources with AgentKit CLI."}}},global:{ariaLabel:"Global installation directories",title:"Global installation",description:"Available to other local projects after configuration",empty:"Select a client to see its installation directory."},success:"Configured {{skillCount}} skill(s) for {{agentCount}} client(s)",selection:"{{agentCount}} client(s) and {{skillCount}} skill(s) selected",selectClient:"Select a client first",configuring:"Configuring…",configure:"Configure",errors:{detect:"Failed to detect local clients",configure:"Configuration failed. Check permissions for your user directory and try again."},preview:{description:"Browse the skill files bundled with Studio in read-only mode",close:"Close file preview",loading:"Loading files…",error:"Failed to load skill files",skillFiles:"{{name}} files",files:"Files",fileContent:"File contents",notPreviewable:"This file is not previewable UTF-8 text.",noFiles:"No previewable files."}},Rce={title:"Feishu bot",description:"Create a Feishu Agent powered by AgentKit Runtime",panel:"Enter the credentials for a published Feishu app. Studio will generate a basic Agent, create a dedicated Runtime, and enable the persistent Feishu messaging connection.",agentName:"Agent name",agentNameHelp:"Used as the root Agent name in the new Runtime",region:"Deployment region",regionHelp:"The Runtime and build artifacts will be created in this region",regions:{"cn-beijing":"Beijing","cn-shanghai":"Shanghai"},appId:"Feishu App ID",appIdHelp:"Application credential from the Feishu Open Platform",appSecret:"Feishu App Secret",appSecretPlaceholder:"Enter the App Secret",appSecretHelp:"Written only to the environment variables of the new Runtime",hideSecret:"Hide App Secret",showSecret:"Show App Secret",hide:"Hide",show:"Show",confirmCancel:"Cancelling will stop the task and clean up any Runtime already created. Continue?",status:{preparing:"Generating the basic Agent",running:"Creating Runtime",cancelling:"Cancelling deployment",succeeded:"Feishu bot Runtime created",cancelled:"Deployment cancelled",failed:"Creation failed"},steps:{prepare:"Generate Agent",build:"Build image",deploy:"Create Runtime",publish:"Publish service"},openConsole:"Open Runtime console",credentials:{title:"Credential handling",description:"The App Secret is used only for this deployment. It is never written to generated source code or browser storage."},cancelDeployment:"Cancel deployment",creating:"Creating…",create:"Create Feishu bot Runtime",validation:{appId:"Enter the Feishu App ID",appSecret:"Enter the Feishu App Secret",agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name",characters:"Name must start with a letter or underscore and contain only letters, numbers, and underscores"}},generatedAgent:{description:"A helpful assistant that receives messages through Feishu.",instruction:"You are a helpful assistant serving users through Feishu. Understand each request accurately and provide concise, reliable answers. Ask clarifying questions when information is missing, and never invent facts."}},Ice={title:yce,description:vce,search:xce,categoriesLabel:wce,categories:Oce,resultsLabel:kce,open:Sce,localOnly:Ece,emptyTitle:Cce,emptyDescription:Tce,backToAutomations:Ace,cards:_ce,github:jce,codingAgents:Nce,feishu:Rce},b7e=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:Ace,cards:_ce,categories:Oce,categoriesLabel:wce,codingAgents:Nce,default:Ice,description:vce,emptyDescription:Tce,emptyTitle:Cce,feishu:Rce,github:jce,localOnly:Ece,open:Sce,resultsLabel:kce,search:xce,title:yce},Symbol.toStringTag,{value:"Module"})),Pce={"zh-CN":"简体中文","en-US":"English"},y7e={languageNames:Pce},v7e=Object.freeze(Object.defineProperty({__proto__:null,default:y7e,languageNames:Pce},Symbol.toStringTag,{value:"Module"})),Dce={selectedExcerptLabel:"Selected excerpt",commentLabel:"Annotation",commentSeparator:": ",successTitle:"Added to the Bad Case evaluation set",successDescription:"This annotation is linked to the current question and the complete model response.",done:"Done",ariaLabel:"Annotate the selected model response",title:"Add annotation",content:"Annotation",placeholder:"Describe the issue or the expected change",retryError:"{{error}}. Please try again.",cancel:"Cancel",submit:"Add to Bad Case"},Mce={attachment:"attachment",image:"image",preview:"Preview {{name}}",uploading:"Uploading",uploadFailed:"Upload failed",remove:"Remove {{name}}",previewDialog:"{{name}} preview",download:"Download",close:"Close",reading:"Loading document…",loadFailed:"Failed to load document: {{error}}"},Lce={errorTitle:"Cloud log error",copyError:"Copy complete error details",retry:"Retry",statuses:{live:"Live",connecting:"Connecting",retrying:"Reconnecting",idle:"Disconnected"},title:"Instance logs",description:"The VeFaaS instance handling the current conversation request",close:"Close instance logs",instanceId:"Instance ID",waitingInstance:"Waiting for instance",request:"Request {{id}}",ariaLabel:"Live VeFaaS instance logs",notCapturedTitle:"No instance captured yet",notCapturedDescription:"Send a message to see the instance that handles it and its live logs.",connectingTitle:"Connecting to instance logs",connectingDescription:"Establishing a secure log stream through the Studio BFF.",emptyTitle:"No logs yet",emptyDescription:"Connected to the instance and waiting for new log output.",retention:"Logs refresh automatically. Only the latest {{count}} lines are kept."},$ce={title:"Trace",statuses:{loading:"Loading",ready:"",collecting:"Collecting",disabled:"Disabled",forbidden:"Permission required",error:"Failed to load"},errors:{collecting:"The trace is still being collected. Please wait.",disabled:"Tracing is not enabled for this agent. Enable it in the console and try again.",forbidden:"Your account cannot read APMPlus traces. Ask an administrator for read access.",error:"Failed to load the trace. Please try again later."},callCount:"{{count}} calls · {{duration}} ms",close:"Close",loading:"Loading trace…",retryNow:"Retry now",reload:"Reload",empty:"No trace is available for this session yet.",attributes:"Attributes",selectCall:"Select a call on the left to view its details"},Fce={exportNote:"This conversation was exported from AgentKit Studio for reference only.",imageFailed:"Failed to generate the image. Please try again.",browserUnsupported:"This browser cannot generate a conversation image. Please try again.",copyUnsupported:"This browser cannot copy images. Download the image instead.",exportFailed:"Export failed. Please try again.",title:"Export conversation",description:"Choose a format and download all inputs and outputs through the current response.",close:"Close",generatingContent:"Preparing export…",retry:"Try again",previewPage:"Previewing page 1 of {{count}}",previewAlt:"Conversation export page 1 of {{count}}",format:"Export format",generatingFormat:"Generating {{format}}…",copying:"Copying…",copiedFirst:"First page copied",copied:"Copied",copyFirst:"Copy first page",copyImage:"Copy image",generating:"Generating…",downloadArchive:"Download PNG archive ({{count}} pages)",downloadFormat:"Download {{format}}"},Bce={unsupportedComponent:"Unsupported component: {{component}}",sandboxIdentity:"Codex Sandbox execution identifiers",useSkill:"Use the {{name}} skill",thinkingDone:"Finished thinking",thinking:"Thinking",justNow:"Just now",sourceUnavailable:"The generated source is temporarily unavailable. Please try again later.",downloadStarted:"Download started",verifiedDelivery:"Verified deliverable",generatedSource:"Generated agent source",entryPoint:"Entry point",fileCount:"Files",size:"Size",validationTime:"Validated",generationTime:"Generated",checksPassed:"{{count}} checks passed",sourceReady:"Source is ready to deploy",sourceGuidance:"The source is ready to view, download, or deploy. Confirm the runtime configuration before deployment.",viewSource:"View source",preparing:"Preparing…",viewChanges:"View changes",downloadSource:"Download source",sourceNotReady:"The source is not ready yet",manualDeploy:"Deploy manually to Runtime",deployAgent:"Deploy Agent",beforeOptimization:"Before optimization",afterOptimization:"After optimization",planStatuses:{pending:"Pending",in_progress:"In progress",completed:"Completed",failed:"Incomplete"},renderUi:"Render UI",truncated:"… (truncated)",agentAdjusting:"Agent is adjusting",sandboxDetails:"Detailed Codex Sandbox output",waitingCodex:"Waiting for Codex output",arguments:"Arguments",result:"Result",artifacts:"Artifacts",downloadNamed:"Download {{name}}",powerpoint:"PowerPoint presentation",preview:"Preview",download:"Download",previewDialog:"{{name}} preview",closePreview:"Close preview",slidePreview:"{{name}} slide preview",mcpToolset:"MCP toolset",authorized:"Authorized · {{tool}}",authorizationRequired:"{{tool}} requires authorization",oauthDescription:"The {{tool}} toolset is protected by OAuth and requires sign-in before use.",oauthProvider:"You will be redirected to {{provider}} to sign in.",oauthContinue:"The conversation will continue automatically after authorization.",waitingAuthorization:"Waiting for authorization…",authorize:"Authorize",missingAuthorizationUrl:"No authorization URL was found in the event.",tools:{web_search:{running:"Searching the web",done:"Web search complete"},link_reader:{running:"Reading webpage",done:"Webpage read complete"},run_code:{running:"Running code in the AgentKit sandbox",done:"Code execution completed in the AgentKit sandbox"},list_envs:{running:"Checking available environments",done:"Available environments loaded"},get_env_manifest:{running:"Loading the environment manifest",done:"Environment manifest loaded"},execute_in_sandbox:{running:"Running a command in the environment",done:"Command completed in the environment"},delegate_to_codex_sandbox:{running:"Codex Sandbox is running",done:"Codex Sandbox completed",failed:"Codex Sandbox failed"},image_generate:{running:"Generating image",done:"Image generated"},video_generate:{running:"Generating video",done:"Video generated"},ppt_generate:{running:"Generating presentation",done:"Presentation generated"},load_memory:{running:"Searching long-term memory",done:"Memory search complete"},load_knowledgebase:{running:"Searching the knowledge base",done:"Knowledge base search complete"},load_skill:{running:"Loading skill",done:"Skill loaded"},collect_resources:{running:"Collecting available resources",done:"Resource collection complete",failed:"Resource collection failed"},create_agents:{running:"Creating and running agents",done:"Agent creation complete",failed:"Agent creation failed"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit Skill Center",knowledge_base:"Knowledge base",tool:"Tools"},agentTypes:{llm:"LLM Agent",sequential:"Sequential Agent",parallel:"Parallel Agent",loop:"Loop Agent",workflow:"Workflow"},skill:"Skill",subAgents:"Sub-agents",builtinTool:"Built-in tool",skillCenter:"AgentKit Skill Center",selfAuthoredTools:"Custom tools",dependencies:"Dependencies: {{items}}",fullCode:"Complete code for {{name}}",itemCount:"{{label}}: {{count}} items",collectionAria:"Retrieved resource information",retrieving:"Retrieving resources",retrievalFailed:"Resource retrieval did not complete",checkConfig:"Check the resource service configuration and try again.",notSearched:"Not searched",notConfigured:"Not configured",resourceList:"{{label}} resource list",searchKeywords:"Search keywords",skillHubSkipped:"No search keywords were provided, so Skill Hub was not searched.",sourceSkipped:"{{label}} is not configured, so this source was not searched.",noResources:"No resources in this category were returned.",resultAria:"Agent creation results",creationFailed:"Agent creation did not complete",agentResources:"Resources available to {{name}}",knowledgeBase:"Knowledge base",toolsLabel:"Tools",creating:"Creating agents",noAgents:"No agents to display",noAgentResult:"The tool response did not include an agent configuration or execution result.",sourceLabels:{tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknown:"Unknown source"},unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"},branchCompare:{ariaLabel:"Compare branches",selectDirection:"Select a direction",continue:"Continue in this direction"},codexProgress:{planTitle:"Codex execution plan",fallback:{fileChange:"Modify files",approval:"Waiting for approval",status:"Codex status",command:"Run command"},planSummary:"{{completed}}/{{total}} completed",command:{running:"Running command",completed:"Command completed",failed:"Command failed"},projectFiles:"{{count}} project files",projectFile:"project files",fileChange:{running:"Updating {{subject}}",completed:"Updated {{subject}}",failed:"Failed to update {{subject}}"},externalTool:"external tool",mcp:{running:"Calling {{tool}}",completed:"Called {{tool}}",failed:"{{tool}} call did not complete"},collaboration:{spawn_agent:{running:"Starting subtask",completed:"Subtask started",failed:"Failed to start subtask"},send_input:{running:"Sending information to subtask",completed:"Information sent to subtask",failed:"Failed to send information to subtask"},wait:{running:"Waiting for subtask",completed:"Subtask wait complete",failed:"Subtask wait failed"},close_agent:{running:"Ending subtask",completed:"Subtask ended",failed:"Failed to end subtask"},default:{running:"Coordinating subtasks",completed:"Subtask collaboration complete",failed:"Subtask collaboration failed"}},webSearch:{running:"Searching the web",completed:"Web search complete",failed:"Web search did not complete"},errorDetail:"Codex execution did not complete.",errorTitle:"Codex encountered an error"}},Uce={segments:{system:"System and tools",input:"Input and history",output:"Output and reasoning",remaining:"Remaining"},modelUnavailable:"Model information unavailable",promptWithSystem:"Prompt (including system)",systemUnknown:"System and tool usage unknown",systemApprox:"System and tools approximately {{count}} tokens",ariaKnown:"Context {{percentage}}% used, {{system}}, {{inputLabel}} {{input}} tokens, output and reasoning {{output}} tokens, remaining {{remaining}} tokens",ariaUnknown:"{{model}}, context window unknown, {{count}} cumulative session tokens used",composition:"Context composition",percentageUsed:"{{percentage}}% used",gridAria:"100-cell context composition chart. Each cell represents one percent of the context window.",estimated:"Estimated",unknown:"Unknown",summaryPercentage:"{{used}} used, {{remaining}} remaining",summaryTokens:"{{used}} used, {{remaining}} remaining, {{total}} total",overflow:"Context exceeded by {{count}} tokens",title:"Context usage",unknownModel:"The context window for this model is not available",unknownRuntime:"The current runtime did not provide model information"},Qce={title:"Add AgentKit agent",noAgents:"Connected successfully, but no agents were found at this address (/list-apps was empty).",connectionFailed:"Connection failed: {{error}}. Check the URL, API key, and whether the gateway allows cross-origin requests.",description:"Enter the URL and API key of an AgentKit deployment to connect through the ADK protocol. Connected agents will appear in the selector in the upper-left corner.",url:"Endpoint URL",apiKeyHint:"Connect using Authorization: Bearer",displayName:"Display name (optional)",displayNameHint:"Uses the URL hostname by default",cancel:"Cancel",connecting:"Connecting…",connect:"Connect and add"},zce={placeholder:"Type a message…",inputAria:"Message",generating:"Generating",send:"Send"},Vce={ariaLabel:"Invocation context for this turn",removeSkill:"Remove skill {{name}}",removeAgent:"Remove agent {{name}}"},Hce={cardAria:"{{label}} chart",viewAria:"{{label}} display mode",preview:"Preview",code:"Code",invalidEcharts:"The ECharts configuration is not a valid, safe data object. Switch to Code to inspect it.",renderFailed:"The chart cannot be rendered right now. Switch to Code to inspect it.",echartsAria:"ECharts preview",rendering:"Rendering chart…",mermaidFailed:"The chart cannot be rendered right now. Switch to Code to inspect the Mermaid source.",mermaidAria:"Mermaid preview"},qce={playVideo:"Play video: {{name}}",enlargeImage:"Enlarge image preview: {{name}}",image:"image",enlargeVideo:"Enlarge video",videoPreview:"Video preview",downloadVideo:"Download video",close:"Close"},Wce={annotation:Dce,media:Mce,runtimeLogs:Lce,trace:$ce,share:Fce,blocks:Bce,tokenUsage:Uce,addAgentKit:Qce,composer:zce,invocation:Vce,visualization:Hce,markdown:qce},x7e=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:Qce,annotation:Dce,blocks:Bce,composer:zce,default:Wce,invocation:Vce,markdown:qce,media:Mce,runtimeLogs:Lce,share:Fce,tokenUsage:Uce,trace:$ce,visualization:Hce},Symbol.toStringTag,{value:"Module"})),Kce={back:"Back",cancel:"Cancel",deploy:"Deploy",delete:"Delete",loading:"Loading…",next:"Next",notSupported:"Not supported",previous:"Previous",required:"Required",retry:"Retry",actions:"Actions",value:"Value",disabled:"Off",enabled:"Enabled",none:"None",close:"Close",name:"Name",description:"Description",send:"Send"},Gce={heading:"VeADK agent structure configuration",importHint:"Reload this file from Import YAML on the Create Agent page."},Xce={agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name.",characters:"Start with a letter or underscore and use only letters, numbers, and underscores"},runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}},Yce={description:"A VeADK-powered assistant that understands user intent and uses the right tools to complete tasks.",instruction:`You are a professional and reliable assistant. +{{response}}`,loadArkApiKeysFailed:"Failed to load Ark API keys",loadModelsFailed:"Failed to load models",runtimeAccessDenied:"This account cannot access the Runtime. Refresh the list or sign in again.",privateRuntimeUnavailable:"The Runtime was deployed, but this Studio cannot access the private Runtime. Use a Studio connected to the same VPC, or deploy with public or public plus VPC access.",runtimeTemporarilyUnavailable:"The Runtime was deployed, but Studio cannot connect yet. The gateway domain may still be propagating, or the current network or DNS cannot reach it. Try connecting again later from Manage Agents.",runtimeConnectionUnsupported:"The Runtime Agent Server does not provide a connection endpoint. Confirm that the Runtime is ready and compatible.",runtimeConnectionDenied:"The Runtime rejected the connection request. Check its authentication configuration.",listAgentsFailed:"Failed to load Agents",invalidListAppsJson:"Runtime /list-apps returned unreadable JSON.",invalidListAppsFormat:"Runtime /list-apps returned an invalid format; expected a non-empty string array.",createSessionFailedWithStatus:"Failed to create session ({{status}})",createSessionFailed:"Failed to create session",getSessionFailed:"Failed to load session",getSessionFailedWithDetail:"Failed to load session ({{status}}): {{detail}}",feedbackRuntimeOnly:"Feedback sync is supported only for sessions connected to an AgentKit Runtime",feedbackRegionMissing:"The Runtime region is missing, so feedback cannot be submitted",submitFeedbackFailed:"Failed to submit feedback",loadEvaluationSetsFailed:"Failed to load evaluation sets",loadAutoEvaluationStatusFailed:"Failed to load automatic evaluation status",loadOptimizationsFailed:"Failed to load optimization suggestions",deleteEvaluationCaseFailed:"Failed to delete the evaluation case",downloadFileFailed:"Failed to download the file",fileUnavailable:"File content is unavailable",uploadFileFailed:"File upload failed",traceDisabled:"Tracing is not enabled for this Agent. Enable it in the console first.",loadTraceFailed:"Failed to load trace data",contentTypeMissing:"Content-Type missing",traceNonJson:"Trace failed: the server returned a non-JSON response ({{contentType}}). Check the Studio API proxy configuration",invalidTraceFormat:"Trace failed: invalid response format",submitIssueFeedbackFailed:"Failed to submit issue feedback",issueFeedbackNotConfirmed:"Failed to submit issue feedback: the server did not confirm the submission",noPreviewableAgent:"This Runtime does not provide an Agent that can be previewed.",agentSearchFailed:"Agent search failed",emptySseBody:"HTTP 200 with an empty SSE response body.",noDisplayableSseReply:"HTTP 200, but the SSE response did not contain a displayable model reply.",firstSseEventTimeout:"No SSE event was received within 60 seconds. Try again later, and review the Runtime, model, or gateway logs.",runSessionFailed:"Session run failed",runSseFailedWithDetail:"run_sse failed ({{status}}): {{detail}}",checkRuntimeNameFailed:"Failed to check the Runtime name",invalidRuntimeNameCheck:"Failed to check the Runtime name: invalid response format",loadCloudResourcesFailed:"Failed to load cloud resources",invalidCloudResources:"The cloud resource list response has an invalid format",invalidEnvironmentMount:"The environment mount response has an invalid format",environmentMountMismatch:"The environment mount response does not match the request",environmentMountNetworkFailed:"Unable to connect to Studio, so the environment was not mounted. Check your network and try again.",environmentMountFailed:"Failed to mount the environment",clipboardUnsupported:"This browser does not support writing to the clipboard.",clipboardWriteFailed:"Unable to write to the clipboard. Check clipboard permissions.",loadSystemInfoFailed:"Failed to load system information",invalidSystemInfo:"The system information response has an invalid format",invalidEnvironmentBuild:"The environment build response has an invalid format",invalidEnvironmentBuildStep:"The environment build step response has an invalid format",invalidEnvironmentManifest:"The environment manifest response has an invalid format",invalidImageRepository:"The environment image repository response has an invalid format",invalidCodeRepository:"The environment code repository response has an invalid format",invalidImageSource:"The environment image source response has an invalid format",invalidEnvironment:"The environment response has an invalid format",invalidWorkspace:"The workspace response has an invalid format",loadWorkspacesFailed:"Failed to load workspaces",invalidWorkspaceList:"The workspace list response has an invalid format",saveWorkspaceFailed:"Failed to save the workspace",deleteWorkspaceFailed:"Failed to delete the workspace",loadEnvironmentsFailed:"Failed to load environments",invalidEnvironmentList:"The environment list response has an invalid format",probeRepositoryFailed:"Failed to inspect the code repository",invalidRepositoryProbe:"The code repository inspection response has an invalid format",exportEnvironmentCodeFailed:"Failed to export the environment share code",invalidEnvironmentCode:"The environment share code response has an invalid format",inspectEnvironmentCodeFailed:"Failed to inspect the environment share code",invalidEnvironmentCodeInspection:"The environment share code inspection response has an invalid format",importEnvironmentCodeFailed:"Failed to import the environment share code",invalidEnvironmentCodeImport:"The environment share code import response has an invalid format",studioUnavailable:"Unable to connect to Studio. Confirm that the backend is running and try again.",saveEnvironmentFailed:"Failed to save the environment",deleteEnvironmentFailed:"Failed to delete the environment",startEnvironmentBuildFailed:"Failed to start the environment build",loadEnvironmentBuildFailed:"Failed to load environment build details",loadEnvironmentManifestFailed:"Failed to load the environment manifest",invalidEnvironmentResource:"The environment resource response has an invalid format",loadEnvironmentResourcesFailed:"Failed to load environment build resources",updateCodexSandboxFailed:"Failed to update Codex Sandbox",invalidCodexSandboxUpdate:"The Codex Sandbox update response has an invalid format",loadUserPoolsFailed:"Failed to load user pools",invalidUserPoolList:"The user pool list response has an invalid format",syncGithubFailed:"Failed to sync GitHub code ({{status}})",validatingMigrationArtifact:"Validating migration artifact",uploadingCodePackage:"Uploading code package",migrationArtifactValidated:"Migration artifact validated",codePackageUploaded:"Code package uploaded",deploymentProgress:{preparing:"Preparing deployment",uploading:"Uploading the code package",building:"Building the image",buildLogsSyncing:"Building the image. Build logs are up to date.",buildLogsComplete:"Build log sync complete.",buildFailedLogsSynced:"Image build failed. Final build logs are available.",buildLogsUnavailable:"Build logs are temporarily unavailable.",finalBuildLogsUnavailable:"Final build logs are temporarily unavailable.",deploying:"Deploying the service",publishing:"Publishing the service",evaluating:"Creating evaluation sets",updating:"Updating the Runtime configuration",completing:"Finalizing deployment",github:"Configuring GitHub delivery",inProgress:"Deployment in progress"},deploymentFailed:"Deployment failed",deploymentDisconnected:"Deployment failed: connection interrupted",deploymentMissingAgentName:"Deployment failed: Agent name missing from response",deploymentMissingConnection:"Deployment failed: AgentKit connection information missing from response",cancelDeploymentFailed:"Failed to cancel deployment ({{status}})",loadFailed:"Failed to load ({{status}})",loadPermissionsFailed:"Failed to load permissions ({{status}})",invalidPermissionResponse:"The permission service returned an unreadable response",checkStudioUpdateFailed:"Failed to check for Studio updates ({{status}})",studioUpdatePreflightFailed:"Studio update permission check failed ({{status}})",submitStudioUpdateFailed:"Failed to submit the Studio update ({{status}})",loadAgentUsageFailed:"Failed to load Agent usage",notProvided:"Not provided",agentUsageNonJson:"Failed to load Agent usage: the server returned a non-JSON response (HTTP {{status}}, Content-Type: {{contentType}}). ",checkStudioGateway:"Confirm that the current service is running in Studio mode and check the proxy or gateway configuration.",agentUsageInvalidJson:"Failed to load Agent usage: the server returned invalid JSON (HTTP {{status}}, Content-Type: {{contentType}}). ",retryCheckGateway:"Try again later. If the problem persists, check the proxy or gateway configuration.",loadCronJobsFailed:"Failed to load scheduled tasks",loadCronJobFailed:"Failed to load scheduled task details",createCronJobFailed:"Failed to create the scheduled task",updateCronJobFailed:"Failed to update the scheduled task",enableCronJobFailed:"Failed to enable the scheduled task",pauseCronJobFailed:"Failed to pause the scheduled task",runCronJobFailed:"Failed to run the scheduled task now",loadCronHistoryFailed:"Failed to load execution history",stopCronRunFailed:"Failed to stop the execution",deleteCronJobFailed:"Failed to delete the scheduled task",loadRuntimeFailed:"Failed to load the Runtime",loadLocalToolsFailed:"Failed to load local tools",connectDynamicRouteFailed:"Failed to connect the Studio dynamic route",a2aProbeDenied:"The Runtime rejected the A2A probe. Check the Runtime authentication configuration.",loadA2aCardFailed:"Failed to load the A2A Agent Card",loadRuntimeApiKeyFailed:"Failed to load the Runtime API key",runtimeApiKeyMissing:"The Runtime did not return a usable API key",loadMcpCredentialsFailed:"Failed to load MCP authentication",invalidMcpCredentials:"Studio returned invalid MCP authentication data",deleteFailed:"Delete failed ({{status}})",runtimeManageForbidden:"This account cannot manage the Runtime.",runtimeNotFound:"The Runtime does not exist or has been deleted.",runtimeUnavailable:"This account cannot access the Runtime.",checkRuntimeUpdateFailed:"Failed to check Runtime update capability (HTTP {{status}}). Try again later.",loadRuntimeDetailFailed:"Failed to load Runtime details",generateProjectFailed:"Failed to generate the project",generateProjectTimedOut:"Generating the publish preview project timed out. Please try again.",generateAgentConfigFailed:"Failed to generate the Agent configuration",createDebugRunFailed:"Failed to create the debug run",createDebugSessionFailed:"Failed to create the debug session",loadDebugTraceFailed:"Failed to load the debug trace",invalidDebugTrace:"Failed to load the debug trace: invalid response format",debugRunFailed:"Debug run failed",cleanupDebugRunFailed:"Failed to clean up the debug run"},ule={loadFailed:"Failed to load conversation mode capabilities (HTTP {{status}})",invalidResponse:"The conversation mode capabilities response has an invalid format"},dle={nonJson:"{{fallback}}: the server returned a non-JSON response (HTTP {{status}}, {{contentType}}){{detail}}"},fle={busy:"The workspace is busy. Try again shortly",notFound:"Workspace not found",duplicates:"Multiple personal workspace sessions were found. Contact your administrator",timeout:"Workspace recovery timed out. Your projects are retained. Try again",unavailable:"The workspace cannot be restored right now. Your projects are retained. Try again",persistence:"Persistence is not enabled for this Sandbox. Check the workspace configuration",startup:"Workspace startup failed. Check the Sandbox status",exists:"This project already exists. Open it from the project list",directory:"Project directory not found",configuration:"Configure the workspace Sandbox image first",state:"Could not check workspace status. Try again",list:"Could not restore the workspace or load projects. Try again",create:"Project initialization failed. Check that the image is available and try again",open:"Could not restore the workspace or open the project. Try again",connection:"Could not connect to the workspace. Try again",invalidWorkspaceUrl:"The workspace returned an invalid URL",operation:"Project operation failed. Try again",invalidProjectUrl:"The project URL is invalid",listFallback:"Could not load projects",connectionState:"Could not connect to the workspace. Try again"},hle={reporting:"Completing delivery details",packaging:"Preparing artifacts",savingVersion:"Saving version",finishing:"Finishing request",submitResult:"Submit build result",requestFailed:"Task request failed. Please retry.",invalidResponse:"Invalid task state response.",eventGap:"Restoring missing task output.",reconnecting:"Reconnecting. Existing output is preserved.",input:{pending:"Queued",sending:"Confirming delivery",delivered:"Delivered",withdrawn:"Not sent"},plan:"Execution plan",diff:"File changes",preparing:"Preparing task",preparingEnvironment:"Preparing development environment…",connectingEnvironment:"Connecting to development environment…",processing:"Processing request",thinking:"Thinking",read:"Read file · {{target}}",listFiles:"List directory · {{target}}",search:"Search · {{target}}",command:"Run command · {{target}}",editFiles:"Edit files · {{target}}",webSearch:"Search web · {{target}}",processSummary:"Processed {{count}} items",duration:"{{seconds}}s",durationUnits:{milliseconds:"{{value}} ms",hours:"{{value}} h",minutes:"{{value}} min",seconds:"{{value}} s"},failedTools:"{{count}} tools failed",toolFailed:"Failed",toolCalls:"{{count}} tool calls",turnDuration:"Turn elapsed {{duration}}",toolDuration:"Tool time {{duration}}",toolDurationPartial:"Recorded tool time {{duration}}",toolDurationHelp:"Sum of tool durations. Parallel calls can exceed turn elapsed time.",turnStatus:{completed:"Completed",failed:"Failed",interrupted:"Interrupted",cancelled:"Interrupted",unavailable:"Task ended"},notReported:"Not reported",partial:"Recorded",partialHelp:"Usage for this turn may be incomplete.",tokenDetails:"Turn token usage",model:"Turn model",totalTokens:"Total",inputTokens:"Input",cachedInputTokens:"Cached input",uncachedInputTokens:"Uncached input",cacheWriteInputTokens:"Cache write",outputTokens:"Output",reasoningOutputTokens:"Reasoning output",cacheHitRate:"Input cache hit rate",tokenHelp:"Cached input and reasoning output are subsets of input and output. Uncached input = input − cached input."},ple={common:Vae,agentkitCli:Hae,cloudRegion:qae,connections:Wae,feishuBot:Kae,requestError:Gae,runSse:Xae,runtimeLogs:Yae,search:Zae,skills:Jae,sse:ele,identity:tle,github:nle,video:ile,websiteIntegration:rle,knowledge:sle,intelligentDevelopment:ole,migrations:ale,sandbox:lle,client:cle,newChatCapabilities:ule,jsonResponse:dle,workspaceProjects:fle,developmentRuns:hle},h7e=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:Hae,client:cle,cloudRegion:qae,common:Vae,connections:Wae,default:ple,developmentRuns:hle,feishuBot:Kae,github:nle,identity:tle,intelligentDevelopment:ole,jsonResponse:dle,knowledge:sle,migrations:ale,newChatCapabilities:ule,requestError:Gae,runSse:Xae,runtimeLogs:Yae,sandbox:lle,search:Zae,skills:Jae,sse:ele,video:ile,websiteIntegration:rle,workspaceProjects:fle},Symbol.toStringTag,{value:"Module"})),mle="Agent reviews",gle="Request access for everyone in your organization",ble="Close",yle="Refresh",vle="Status",xle="Applicant",wle="Submitted",Ole="Current version",kle="Model",Sle="Returned by",Ele="Approved by",Cle="Reviewed",Tle="Agent description",Ale="Application notes",_le="Return reason",jle="Review comment",Nle="Return reason (required)",Rle="Content changed after submission; return and submit again",Ile="Withdraw to edit this Agent, then submit a new request to publish it",Ple="Other users will lose access to this Agent. Unpublish it?",Dle="Cancel",Mle="Confirm",Lle="Saving",$le="Unpublish",Fle="Withdraw request",Ble="Approve",Ule="Publish for everyone",Qle="Request publication",zle="Everyone",Vle={pending:"Pending",approved:"Approved",returned:"Returned",withdrawn:"Withdrawn"},Hle="Search agents or applicants",qle="Region",Wle="All statuses",Kle="Agent",Gle="Actions",Xle="Review application",Yle="Application details",Zle="No matching applications",Jle="No Agent review requests",ece="{{count}} / {{limit}} characters",p7e={title:mle,dialogDescription:gle,close:ble,refresh:yle,statusTitle:vle,submitter:xle,submittedAt:wle,version:Ole,model:kle,returnedBy:Sle,approvedBy:Ele,reviewedAt:Cle,description:Tle,message:Ale,reason:_le,comment:jle,reasonRequired:Nle,contentChanged:Rle,withdrawConfirm:Ile,unpublishConfirm:Ple,cancel:Dle,confirm:Mle,saving:Lle,unpublish:$le,withdraw:Fle,return:"Return",approve:Ble,publish:Ule,submit:Qle,private:"Private",enterprise:zle,status:Vle,search:Hle,region:qle,all:Wle,agent:Kle,actions:Gle,review:Xle,details:Yle,noMatches:Zle,empty:Jle,textCount:ece},m7e=Object.freeze(Object.defineProperty({__proto__:null,actions:Gle,agent:Kle,all:Wle,approve:Ble,approvedBy:Ele,cancel:Dle,close:ble,comment:jle,confirm:Mle,contentChanged:Rle,default:p7e,description:Tle,details:Yle,dialogDescription:gle,empty:Jle,enterprise:zle,message:Ale,model:kle,noMatches:Zle,publish:Ule,reason:_le,reasonRequired:Nle,refresh:yle,region:qle,returnedBy:Sle,review:Xle,reviewedAt:Cle,saving:Lle,search:Hle,status:Vle,statusTitle:vle,submit:Qle,submittedAt:wle,submitter:xle,textCount:ece,title:mle,unpublish:$le,unpublishConfirm:Ple,version:Ole,withdraw:Fle,withdrawConfirm:Ile},Symbol.toStringTag,{value:"Module"})),tce={backToEvaluationCase:"Back to evaluation case",cancel:"Cancel",copied:"Copied",copy:"Copy",exportConversation:"Export conversation",retry:"Retry"},nce={title:"How would you like to add an Agent?",subtitle:"Choose the approach that best fits your project.",quickCreate:{title:"Create from scratch",description:"Build an Agent with intelligent, custom, template, or workflow modes."},intelligent:{title:"Intelligent mode",description:"Describe your goal, then build, debug, and validate the Agent interactively."},package:{title:"Add and deploy a code package",description:"Upload an Agent project archive, review the code, and deploy it to AgentKit Runtime."},migrate:{title:"Migrate an existing project",description:"Migrate an existing LangChain, Dify, or similar project to AgentKit Runtime."}},ice={subject:{file:"file changes",command:"command execution"},decision:{accept:"Allowed {{subject}} once",acceptForSession:"Allowed {{subject}} for this session",decline:"Declined {{subject}}",cancel:"Cancelled approval for {{subject}}"},details:{command:"Command",grantRoot:"Authorized path",cwd:"Working directory"}},rce={noDescription:"No description",region:"Region",unknownAgent:"Unknown Agent"},sce={agentTransfer:"Agent handoff",annotationHint:"Model response; select text to add an annotation",continueBranch:"Continue with “{{branch}}”",emptyResponse:"This response has no displayable content.",subagentDescription:"Working on a task handed off by the primary Agent."},oce={title:"Configure {{provider}} credentials",prefix:"Agent Workspace requires {{provider}} credentials. Set",and:"and",suffix:"in the runtime environment, then retry."},ace={buildRunning:{title:"A build is still running",description:"Leaving will stop this build. The session will remain available in your history.",confirm:"Stop and leave"},deleteThread:{title:"Delete Codex session",description:"Delete “{{name}}” and remove it from your session history?",confirm:"Delete"},returnToCreate:{title:"Return to the create page?",description:"Your current entries will be lost.",confirm:"Return"}},lce={additionalAgentDeleteFailures:"; {{count}} more failed",agentDeleteFailures:"Failed to delete {{count}} Agents: {{failures}}{{suffix}}",agentToolsMissing:"This Agent is missing required tools: {{tools}}",buildStopUnconfirmed:"You left the development environment, but Studio could not confirm that the build stopped. It may still be running; check its status in session history later.",builtinAgentSendFailed:"Failed to send to the built-in Agent: {{message}}",bytePlusEvaluationUnsupported:"AgentKit evaluation sets are not currently supported on BytePlus",clipboardUnsupported:"This browser does not support writing to the clipboard.",cloudCodexEmptyReply:"The cloud Codex task ended without a response. Send the task again.",cloudCodexSessionMissing:"The cloud Codex session has not appeared in the list yet. Try again shortly.",deploymentRuntimeIdMissing:"Deployment completed without returning a Runtime ID.",environmentExpired:"The selected environment is no longer available. Refresh and select it again.",environmentsLoadFailed:"Failed to load environments",evaluationCaseSessionMissing:"This evaluation case has no session reference and cannot be opened.",evaluationUnsupportedForReply:"This response cannot be added to an evaluation set",firstFrameRequired:"Add a first-frame image before generating from first and last frames.",incompletePromptOptimization:"The prompt optimization result is incomplete. Run the optimization again.",intelligentCapabilityCheckFailed:"Failed to check intelligent development capabilities (HTTP {{status}})",intelligentSessionCreateFailed:"Failed to create the intelligent development session",invalidIntelligentCapability:"The intelligent development capability response is invalid.",localBffToolsNotConfigured:"No tools are configured for the local Studio BFF.",localToolsLoadFailed:"Failed to load local tools",loginPopupBlocked:"The browser blocked the sign-in window. Allow pop-ups and try again.",loginPopupClosed:"The sign-in window was closed. Sign in again to continue.",mediaTooLarge:"{{fileName}} exceeds this platform's media size limit.",mountEnvironmentFailed:"Failed to mount the environment",noConnectedSandbox:"No Sandbox is currently connected.",noCreateAgentPermission:"Your account does not have permission to add Agents.",noManageAgentPermission:"Your account does not have permission to manage Agents.",noOptimizationBaseline:"There is no pre-optimization version available for comparison.",oauthUrlMissing:"The event does not include an authorization URL.",onlyCloudAgentUpdatable:"Only deployed cloud Agents can be updated.",optimizationVersionMissing:"The project version for this optimization could not be found. It may have been deleted.",persistentStorageNotConfigured:"Persistent storage has not been configured by an administrator",readDraftFailed:"Unable to read local drafts. Try again.",runtimeAgentNameMissing:"The Runtime is missing an Agent name and cannot be updated.",runtimeBffToolsDisabled:"BFF tool capabilities are not enabled for this Runtime Agent.",runtimeDeploymentConfigUnavailable:"The Runtime's original deployment configuration cannot be restored, so it cannot be updated safely.",runtimeMissingForConnection:"Runtime information is missing, so the Agent cannot be connected.",runtimeRegionMissingForDelete:"The Runtime is missing region information and cannot be deleted.",runtimeRegionMissingForUpdate:"The Runtime is missing region information and cannot be updated.",runtimeUpdateUnsupported:"This Runtime does not support in-place updates.",sandboxRuntimeUnavailable:"This Agent does not have an available Sandbox Runtime.",sandboxToolsUnavailable:"The current Studio BFF does not provide Sandbox execution tools.",saveDraftLocationRejected:"The browser could not save the current draft location. Check site storage permissions and try again.",saveDraftRejected:"The browser could not save the draft. Try again.",selectSkillToOptimize:"Select a Skill to optimize first.",sessionMissingForMount:"The current session does not exist, so an environment cannot be mounted.",sessionNotReady:"The session is not ready yet.",sessionUnavailable:"The current session is unavailable. Close it and try again.",sourceNotReady:"The source is not ready yet. Return to the conversation to continue.",textVideoRejectsReferences:"Text-to-video does not use reference media. Remove the images or videos first.",videoEditRequiresVideo:"Add the video you want to edit first.",videoExtendRequiresVideo:"Add a source video before extending it.",videoGenerationFailed:"Video generation failed. Try again later.",videoModeUnsupported:"The selected video mode is not supported on this platform.",videoPreviewMissing:"The video task completed, but the server did not return a preview URL.",videoReferenceRequired:"Add at least one reference image or video."},cce={like:"Like",removeLike:"Remove like",dislike:"Dislike",removeDislike:"Remove dislike",reportIssue:"Report an issue",traceFlameGraph:"Tracing flame graph"},uce={0:"What would you like to work on today?",1:"How can I help?",2:"What would you like me to look into?",3:"Ask me anything",4:"Hi, let's get started",5:"Start a new conversation",6:"What should we tackle first?",7:"Tell me what you have in mind",8:"Where should we begin?",9:"What can I help you with?",10:"Ready to move this forward?",11:"What's most important right now?",12:"Let's get something done today",13:"I'm ready when you are",intelligentDevelopment:"Give your ideas room to grow"},dce={agentCapabilities:"Checking Agent capabilities…",session:"Loading session…"},fce={cancelled:"Authorization was cancelled.",pasteCallbackUrl:"After authorization, paste the full callback URL from your browser's address bar:",popupBlocked:"The browser blocked the authorization window. Allow pop-ups and try again.",unsupportedUrl:"The authorization URL is not HTTP or HTTPS and was blocked."},hce={volcengine:"Volcengine"},pce={checkingPersistence:"Checking persistent storage…",exitDevelopment:"Exit development",fileUploaded:"Uploaded a file to the Sandbox",filesUploaded:"Uploaded {{count}} files to the Sandbox",intelligentDevelopment:"Intelligent development",mode:{readOnly:"Read only",workspaceWrite:"Workspace write",fullAccess:"Full access"},approvalPolicy:{untrusted:"Untrusted commands only",onRequest:"Ask when needed",never:"Never ask"},reviewer:{user:"Ask me",autoReview:"Automatic review"},labels:{approvalPolicy:"Approval policy",file:"File",fileNumber:"File {{number}}",mode:"Sandbox mode",networkAccess:"Network access",reviewer:"Approval method",workingDirectory:"Working directory"},network:{allowed:"Allowed",disabled:"Off"},permissionsUpdated:"Updated Codex permissions for this Sandbox session",persistenceUnknown:"Unable to verify persistent storage",stoppedReady:"Stopped. You can continue typing.",uploadedFilesPrompt:"The following files were uploaded to the current Sandbox workspace. Use them in this task:",workspaceUpdated:"Workspace updated"},mce={addAgent:"Add Agent",addFromPackage:"Add from code package",agent:"Agent",automations:"Automations",createAgent:"Create Agent",createSkill:"Create Skill",cronJobs:"Cronjob",issueFeedback:"Issue feedback",library:"Library",migrateAgent:"Migrate Agent",newConversation:"New conversation",optimizeSkill:"Optimize {{name}}",search:"Search",skill:"Skill",skillLibrary:"Skill library",systemInfo:"System information",updateAgent:"Update {{name}}",codeProjects:"Code projects",reviewCenter:"Review center"},gce={title:"Create from workspace",description:"Create and manage code projects, then develop and debug in VS Code"},bce={actions:tce,addAgent:nce,approval:ice,common:rce,conversation:sce,credentials:oce,dialogs:ace,errors:lce,feedback:cce,greetings:uce,loading:dce,oauth:fce,providers:hce,sandbox:pce,titles:mce,workspaceProjectEntry:gce},g7e=Object.freeze(Object.defineProperty({__proto__:null,actions:tce,addAgent:nce,approval:ice,common:rce,conversation:sce,credentials:oce,default:bce,dialogs:ace,errors:lce,feedback:cce,greetings:uce,loading:dce,oauth:fce,providers:hce,sandbox:pce,titles:mce,workspaceProjectEntry:gce},Symbol.toStringTag,{value:"Module"})),yce="Automations",vce="Connect development tools and extend your Agents with automated workflows",xce="Search automations",wce="Automation categories",Oce={development:"Development",channels:"Messaging channels"},kce="{{category}} automations",Sce="Open {{name}}",Ece="Available only in local deployments",Cce="No matching automations",Tce="Try searching for another name",Ace="Back to automations",_ce={"coding-agents":{name:"Configure coding agents",badge:"Local",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},template:{name:"Import starter project",description:"Create a minimal Agent project in your repository with continuous delivery to AgentKit Runtime.",title:"Import starter project",subtitle:"Add a ready-to-run basic Agent and continuous delivery configuration to your repository",panel:"This creates a pull request containing the basic project and AgentKit Runtime delivery workflow.",submitLabel:"Import template and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: import AgentKit basic template",description:"Import a basic Agent project with the AgentKit Studio App Server and add continuous delivery to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:"agentkit-basic-agent",help:"The basic project will be added here; app.py mounts the complete Studio App Server and serves as the entry point"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},delivery:{name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: continuously publish to AgentKit Runtime",description:"Add a GitHub Actions workflow that continuously publishes updates from the target branch to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},review:{name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",regionHelp:"",pullRequest:{title:"chore: configure automated PR review",description:"Add a GitHub Actions workflow that reviews same-repository pull requests in an isolated Sandbox and publishes the result as a GitHub review. Configure the required workflow secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},sandboxToolId:{label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"The AgentKit CodeEnv used for each review"},modelName:{label:"Review model",placeholder:"review-model",help:"The code review model name injected into the Sandbox"},modelBaseUrl:{label:"Model API URL",placeholder:"https://ark.example.com/api/v3",help:"Must be an OpenAI-compatible HTTPS endpoint"}}},"gitlab-review":{name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."},feishu:{name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},"website-integration":{name:"Website integration",description:"Embed an AgentKit Runtime on your website as a floating chat window."}},jce={required:"Required",optional:"Optional",region:"Region",tokenLabel:"GitHub Token",getToken:"Get token",createToken:"Create GitHub token",tokenPlaceholder:"Requires write access to repository contents and pull requests",tokenWorkflowPlaceholder:"Requires write access to contents, pull requests, and workflows",hideToken:"Hide token",showToken:"Show token",tokenHelp:"The token is used only for this submission. It is not stored in the browser or written to the pull request.",tokenWorkflowHelp:"This token is used only to create the configuration PR. It is not a general Sandbox requirement and is not stored in the browser or written to the PR.",prCreated:"PR #{{number}} created",configPrCreated:"Configuration PR #{{number}} created",configPrNextStep:"After it is merged, later pull requests in the same repository will trigger reviews automatically.",viewOnGitHub:"View on GitHub",viewConfigPr:"View configuration PR",secretsHeading:"Before merging the pull request, configure these GitHub Actions secrets in the repository:",secretsConfigHeading:"Before merging the configuration PR, add runtime secrets to the target repository",openSecrets:"Open Secrets settings",secretsPath:"Path: Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"A PR review configuration will be added for {{repository}}",repositoryReviewHelp:"GitHub App will validate pull requests for {{repository}}",secretPair:"{{accessKey}}, {{secretKey}} (required)",sessionToken:"{{sessionToken}} (required when using temporary credentials)",requiredSecret:"{{name}} (required)",temporaryCredentialRequired:" (required when using temporary credentials)",requiredSuffix:" (required)",submitting:"Creating PR…",validation:{required:"This field is required",repository:"Enter owner/repository or a full GitHub repository URL",baseBranch:"The target branch format is invalid",projectPath:"Enter a relative path within the repository",runtimeId:"The Runtime ID format is invalid",sandboxToolId:"The Sandbox Tool ID format is invalid",modelName:"The model name format is invalid",modelBaseUrlSafe:"Enter an HTTPS URL without credentials, query parameters, or fragments",modelBaseUrl:"Enter a valid HTTPS URL",runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}}},Nce={title:"Configure coding agents",description:"Install the AgentKit skills bundled with Studio globally for local coding clients.",retry:"Retry",clients:{ariaLabel:"Select coding agents",title:"Local clients",detectAgain:"Detect again",detecting:"Detecting local clients…",detected:"Client detected",available:"Available",unavailable:"Not detected"},skills:{ariaLabel:"Select bundled skills",title:"Bundled skills",viewFiles:"View files",items:{"veadk-agent-development":{name:"VeADK Agent development",description:"Build and refine Agents with VeADK."},"agentkit-cli":{name:"AgentKit CLI",description:"Manage and deploy AgentKit resources with AgentKit CLI."}}},global:{ariaLabel:"Global installation directories",title:"Global installation",description:"Available to other local projects after configuration",empty:"Select a client to see its installation directory."},success:"Configured {{skillCount}} skill(s) for {{agentCount}} client(s)",selection:"{{agentCount}} client(s) and {{skillCount}} skill(s) selected",selectClient:"Select a client first",configuring:"Configuring…",configure:"Configure",errors:{detect:"Failed to detect local clients",configure:"Configuration failed. Check permissions for your user directory and try again."},preview:{description:"Browse the skill files bundled with Studio in read-only mode",close:"Close file preview",loading:"Loading files…",error:"Failed to load skill files",skillFiles:"{{name}} files",files:"Files",fileContent:"File contents",notPreviewable:"This file is not previewable UTF-8 text.",noFiles:"No previewable files."}},Rce={title:"Feishu bot",description:"Create a Feishu Agent powered by AgentKit Runtime",panel:"Enter the credentials for a published Feishu app. Studio will generate a basic Agent, create a dedicated Runtime, and enable the persistent Feishu messaging connection.",agentName:"Agent name",agentNameHelp:"Used as the root Agent name in the new Runtime",region:"Deployment region",regionHelp:"The Runtime and build artifacts will be created in this region",regions:{"cn-beijing":"Beijing","cn-shanghai":"Shanghai"},appId:"Feishu App ID",appIdHelp:"Application credential from the Feishu Open Platform",appSecret:"Feishu App Secret",appSecretPlaceholder:"Enter the App Secret",appSecretHelp:"Written only to the environment variables of the new Runtime",hideSecret:"Hide App Secret",showSecret:"Show App Secret",hide:"Hide",show:"Show",confirmCancel:"Cancelling will stop the task and clean up any Runtime already created. Continue?",status:{preparing:"Generating the basic Agent",running:"Creating Runtime",cancelling:"Cancelling deployment",succeeded:"Feishu bot Runtime created",cancelled:"Deployment cancelled",failed:"Creation failed"},steps:{prepare:"Generate Agent",build:"Build image",deploy:"Create Runtime",publish:"Publish service"},openConsole:"Open Runtime console",credentials:{title:"Credential handling",description:"The App Secret is used only for this deployment. It is never written to generated source code or browser storage."},cancelDeployment:"Cancel deployment",creating:"Creating…",create:"Create Feishu bot Runtime",validation:{appId:"Enter the Feishu App ID",appSecret:"Enter the Feishu App Secret",agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name",characters:"Name must start with a letter or underscore and contain only letters, numbers, and underscores"}},generatedAgent:{description:"A helpful assistant that receives messages through Feishu.",instruction:"You are a helpful assistant serving users through Feishu. Understand each request accurately and provide concise, reliable answers. Ask clarifying questions when information is missing, and never invent facts."}},Ice={title:yce,description:vce,search:xce,categoriesLabel:wce,categories:Oce,resultsLabel:kce,open:Sce,localOnly:Ece,emptyTitle:Cce,emptyDescription:Tce,backToAutomations:Ace,cards:_ce,github:jce,codingAgents:Nce,feishu:Rce},b7e=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:Ace,cards:_ce,categories:Oce,categoriesLabel:wce,codingAgents:Nce,default:Ice,description:vce,emptyDescription:Tce,emptyTitle:Cce,feishu:Rce,github:jce,localOnly:Ece,open:Sce,resultsLabel:kce,search:xce,title:yce},Symbol.toStringTag,{value:"Module"})),Pce={"zh-CN":"简体中文","en-US":"English"},y7e={languageNames:Pce},v7e=Object.freeze(Object.defineProperty({__proto__:null,default:y7e,languageNames:Pce},Symbol.toStringTag,{value:"Module"})),Dce={selectedExcerptLabel:"Selected excerpt",commentLabel:"Annotation",commentSeparator:": ",successTitle:"Added to the Bad Case evaluation set",successDescription:"This annotation is linked to the current question and the complete model response.",done:"Done",ariaLabel:"Annotate the selected model response",title:"Add annotation",content:"Annotation",placeholder:"Describe the issue or the expected change",retryError:"{{error}}. Please try again.",cancel:"Cancel",submit:"Add to Bad Case"},Mce={attachment:"attachment",image:"image",preview:"Preview {{name}}",uploading:"Uploading",uploadFailed:"Upload failed",remove:"Remove {{name}}",previewDialog:"{{name}} preview",download:"Download",close:"Close",reading:"Loading document…",loadFailed:"Failed to load document: {{error}}"},Lce={errorTitle:"Cloud log error",copyError:"Copy complete error details",retry:"Retry",statuses:{live:"Live",connecting:"Connecting",retrying:"Reconnecting",idle:"Disconnected"},title:"Instance logs",description:"The VeFaaS instance handling the current conversation request",close:"Close instance logs",instanceId:"Instance ID",waitingInstance:"Waiting for instance",request:"Request {{id}}",ariaLabel:"Live VeFaaS instance logs",notCapturedTitle:"No instance captured yet",notCapturedDescription:"Send a message to see the instance that handles it and its live logs.",connectingTitle:"Connecting to instance logs",connectingDescription:"Establishing a secure log stream through the Studio BFF.",emptyTitle:"No logs yet",emptyDescription:"Connected to the instance and waiting for new log output.",retention:"Logs refresh automatically. Only the latest {{count}} lines are kept."},$ce={title:"Trace",statuses:{loading:"Loading",ready:"",collecting:"Collecting",disabled:"Disabled",forbidden:"Permission required",error:"Failed to load"},errors:{collecting:"The trace is still being collected. Please wait.",disabled:"Tracing is not enabled for this agent. Enable it in the console and try again.",forbidden:"Your account cannot read APMPlus traces. Ask an administrator for read access.",error:"Failed to load the trace. Please try again later."},callCount:"{{count}} calls · {{duration}} ms",close:"Close",loading:"Loading trace…",retryNow:"Retry now",reload:"Reload",empty:"No trace is available for this session yet.",attributes:"Attributes",selectCall:"Select a call on the left to view its details"},Fce={exportNote:"This conversation was exported from AgentKit Studio for reference only.",imageFailed:"Failed to generate the image. Please try again.",browserUnsupported:"This browser cannot generate a conversation image. Please try again.",copyUnsupported:"This browser cannot copy images. Download the image instead.",exportFailed:"Export failed. Please try again.",title:"Export conversation",description:"Choose a format and download all inputs and outputs through the current response.",close:"Close",generatingContent:"Preparing export…",retry:"Try again",previewPage:"Previewing page 1 of {{count}}",previewAlt:"Conversation export page 1 of {{count}}",format:"Export format",generatingFormat:"Generating {{format}}…",copying:"Copying…",copiedFirst:"First page copied",copied:"Copied",copyFirst:"Copy first page",copyImage:"Copy image",generating:"Generating…",downloadArchive:"Download PNG archive ({{count}} pages)",downloadFormat:"Download {{format}}"},Bce={unsupportedComponent:"Unsupported component: {{component}}",sandboxIdentity:"Codex Sandbox execution identifiers",useSkill:"Use the {{name}} skill",thinkingDone:"Finished thinking",thinking:"Thinking",justNow:"Just now",sourceUnavailable:"The generated source is temporarily unavailable. Please try again later.",downloadStarted:"Download started",verifiedDelivery:"Verified deliverable",generatedSource:"Generated agent source",entryPoint:"Entry point",fileCount:"Files",size:"Size",validationTime:"Validated",generationTime:"Generated",checksPassed:"{{count}} checks passed",sourceReady:"Source is ready to deploy",sourceGuidance:"The source is ready to view, download, or deploy. Confirm the runtime configuration before deployment.",viewSource:"View source",preparing:"Preparing…",viewChanges:"View changes",downloadSource:"Download source",sourceNotReady:"The source is not ready yet",manualDeploy:"Deploy manually to Runtime",deployAgent:"Deploy Agent",beforeOptimization:"Before optimization",afterOptimization:"After optimization",planStatuses:{pending:"Pending",in_progress:"In progress",completed:"Completed",failed:"Incomplete"},renderUi:"Render UI",truncated:"… (truncated)",agentAdjusting:"Agent is adjusting",sandboxDetails:"Detailed Codex Sandbox output",waitingCodex:"Waiting for Codex output",arguments:"Arguments",result:"Result",artifacts:"Artifacts",downloadNamed:"Download {{name}}",powerpoint:"PowerPoint presentation",preview:"Preview",download:"Download",previewDialog:"{{name}} preview",closePreview:"Close preview",slidePreview:"{{name}} slide preview",mcpToolset:"MCP toolset",authorized:"Authorized · {{tool}}",authorizationRequired:"{{tool}} requires authorization",oauthDescription:"The {{tool}} toolset is protected by OAuth and requires sign-in before use.",oauthProvider:"You will be redirected to {{provider}} to sign in.",oauthContinue:"The conversation will continue automatically after authorization.",waitingAuthorization:"Waiting for authorization…",authorize:"Authorize",missingAuthorizationUrl:"No authorization URL was found in the event.",tools:{web_search:{running:"Searching the web",done:"Web search complete"},link_reader:{running:"Reading webpage",done:"Webpage read complete"},run_code:{running:"Running code in the AgentKit sandbox",done:"Code execution completed in the AgentKit sandbox"},list_envs:{running:"Checking available environments",done:"Available environments loaded"},get_env_manifest:{running:"Loading the environment manifest",done:"Environment manifest loaded"},execute_in_sandbox:{running:"Running a command in the environment",done:"Command completed in the environment"},delegate_to_codex_sandbox:{running:"Codex Sandbox is running",done:"Codex Sandbox completed",failed:"Codex Sandbox failed"},image_generate:{running:"Generating image",done:"Image generated"},video_generate:{running:"Generating video",done:"Video generated"},ppt_generate:{running:"Generating presentation",done:"Presentation generated"},load_memory:{running:"Searching long-term memory",done:"Memory search complete"},load_knowledgebase:{running:"Searching the knowledge base",done:"Knowledge base search complete"},load_skill:{running:"Loading skill",done:"Skill loaded"},collect_resources:{running:"Collecting available resources",done:"Resource collection complete",failed:"Resource collection failed"},create_agents:{running:"Creating and running agents",done:"Agent creation complete",failed:"Agent creation failed"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit Skill Center",knowledge_base:"Knowledge base",tool:"Tools"},agentTypes:{llm:"LLM Agent",sequential:"Sequential Agent",parallel:"Parallel Agent",loop:"Loop Agent",workflow:"Workflow"},skill:"Skill",subAgents:"Sub-agents",builtinTool:"Built-in tool",skillCenter:"AgentKit Skill Center",selfAuthoredTools:"Custom tools",dependencies:"Dependencies: {{items}}",fullCode:"Complete code for {{name}}",itemCount:"{{label}}: {{count}} items",collectionAria:"Retrieved resource information",retrieving:"Retrieving resources",retrievalFailed:"Resource retrieval did not complete",checkConfig:"Check the resource service configuration and try again.",notSearched:"Not searched",notConfigured:"Not configured",resourceList:"{{label}} resource list",searchKeywords:"Search keywords",skillHubSkipped:"No search keywords were provided, so Skill Hub was not searched.",sourceSkipped:"{{label}} is not configured, so this source was not searched.",noResources:"No resources in this category were returned.",resultAria:"Agent creation results",creationFailed:"Agent creation did not complete",agentResources:"Resources available to {{name}}",knowledgeBase:"Knowledge base",toolsLabel:"Tools",creating:"Creating agents",noAgents:"No agents to display",noAgentResult:"The tool response did not include an agent configuration or execution result.",sourceLabels:{tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknown:"Unknown source"},unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"},branchCompare:{ariaLabel:"Compare branches",selectDirection:"Select a direction",continue:"Continue in this direction"},codexProgress:{planTitle:"Codex execution plan",fallback:{fileChange:"Modify files",approval:"Waiting for approval",status:"Codex status",command:"Run command"},planSummary:"{{completed}}/{{total}} completed",command:{running:"Running command",completed:"Command completed",failed:"Command failed"},projectFiles:"{{count}} project files",projectFile:"project files",fileChange:{running:"Updating {{subject}}",completed:"Updated {{subject}}",failed:"Failed to update {{subject}}"},externalTool:"external tool",mcp:{running:"Calling {{tool}}",completed:"Called {{tool}}",failed:"{{tool}} call did not complete"},collaboration:{spawn_agent:{running:"Starting subtask",completed:"Subtask started",failed:"Failed to start subtask"},send_input:{running:"Sending information to subtask",completed:"Information sent to subtask",failed:"Failed to send information to subtask"},wait:{running:"Waiting for subtask",completed:"Subtask wait complete",failed:"Subtask wait failed"},close_agent:{running:"Ending subtask",completed:"Subtask ended",failed:"Failed to end subtask"},default:{running:"Coordinating subtasks",completed:"Subtask collaboration complete",failed:"Subtask collaboration failed"}},webSearch:{running:"Searching the web",completed:"Web search complete",failed:"Web search did not complete"},errorDetail:"Codex execution did not complete.",errorTitle:"Codex encountered an error"}},Uce={segments:{system:"System and tools",input:"Input and history",output:"Output and reasoning",remaining:"Remaining"},modelUnavailable:"Model information unavailable",promptWithSystem:"Prompt (including system)",systemUnknown:"System and tool usage unknown",systemApprox:"System and tools approximately {{count}} tokens",ariaKnown:"Context {{percentage}}% used, {{system}}, {{inputLabel}} {{input}} tokens, output and reasoning {{output}} tokens, remaining {{remaining}} tokens",ariaUnknown:"{{model}}, context window unknown, {{count}} cumulative session tokens used",composition:"Context composition",percentageUsed:"{{percentage}}% used",gridAria:"100-cell context composition chart. Each cell represents one percent of the context window.",estimated:"Estimated",unknown:"Unknown",summaryPercentage:"{{used}} used, {{remaining}} remaining",summaryTokens:"{{used}} used, {{remaining}} remaining, {{total}} total",overflow:"Context exceeded by {{count}} tokens",title:"Context usage",unknownModel:"The context window for this model is not available",unknownRuntime:"The current runtime did not provide model information"},Qce={title:"Add AgentKit agent",noAgents:"Connected successfully, but no agents were found at this address (/list-apps was empty).",connectionFailed:"Connection failed: {{error}}. Check the URL, API key, and whether the gateway allows cross-origin requests.",description:"Enter the URL and API key of an AgentKit deployment to connect through the ADK protocol. Connected agents will appear in the selector in the upper-left corner.",url:"Endpoint URL",apiKeyHint:"Connect using Authorization: Bearer",displayName:"Display name (optional)",displayNameHint:"Uses the URL hostname by default",cancel:"Cancel",connecting:"Connecting…",connect:"Connect and add"},zce={placeholder:"Type a message…",inputAria:"Message",generating:"Generating",send:"Send"},Vce={ariaLabel:"Invocation context for this turn",removeSkill:"Remove skill {{name}}",removeAgent:"Remove agent {{name}}"},Hce={cardAria:"{{label}} chart",viewAria:"{{label}} display mode",preview:"Preview",code:"Code",invalidEcharts:"The ECharts configuration is not a valid, safe data object. Switch to Code to inspect it.",renderFailed:"The chart cannot be rendered right now. Switch to Code to inspect it.",echartsAria:"ECharts preview",rendering:"Rendering chart…",mermaidFailed:"The chart cannot be rendered right now. Switch to Code to inspect the Mermaid source.",mermaidAria:"Mermaid preview"},qce={playVideo:"Play video: {{name}}",enlargeImage:"Enlarge image preview: {{name}}",image:"image",enlargeVideo:"Enlarge video",videoPreview:"Video preview",downloadVideo:"Download video",close:"Close"},Wce={annotation:Dce,media:Mce,runtimeLogs:Lce,trace:$ce,share:Fce,blocks:Bce,tokenUsage:Uce,addAgentKit:Qce,composer:zce,invocation:Vce,visualization:Hce,markdown:qce},x7e=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:Qce,annotation:Dce,blocks:Bce,composer:zce,default:Wce,invocation:Vce,markdown:qce,media:Mce,runtimeLogs:Lce,share:Fce,tokenUsage:Uce,trace:$ce,visualization:Hce},Symbol.toStringTag,{value:"Module"})),Kce={back:"Back",cancel:"Cancel",deploy:"Deploy",delete:"Delete",loading:"Loading…",next:"Next",notSupported:"Not supported",previous:"Previous",required:"Required",retry:"Retry",actions:"Actions",value:"Value",disabled:"Off",enabled:"Enabled",none:"None",close:"Close",name:"Name",description:"Description",send:"Send"},Gce={heading:"VeADK agent structure configuration",importHint:"Reload this file from Import YAML on the Create Agent page."},Xce={agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name.",characters:"Start with a letter or underscore and use only letters, numbers, and underscores"},runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}},Yce={description:"A VeADK-powered assistant that understands user intent and uses the right tools to complete tasks.",instruction:`You are a professional and reliable assistant. Your goal is to understand the user's request accurately and provide clear, concise, and useful answers. @@ -32,7 +32,7 @@ Original error: {{message}}`,unavailable:"Connection unavailable",requestFailed: 原始响应: {{response}}`,errorWithRawResponse:`{{context}} 原始响应: -{{response}}`,loadArkApiKeysFailed:"加载 Ark API Key 失败",loadModelsFailed:"加载模型列表失败",runtimeAccessDenied:"当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。",privateRuntimeUnavailable:"Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",runtimeTemporarilyUnavailable:"Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",runtimeConnectionUnsupported:"该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",runtimeConnectionDenied:"Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。",listAgentsFailed:"读取 Agent 列表失败",invalidListAppsJson:"Runtime /list-apps 返回了无法解析的 JSON 响应。",invalidListAppsFormat:"Runtime /list-apps 返回格式无效,应为非空字符串数组。",createSessionFailedWithStatus:"创建会话失败 ({{status}})",createSessionFailed:"创建会话失败",getSessionFailed:"读取会话失败",getSessionFailedWithDetail:"读取会话失败:{{status}}:{{detail}}",feedbackRuntimeOnly:"只有连接到 AgentKit Runtime 的会话支持反馈回流",feedbackRegionMissing:"Runtime 缺少地域信息,无法提交反馈",submitFeedbackFailed:"提交反馈失败",loadEvaluationSetsFailed:"读取评测集失败",loadAutoEvaluationStatusFailed:"读取自动评测状态失败",loadOptimizationsFailed:"读取优化项失败",deleteEvaluationCaseFailed:"删除评测案例失败",downloadFileFailed:"下载文件失败",fileUnavailable:"文件内容不可用",uploadFileFailed:"文件上传失败",traceDisabled:"该 Agent 暂未开启链路观测,请到控制台打开后使用。",loadTraceFailed:"加载调用链路失败",contentTypeMissing:"Content-Type 缺失",traceNonJson:"加载调用链路失败:服务端返回了非 JSON 响应({{contentType}}),请检查 Studio API 代理配置",invalidTraceFormat:"加载调用链路失败:返回格式无效",submitIssueFeedbackFailed:"问题反馈上报失败",issueFeedbackNotConfirmed:"问题反馈上报失败:服务端未确认提交结果",noPreviewableAgent:"该 Runtime 未提供可预览的 Agent。",agentSearchFailed:"Agent 检索失败",emptySseBody:"HTTP 200,SSE 响应体为空。",noDisplayableSseReply:"HTTP 200,SSE 响应中没有可展示的模型回复。",firstSseEventTimeout:"60 秒内未收到首个 SSE 事件。请稍后重试,或查看 Runtime、模型、网关日志定位原因。",runSessionFailed:"运行会话失败",runSseFailedWithDetail:"运行会话失败:{{status}}:{{detail}}",checkRuntimeNameFailed:"检查 Runtime 名称失败",invalidRuntimeNameCheck:"检查 Runtime 名称失败:服务返回格式错误",loadCloudResourcesFailed:"加载云资源失败",invalidCloudResources:"云资源列表响应格式无效",invalidEnvironmentMount:"挂载环境响应格式无效",environmentMountMismatch:"挂载环境响应与请求不一致",environmentMountNetworkFailed:"无法连接 Studio 服务,环境挂载未完成。请检查网络后重试。",environmentMountFailed:"挂载环境失败",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",clipboardWriteFailed:"无法写入剪贴板,请检查剪贴板权限。",loadSystemInfoFailed:"加载系统信息失败",invalidSystemInfo:"系统信息响应格式无效",invalidEnvironmentBuild:"环境构建响应格式无效",invalidEnvironmentBuildStep:"环境构建步骤响应格式无效",invalidEnvironmentManifest:"环境 Manifest 响应格式无效",invalidImageRepository:"环境镜像仓库响应格式无效",invalidCodeRepository:"环境代码仓库响应格式无效",invalidImageSource:"环境镜像来源响应格式无效",invalidEnvironment:"环境响应格式无效",invalidWorkspace:"工作区响应格式无效",loadWorkspacesFailed:"加载工作区失败",invalidWorkspaceList:"工作区列表响应格式无效",saveWorkspaceFailed:"保存工作区失败",deleteWorkspaceFailed:"删除工作区失败",loadEnvironmentsFailed:"加载环境失败",invalidEnvironmentList:"环境列表响应格式无效",probeRepositoryFailed:"探查代码仓库失败",invalidRepositoryProbe:"代码仓库探查响应格式无效",exportEnvironmentCodeFailed:"导出环境分享码失败",invalidEnvironmentCode:"环境分享码响应格式无效",inspectEnvironmentCodeFailed:"检测环境分享码失败",invalidEnvironmentCodeInspection:"环境分享码检测响应格式无效",importEnvironmentCodeFailed:"导入环境分享码失败",invalidEnvironmentCodeImport:"环境分享码导入响应格式无效",studioUnavailable:"无法连接 Studio 服务,请确认后端已启动后重试。",saveEnvironmentFailed:"保存环境失败",deleteEnvironmentFailed:"删除环境失败",startEnvironmentBuildFailed:"启动环境构建失败",loadEnvironmentBuildFailed:"读取环境构建详情失败",loadEnvironmentManifestFailed:"读取环境 Manifest 失败",invalidEnvironmentResource:"环境资源响应格式无效",loadEnvironmentResourcesFailed:"加载环境构建资源失败",updateCodexSandboxFailed:"更新 Codex Sandbox 失败",invalidCodexSandboxUpdate:"Codex Sandbox 更新响应格式无效",loadUserPoolsFailed:"加载用户池失败",invalidUserPoolList:"用户池列表响应格式无效",syncGithubFailed:"同步 GitHub 代码失败 ({{status}})",validatingMigrationArtifact:"正在校验迁移产物",uploadingCodePackage:"正在上传代码包",migrationArtifactValidated:"迁移产物校验完成",codePackageUploaded:"代码包上传完成",deploymentProgress:{preparing:"正在准备部署",uploading:"正在上传代码包",building:"正在构建镜像",buildLogsSyncing:"正在构建镜像,构建日志已同步。",buildLogsComplete:"构建日志同步完成。",buildFailedLogsSynced:"镜像构建失败,最终构建日志已同步。",buildLogsUnavailable:"暂时无法读取构建日志。",finalBuildLogsUnavailable:"暂时无法读取最终构建日志。",deploying:"正在部署服务",publishing:"正在发布服务",evaluating:"正在创建评测集",updating:"正在更新 Runtime 配置",completing:"正在完成部署",github:"正在配置 GitHub 持续交付",inProgress:"正在部署"},deploymentFailed:"部署失败",deploymentDisconnected:"部署失败:连接中断",deploymentMissingAgentName:"部署失败:返回缺少 Agent 名称",deploymentMissingConnection:"部署失败:返回缺少 AgentKit 连接信息",cancelDeploymentFailed:"取消部署失败 ({{status}})",loadFailed:"加载失败 ({{status}})",loadPermissionsFailed:"加载权限失败 ({{status}})",invalidPermissionResponse:"权限服务返回了无法解析的响应",checkStudioUpdateFailed:"检查 Studio 更新失败 ({{status}})",studioUpdatePreflightFailed:"Studio 更新权限预检失败 ({{status}})",submitStudioUpdateFailed:"提交 Studio 更新失败 ({{status}})",loadAgentUsageFailed:"加载 Agent 用量失败",notProvided:"未提供",agentUsageNonJson:"加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP {{status}},Content-Type: {{contentType}})。",checkStudioGateway:"请确认当前服务以 Studio 模式启动,并检查代理或网关配置。",agentUsageInvalidJson:"加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP {{status}},Content-Type: {{contentType}})。",retryCheckGateway:"请稍后重试;若问题持续,请检查代理或网关配置。",loadCronJobsFailed:"加载定时任务失败",loadCronJobFailed:"加载定时任务详情失败",createCronJobFailed:"创建定时任务失败",updateCronJobFailed:"更新定时任务失败",enableCronJobFailed:"启用定时任务失败",pauseCronJobFailed:"暂停定时任务失败",runCronJobFailed:"立即执行定时任务失败",loadCronHistoryFailed:"加载执行历史失败",stopCronRunFailed:"终止执行失败",deleteCronJobFailed:"删除定时任务失败",loadRuntimeFailed:"加载 Runtime 失败",loadLocalToolsFailed:"读取本地工具失败",connectDynamicRouteFailed:"连接 Studio 动态路由失败",a2aProbeDenied:"Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。",loadA2aCardFailed:"读取 A2A Agent Card 失败",loadRuntimeApiKeyFailed:"读取 Runtime API Key 失败",runtimeApiKeyMissing:"Runtime 未返回可用的 API Key",loadMcpCredentialsFailed:"读取 MCP 认证信息失败",invalidMcpCredentials:"Studio 返回的 MCP 认证信息格式无效",deleteFailed:"删除失败 ({{status}})",runtimeManageForbidden:"当前账号没有管理该 Runtime 的权限。",runtimeNotFound:"该 Runtime 不存在或已被删除。",runtimeUnavailable:"当前账号无法访问该 Runtime。",checkRuntimeUpdateFailed:"检查 Runtime 更新能力失败(HTTP {{status}}),请稍后重试。",loadRuntimeDetailFailed:"加载 Runtime 详情失败",generateProjectFailed:"生成项目失败",generateAgentConfigFailed:"生成 Agent 配置失败",createDebugRunFailed:"创建调试运行失败",createDebugSessionFailed:"创建调试会话失败",loadDebugTraceFailed:"加载调试调用链路失败",invalidDebugTrace:"加载调试调用链路失败:返回格式无效",debugRunFailed:"调试运行失败",cleanupDebugRunFailed:"清理调试运行失败"},fme={loadFailed:"读取会话模式能力失败(HTTP {{status}})",invalidResponse:"会话模式能力响应格式错误"},hme={nonJson:"{{fallback}}:服务端返回非 JSON 响应(HTTP {{status}},{{contentType}}){{detail}}"},pme={busy:"工作区正在处理较多请求,请稍后重试",notFound:"工作区不存在",duplicates:"检测到多个个人工作区会话,请联系管理员处理",timeout:"工作区恢复超时,项目仍保留,请重试",unavailable:"工作区暂时无法恢复,原项目仍保留,请重试",persistence:"当前 Sandbox 未启用持久化快照,请检查工作区配置",startup:"个人工作区启动失败,请检查 Sandbox 状态",exists:"项目名称已存在,请从项目列表打开",directory:"项目目录不存在",configuration:"请先配置工作区 Sandbox 镜像",state:"暂时无法确认工作区状态,请重试",list:"恢复工作区或读取项目列表失败,请重试",create:"项目初始化失败,请确认镜像可用后重试",open:"恢复工作区或打开项目失败,请重试",connection:"工作区暂时无法连接,请重试",invalidWorkspaceUrl:"工作区返回了无效的访问地址",operation:"项目操作失败,请重试",invalidProjectUrl:"项目访问地址无效",listFallback:"读取项目列表失败",connectionState:"暂时无法连接工作区,请重试"},mme={reporting:"正在补齐交付信息",packaging:"正在整理产物",savingVersion:"正在保存版本",finishing:"正在完成请求",submitResult:"提交构建结果",requestFailed:"任务请求失败,请重试。",invalidResponse:"任务状态响应无效。",eventGap:"正在补齐任务输出。",reconnecting:"连接暂时中断,正在重连。已有输出已保留。",input:{pending:"等待送达",sending:"正在确认送达",delivered:"已送达",withdrawn:"已停止发送"},plan:"执行计划",diff:"文件变更",preparing:"正在准备任务",preparingEnvironment:"正在准备开发环境…",connectingEnvironment:"正在连接开发环境…",processing:"正在处理请求",thinking:"正在思考",read:"读取文件 · {{target}}",listFiles:"查看目录 · {{target}}",search:"搜索 · {{target}}",command:"执行命令 · {{target}}",editFiles:"修改文件 · {{target}}",webSearch:"搜索网页 · {{target}}",processSummary:"已处理 {{count}} 项",duration:"{{seconds}} 秒",durationUnits:{milliseconds:"{{value}} 毫秒",hours:"{{value}} 小时",minutes:"{{value}} 分",seconds:"{{value}} 秒"},failedTools:"{{count}} 项执行失败",toolFailed:"执行失败",toolCalls:"{{count}} 次工具调用",turnDuration:"本轮耗时 {{duration}}",toolDuration:"工具累计耗时 {{duration}}",toolDurationPartial:"已记录工具耗时 {{duration}}",toolDurationHelp:"各工具执行耗时之和;并行调用可能使累计耗时超过本轮耗时。",turnStatus:{completed:"已完成",failed:"未完成",interrupted:"已中断",cancelled:"已中断",unavailable:"任务已结束"},notReported:"未上报",partial:"已记录",partialHelp:"本轮记录可能不完整。",tokenDetails:"本轮 Token 用量",model:"本轮模型",totalTokens:"总量",inputTokens:"输入",cachedInputTokens:"缓存命中输入",uncachedInputTokens:"未命中输入",cacheWriteInputTokens:"缓存写入",outputTokens:"输出",reasoningOutputTokens:"推理输出",cacheHitRate:"输入缓存命中率",tokenHelp:"缓存命中属于输入,推理输出属于输出,不重复计入总量。未命中输入 = 输入 − 缓存命中。"},g9={common:qpe,agentkitCli:Wpe,cloudRegion:Kpe,connections:Gpe,feishuBot:Xpe,requestError:Ype,runSse:Zpe,runtimeLogs:Jpe,search:eme,skills:tme,sse:nme,identity:ime,github:rme,video:sme,websiteIntegration:ome,knowledge:ame,intelligentDevelopment:lme,migrations:cme,sandbox:ume,client:dme,newChatCapabilities:fme,jsonResponse:hme,workspaceProjects:pme,developmentRuns:mme},q7e=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:Wpe,client:dme,cloudRegion:Kpe,common:qpe,connections:Gpe,default:g9,developmentRuns:mme,feishuBot:Xpe,github:rme,identity:ime,intelligentDevelopment:lme,jsonResponse:hme,knowledge:ame,migrations:cme,newChatCapabilities:fme,requestError:Ype,runSse:Zpe,runtimeLogs:Jpe,sandbox:ume,search:eme,skills:tme,sse:nme,video:sme,websiteIntegration:ome,workspaceProjects:pme},Symbol.toStringTag,{value:"Module"})),gme="智能体审核",bme="申请企业内全员使用,审批后生效",yme="关闭",vme="刷新",xme="状态",wme="申请人",Ome="申请时间",kme="当前版本",Sme="模型",Eme="退回人",Cme="通过人",Tme="审批时间",Ame="智能体描述",_me="申请说明",jme="退回理由",Nme="审批意见",Rme="退回理由(必填)",Ime="提交后内容已变化,请退回并重新申请",Pme="撤回后可以修改 Agent,需要公开时重新申请",Dme="取消公开后其他用户将无法继续使用,确定取消公开吗?",Mme="取消",Lme="确认",$me="正在保存",Fme="取消公开",Bme="撤回申请",Ume="通过",Qme="直接公开",zme="申请公开",Vme="全员可见",Hme={pending:"待审核",approved:"已通过",returned:"已退回",withdrawn:"已撤回"},qme="搜索智能体或申请人",Wme="地域",Kme="全部状态",Gme="智能体",Xme="操作",Yme="查看并审批",Zme="申请详情",Jme="没有符合条件的申请",ege="暂无智能体审核申请",tge="{{count}} / {{limit}} 字",W7e={title:gme,dialogDescription:bme,close:yme,refresh:vme,statusTitle:xme,submitter:wme,submittedAt:Ome,version:kme,model:Sme,returnedBy:Eme,approvedBy:Cme,reviewedAt:Tme,description:Ame,message:_me,reason:jme,comment:Nme,reasonRequired:Rme,contentChanged:Ime,withdrawConfirm:Pme,unpublishConfirm:Dme,cancel:Mme,confirm:Lme,saving:$me,unpublish:Fme,withdraw:Bme,return:"退回",approve:Ume,publish:Qme,submit:zme,private:"仅自己可见",enterprise:Vme,status:Hme,search:qme,region:Wme,all:Kme,agent:Gme,actions:Xme,review:Yme,details:Zme,noMatches:Jme,empty:ege,textCount:tge},K7e=Object.freeze(Object.defineProperty({__proto__:null,actions:Xme,agent:Gme,all:Kme,approve:Ume,approvedBy:Cme,cancel:Mme,close:yme,comment:Nme,confirm:Lme,contentChanged:Ime,default:W7e,description:Ame,details:Zme,dialogDescription:bme,empty:ege,enterprise:Vme,message:_me,model:Sme,noMatches:Jme,publish:Qme,reason:jme,reasonRequired:Rme,refresh:vme,region:Wme,returnedBy:Eme,review:Yme,reviewedAt:Tme,saving:$me,search:qme,status:Hme,statusTitle:xme,submit:zme,submittedAt:Ome,submitter:wme,textCount:tge,title:gme,unpublish:Fme,unpublishConfirm:Dme,version:kme,withdraw:Bme,withdrawConfirm:Pme},Symbol.toStringTag,{value:"Module"})),nge={backToEvaluationCase:"返回评测案例",cancel:"取消",copied:"已复制",copy:"复制",exportConversation:"导出会话",retry:"重试"},ige={title:"您想以哪种方式添加 Agent 来运行?",subtitle:"选择最适合你的方式,下一步即可开始",quickCreate:{title:"从 0 快速创建",description:"用智能、自定义、模板或工作流的方式从零创建一个 Agent。"},intelligent:{title:"智能模式",description:"描述目标,按你的意图构建、调试并验证 Agent。"},package:{title:"从代码包添加和部署",description:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。"},migrate:{title:"从存量迁移",description:"从您的 LangChain、Dify 等存量项目迁移至 AgentKit Runtime。"}},rge={subject:{file:"文件修改",command:"命令执行"},decision:{accept:"已允许本次{{subject}}",acceptForSession:"已在本会话中允许{{subject}}",decline:"已拒绝{{subject}}",cancel:"已取消{{subject}}审批"},details:{command:"命令",grantRoot:"授权路径",cwd:"执行目录"}},sge={noDescription:"暂无描述",region:"地域",unknownAgent:"未知 Agent"},oge={agentTransfer:"智能体移交",annotationHint:"模型回复;选中文字后可添加批注",continueBranch:"继续“{{branch}}”这个方向",emptyResponse:"本次没有返回可显示的内容。",subagentDescription:"正在执行主 Agent 移交的任务。"},age={title:"需要配置 {{provider}} AK/SK",prefix:"智能体工作台需要 {{provider}} 凭据才能使用。请在运行环境中设置",and:"与",suffix:"后重试。"},lge={buildRunning:{title:"当前构建仍在进行",description:"离开将停止本轮构建;当前会话仍会保留,可稍后从历史会话重新进入。",confirm:"停止并离开"},deleteThread:{title:"删除 Codex 历史会话",description:"将删除“{{name}}”,并从历史会话中移除。",confirm:"确认删除"},returnToCreate:{title:"返回创建首页?",description:"返回后当前填写的内容将会丢失,确定要返回吗?",confirm:"确定返回"}},cge={additionalAgentDeleteFailures:";另有 {{count}} 个失败",agentDeleteFailures:"{{count}} 个 Agent 删除失败:{{failures}}{{suffix}}",agentToolsMissing:"当前 Agent 缺少任务工具:{{tools}}",buildStopUnconfirmed:"已离开开发环境,但未能确认本轮构建已停止。任务可能仍在运行,请稍后从历史会话检查状态。",builtinAgentSendFailed:"内置智能体发送失败:{{message}}",bytePlusEvaluationUnsupported:"BytePlus 暂不支持 AgentKit 评测集",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",cloudCodexEmptyReply:"云端 Codex 已结束,但没有生成回复,请重新发送任务。",cloudCodexSessionMissing:"云端 Codex Session 暂未出现在列表中,请稍后重试。",deploymentRuntimeIdMissing:"部署完成,但未返回 Runtime ID。",environmentExpired:"所选环境已失效,请刷新后重新选择。",environmentsLoadFailed:"读取环境失败",evaluationCaseSessionMissing:"这条案例缺少会话定位信息,无法跳转。",evaluationUnsupportedForReply:"当前回复暂不支持加入评测集",firstFrameRequired:"首尾帧生成需要先添加首帧图片。",incompletePromptOptimization:"提示词优化结果不完整,请重新优化后再试。",intelligentCapabilityCheckFailed:"智能开发能力检查失败(HTTP {{status}})",intelligentSessionCreateFailed:"智能开发会话创建失败",invalidIntelligentCapability:"智能开发模型能力格式错误。",localBffToolsNotConfigured:"本地 Studio BFF 没有配置工具。",localToolsLoadFailed:"读取本地工具失败",loginPopupBlocked:"登录窗口被浏览器拦截,请允许弹出窗口后重试。",loginPopupClosed:"登录窗口已关闭,请重新登录以继续当前操作。",mediaTooLarge:"{{fileName}} 超出当前平台允许的素材大小。",mountEnvironmentFailed:"挂载环境失败",noConnectedSandbox:"当前没有已连接的 Sandbox。",noCreateAgentPermission:"当前账号没有添加 Agent 的权限。",noManageAgentPermission:"当前账号没有管理 Agent 的权限。",noOptimizationBaseline:"当前版本没有可对比的优化前版本。",oauthUrlMissing:"事件中没有授权地址。",onlyCloudAgentUpdatable:"仅支持更新已部署的云端智能体。",optimizationVersionMissing:"无法找到本次优化对应的项目版本,可能已被删除。",persistentStorageNotConfigured:"管理员未配置持久化存储",readDraftFailed:"无法读取本机草稿,请稍后重试。",runtimeAgentNameMissing:"Runtime 缺少智能体名称,无法更新。",runtimeBffToolsDisabled:"当前 Runtime Agent 未开启 BFF 工具能力。",runtimeDeploymentConfigUnavailable:"该 Runtime 的原发布配置不可恢复,无法安全更新。",runtimeMissingForConnection:"缺少 Runtime 信息,无法连接智能体。",runtimeRegionMissingForDelete:"Runtime 缺少地域信息,无法删除",runtimeRegionMissingForUpdate:"Runtime 缺少地域信息,无法更新。",runtimeUpdateUnsupported:"当前 Runtime 不支持原地更新。",sandboxRuntimeUnavailable:"当前 Agent 没有可用的 Sandbox Runtime。",sandboxToolsUnavailable:"当前 Studio BFF 未提供 Sandbox 执行工具。",saveDraftLocationRejected:"浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。",saveDraftRejected:"浏览器拒绝保存草稿,请稍后重试。",selectSkillToOptimize:"请先选择需要优化的 Skill。",sessionMissingForMount:"当前会话不存在,无法挂载环境。",sessionNotReady:"会话尚未就绪。",sessionUnavailable:"当前会话不可用,请关闭后重试。",sourceNotReady:"该源码尚未准备好,请返回对话继续处理。",textVideoRejectsReferences:"文生视频不使用参考素材,请先移除已添加的图片或视频。",videoEditRequiresVideo:"视频编辑需要先添加待编辑视频。",videoExtendRequiresVideo:"视频续写需要先添加基础视频。",videoGenerationFailed:"视频生成失败,请稍后重试。",videoModeUnsupported:"当前平台暂不支持所选视频任务模式。",videoPreviewMissing:"视频任务已完成,但服务端未返回预览地址。",videoReferenceRequired:"参考素材生视频需要至少添加一项参考图片或参考视频。"},uge={like:"赞",removeLike:"取消点赞",dislike:"踩",removeDislike:"取消点踩",reportIssue:"问题反馈",traceFlameGraph:"Tracing 火焰图"},dge={0:"今天想做点什么?",1:"有什么可以帮你的?",2:"需要我帮你查点什么吗?",3:"有问题尽管问我",4:"嗨,我们开始吧",5:"开始一段新对话吧",6:"今天想先解决哪件事?",7:"把你的想法告诉我吧",8:"我们从哪里开始?",9:"有什么任务交给我?",10:"准备好一起推进了吗?",11:"说说你现在最关心的问题",12:"今天也一起把事情做好",13:"我在,随时可以开始",intelligentDevelopment:"让灵感自由生长"},fge={agentCapabilities:"正在检查 Agent 能力…",session:"加载会话…"},hge={cancelled:"授权已取消。",pasteCallbackUrl:"授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:",popupBlocked:"弹窗被拦截,请允许弹窗后重试。",unsupportedUrl:"授权链接不是 http/https 地址,已阻止打开。"},pge={volcengine:"火山引擎"},mge={checkingPersistence:"正在检查持久化能力…",exitDevelopment:"退出开发环境",fileUploaded:"已上传文件到 Sandbox",filesUploaded:"已上传 {{count}} 个文件到 Sandbox",intelligentDevelopment:"智能开发",mode:{readOnly:"只读",workspaceWrite:"工作区写入",fullAccess:"完全访问"},approvalPolicy:{untrusted:"仅不可信命令",onRequest:"按需审批",never:"不审批"},reviewer:{user:"由我审批",autoReview:"自动审查"},labels:{approvalPolicy:"审批策略",file:"文件",fileNumber:"文件 {{number}}",mode:"沙箱模式",networkAccess:"网络访问",reviewer:"审批方式",workingDirectory:"工作目录"},network:{allowed:"允许",disabled:"关闭"},permissionsUpdated:"已更新当前 Sandbox Session 的 Codex 权限",persistenceUnknown:"暂时无法确认持久化能力",stoppedReady:"已停止,可继续输入",uploadedFilesPrompt:"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",workspaceUpdated:"已更新工作空间"},gge={addAgent:"添加智能体",addFromPackage:"从代码包添加",agent:"智能体",automations:"自动化",createAgent:"创建智能体",createSkill:"创建技能",cronJobs:"定时任务",issueFeedback:"问题反馈",library:"资源库",migrateAgent:"迁移智能体",newConversation:"新会话",optimizeSkill:"优化 {{name}}",search:"搜索",skill:"技能",skillLibrary:"技能库",systemInfo:"系统信息",updateAgent:"更新 {{name}}",codeProjects:"代码项目",reviewCenter:"审核中心"},bge={title:"从工作区新建",description:"创建和管理代码项目,在 VS Code 中编写和调试"},yge={actions:nge,addAgent:ige,approval:rge,common:sge,conversation:oge,credentials:age,dialogs:lge,errors:cge,feedback:uge,greetings:dge,loading:fge,oauth:hge,providers:pge,sandbox:mge,titles:gge,workspaceProjectEntry:bge},G7e=Object.freeze(Object.defineProperty({__proto__:null,actions:nge,addAgent:ige,approval:rge,common:sge,conversation:oge,credentials:age,default:yge,dialogs:lge,errors:cge,feedback:uge,greetings:dge,loading:fge,oauth:hge,providers:pge,sandbox:mge,titles:gge,workspaceProjectEntry:bge},Symbol.toStringTag,{value:"Module"})),vge="自动化",xge="连接研发工具,为智能体扩展自动化工作流",wge="搜索自动化",Oge="自动化分类",kge={development:"研发",channels:"消息渠道"},Sge="{{category}}自动化列表",Ege="打开{{name}}",Cge="仅本地部署可用",Tge="没有匹配的自动化",Age="请尝试搜索其他名称",_ge="返回自动化列表",jge={"coding-agents":{name:"配置 Coding Agents",badge:"本地",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},template:{name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},delivery:{name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},review:{name:"GitHub PR 自动评审",description:"通过 GitHub App 在隔离 Sandbox 中评审 Pull Request。",title:"GitHub PR 自动评审",subtitle:"通过 GitHub App 触发 Sandbox 评审,并将结果发布到 Pull Request",panel:"请先将 GitHub App 安装到目标仓库,再为每个仓库启用自动评审。",submitLabel:"安装 GitHub App",regionHelp:"",pullRequest:{title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},sandboxToolId:{label:"沙箱工具 ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv"},modelName:{label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称"},modelBaseUrl:{label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址"}}},"gitlab-review":{name:"GitLab MR 自动评审",description:"通过 GitLab 集成在隔离 Sandbox 中评审 Merge Request。"},feishu:{name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},"website-integration":{name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"}},Nge={required:"必填",optional:"可选",region:"地域",tokenLabel:"GitHub Token",getToken:"获取 Token",createToken:"创建 GitHub Token",tokenPlaceholder:"需要仓库 Contents 与 Pull requests 写权限",tokenWorkflowPlaceholder:"需要 Contents、Pull requests、Workflows 写权限",hideToken:"隐藏 Token",showToken:"显示 Token",tokenHelp:"Token 仅用于本次提交,不会保存在浏览器或写入 PR",tokenWorkflowHelp:"此处 Token 用于创建配置 PR;它不是 Sandbox 的通用必填项,且不会保存在浏览器或写入 PR",prCreated:"PR #{{number}} 已创建",configPrCreated:"配置 PR #{{number}} 已创建",configPrNextStep:"合并后,后续同仓库 PR 会自动触发评审。",viewOnGitHub:"在 GitHub 查看",viewConfigPr:"查看配置 PR",secretsHeading:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:",secretsConfigHeading:"合并配置 PR 前,请在目标仓库添加运行时密钥",openSecrets:"打开 Secrets 设置",secretsPath:"路径:Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"将为 {{repository}} 添加 PR 自动评审配置",repositoryReviewHelp:"将使用 GitHub App 校验 {{repository}} 的 Pull Request",secretPair:"{{accessKey}}、{{secretKey}}(必填)",sessionToken:"{{sessionToken}}(使用临时凭据时必填)",requiredSecret:"{{name}}(必填)",temporaryCredentialRequired:"(使用临时凭据时必填)",requiredSuffix:"(必填)",submitting:"提交 PR 中…",validation:{required:"此项不能为空",repository:"请输入 owner/repository 或完整 GitHub 仓库 URL",baseBranch:"目标分支格式不正确",projectPath:"请输入仓库内的相对目录",runtimeId:"运行时 ID 格式不正确",sandboxToolId:"沙箱工具 ID 格式不正确",modelName:"模型名称格式不正确",modelBaseUrlSafe:"请输入不含凭据、查询参数或锚点的 HTTPS 地址",modelBaseUrl:"请输入有效的 HTTPS 地址",runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}}},Rge={title:"配置 Coding Agents",description:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。",retry:"重试",clients:{ariaLabel:"选择 Coding Agent",title:"本机客户端",detectAgain:"重新检测",detecting:"正在检测本机客户端…",detected:"已检测到客户端",available:"可用",unavailable:"未检测到"},skills:{ariaLabel:"选择内置 Skill",title:"内置 Skills",viewFiles:"查看文件",items:{"veadk-agent-development":{name:"VeADK Agent 开发",description:"使用 VeADK 开发和完善 Agent。"},"agentkit-cli":{name:"AgentKit CLI",description:"通过 AgentKit CLI 管理和部署 AgentKit 资源。"}}},global:{ariaLabel:"全局安装目录",title:"全局安装",description:"配置后可在本机其他项目中使用",empty:"选择客户端后显示对应安装目录。"},success:"已为 {{agentCount}} 个客户端配置 {{skillCount}} 个 Skill",selection:"已选择 {{agentCount}} 个客户端、{{skillCount}} 个 Skill",selectClient:"请先选择客户端",configuring:"正在配置…",configure:"配置",errors:{detect:"检测本机客户端失败",configure:"配置失败,请检查用户目录权限后重试"},preview:{description:"只读浏览随 Studio 提供的 Skill 文件",close:"关闭文件预览",loading:"正在读取文件…",error:"读取 Skill 文件失败",skillFiles:"{{name}} 文件",files:"文件",fileContent:"文件内容",notPreviewable:"此文件不是可预览的 UTF-8 文本。",noFiles:"没有可预览的文件。"}},Ige={title:"飞书机器人",description:"创建一个由 AgentKit Runtime 驱动的飞书智能体",panel:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。",agentName:"智能体名称",agentNameHelp:"将作为新 Runtime 中的根智能体名称",region:"部署地域",regionHelp:"Runtime 与构建产物将创建在该地域",regions:{"cn-beijing":"北京","cn-shanghai":"上海"},appId:"飞书 App ID",appIdHelp:"来自飞书开放平台的应用凭证",appSecret:"飞书 App Secret",appSecretPlaceholder:"请输入 App Secret",appSecretHelp:"仅写入新 Runtime 的环境变量",hideSecret:"隐藏 App Secret",showSecret:"显示 App Secret",hide:"隐藏",show:"显示",confirmCancel:"取消部署将停止任务并清理已创建的 Runtime,确定继续吗?",status:{preparing:"正在生成 basic 智能体",running:"正在创建 Runtime",cancelling:"正在取消部署",succeeded:"飞书机器人 Runtime 已创建",cancelled:"部署已取消",failed:"创建失败"},steps:{prepare:"生成智能体",build:"构建镜像",deploy:"创建 Runtime",publish:"发布服务"},openConsole:"打开 Runtime 控制台",credentials:{title:"凭据处理",description:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"},cancelDeployment:"取消部署",creating:"正在创建…",create:"创建飞书机器人 Runtime",validation:{appId:"请输入飞书 App ID",appSecret:"请输入飞书 App Secret",agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}},generatedAgent:{description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。"}},Pge={title:vge,description:xge,search:wge,categoriesLabel:Oge,categories:kge,resultsLabel:Sge,open:Ege,localOnly:Cge,emptyTitle:Tge,emptyDescription:Age,backToAutomations:_ge,cards:jge,github:Nge,codingAgents:Rge,feishu:Ige},X7e=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:_ge,cards:jge,categories:kge,categoriesLabel:Oge,codingAgents:Rge,default:Pge,description:xge,emptyDescription:Age,emptyTitle:Tge,feishu:Ige,github:Nge,localOnly:Cge,open:Ege,resultsLabel:Sge,search:wge,title:vge},Symbol.toStringTag,{value:"Module"})),Dge={"zh-CN":"简体中文","en-US":"English"},Y7e={languageNames:Dge},Z7e=Object.freeze(Object.defineProperty({__proto__:null,default:Y7e,languageNames:Dge},Symbol.toStringTag,{value:"Module"})),Mge={selectedExcerptLabel:"选中片段",commentLabel:"批注",commentSeparator:":",successTitle:"已加入 Bad case 评测集",successDescription:"这条批注已关联当前问题和完整模型回复。",done:"完成",ariaLabel:"批注选中的模型回复",title:"添加批注",content:"批注内容",placeholder:"说明问题或期望的修改方式",retryError:"{{error}},请重试。",cancel:"取消",submit:"加入 Bad Case"},Lge={attachment:"附件",image:"图片",preview:"预览 {{name}}",uploading:"上传中",uploadFailed:"上传失败",remove:"移除 {{name}}",previewDialog:"{{name}}预览",download:"下载",close:"关闭",reading:"正在读取文档…",loadFailed:"文档加载失败:{{error}}"},$ge={errorTitle:"云端日志错误",copyError:"复制完整错误信息",retry:"重试",statuses:{live:"实时",connecting:"连接中",retrying:"重连中",idle:"未连接"},title:"实例日志",description:"当前对话请求所在的 VeFaaS 实例",close:"关闭实例日志",instanceId:"实例 ID",waitingInstance:"等待实例",request:"请求 {{id}}",ariaLabel:"VeFaaS 实例实时日志",notCapturedTitle:"尚未捕获到实例",notCapturedDescription:"发送一条消息后,这里会显示实际处理请求的实例和实时日志。",connectingTitle:"正在连接实例日志",connectingDescription:"正在通过 Studio BFF 建立安全日志流。",emptyTitle:"暂无日志",emptyDescription:"已连接实例,等待新的日志输出。",retention:"日志自动刷新,仅保留最近 {{count}} 行"},Fge={title:"调用链路观测",statuses:{loading:"加载中",ready:"",collecting:"采集中",disabled:"未开启",forbidden:"权限不足",error:"加载失败"},errors:{collecting:"调用链路仍在采集中,请稍候。",disabled:"该 Agent 未开启链路观测,请到控制台开启后重试。",forbidden:"当前账号无权读取 APMPlus 调用链路,请联系管理员补充只读权限。",error:"调用链路加载失败,请稍后重试。"},callCount:"{{count}} 个调用 · {{duration}} ms",close:"关闭",loading:"加载调用链路…",retryNow:"立即重试",reload:"重新加载",empty:"该会话暂无调用链路(可能尚未产生调用)。",attributes:"属性",selectCall:"选择左侧的一个调用查看详情"},Bge={exportNote:"上述会话由 AgentKit Studio 导出,仅供参考",imageFailed:"图片生成失败,请重试。",browserUnsupported:"浏览器无法生成会话图片,请重试。",copyUnsupported:"当前浏览器不支持复制图片,请下载后使用。",exportFailed:"导出失败,请重试。",title:"导出会话",description:"选择格式并下载截至当前回复的全部输入与输出。",close:"关闭",generatingContent:"正在生成导出内容…",retry:"重试生成",previewPage:"预览第 1 页,共 {{count}} 页",previewAlt:"会话导出内容第 1 页,共 {{count}} 页",format:"导出格式",generatingFormat:"正在生成 {{format}}…",copying:"正在复制…",copiedFirst:"已复制第一页",copied:"已复制",copyFirst:"复制第一页",copyImage:"复制图片",generating:"正在生成…",downloadArchive:"下载 PNG 压缩包({{count}} 页)",downloadFormat:"下载 {{format}}"},Uge={unsupportedComponent:"不支持的组件:{{component}}",sandboxIdentity:"Codex Sandbox 执行标识",useSkill:"使用 {{name}} 技能",thinkingDone:"已完成思考",thinking:"思考中",justNow:"刚刚",sourceUnavailable:"暂时无法读取生成的源码,请稍后重试。",downloadStarted:"已开始下载",verifiedDelivery:"已验证交付物",generatedSource:"生成的 Agent 源码",entryPoint:"入口",fileCount:"文件数",size:"大小",validationTime:"验证时间",generationTime:"生成时间",checksPassed:"{{count}} 项检查通过",sourceReady:"源码已准备好,可部署",sourceGuidance:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。",viewSource:"查看源码",preparing:"正在准备…",viewChanges:"查看本次变更",downloadSource:"下载源码",sourceNotReady:"源码尚未准备好",manualDeploy:"手动部署到 Runtime",deployAgent:"部署 Agent",beforeOptimization:"优化前",afterOptimization:"优化后",planStatuses:{pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"},renderUi:"渲染 UI",truncated:"…(已截断)",agentAdjusting:"Agent 正在调整",sandboxDetails:"Codex Sandbox 详细输出",waitingCodex:"正在等待 Codex 输出",arguments:"参数",result:"返回",artifacts:"产物",downloadNamed:"下载 {{name}}",powerpoint:"PowerPoint 演示文稿",preview:"预览",download:"下载",previewDialog:"{{name}} 预览",closePreview:"关闭预览",slidePreview:"{{name}} 幻灯片预览",mcpToolset:"MCP 工具集",authorized:"已授权 · {{tool}}",authorizationRequired:"{{tool}} 需要授权",oauthDescription:"工具集 {{tool}} 使用 OAuth 保护,需登录授权后方可调用。",oauthProvider:"将跳转至 {{provider}} 完成登录。",oauthContinue:"授权完成后对话自动继续。",waitingAuthorization:"等待授权…",authorize:"去授权",missingAuthorizationUrl:"未在事件中找到授权地址。",tools:{web_search:{running:"正在进行网络搜索",done:"已完成网络搜索"},link_reader:{running:"正在读取网页",done:"已完成网页读取"},run_code:{running:"正在 AgentKit 沙箱中执行代码",done:"已在 AgentKit 沙箱中完成代码执行"},list_envs:{running:"正在查看可用环境",done:"已读取可用环境"},get_env_manifest:{running:"正在读取环境 Manifest",done:"已读取环境 Manifest"},execute_in_sandbox:{running:"正在环境中执行命令",done:"已在环境中完成命令执行"},delegate_to_codex_sandbox:{running:"Codex Sandbox 正在执行",done:"Codex Sandbox 已完成",failed:"Codex Sandbox 执行失败"},image_generate:{running:"正在生成图片",done:"已完成图片生成"},video_generate:{running:"正在生成视频",done:"已完成视频生成"},ppt_generate:{running:"正在生成 PPT",done:"已完成 PPT 生成"},load_memory:{running:"正在检索长期记忆",done:"已完成记忆检索"},load_knowledgebase:{running:"正在检索知识库",done:"已完成知识库检索"},load_skill:{running:"正在加载技能",done:"已加载技能"},collect_resources:{running:"正在收集可用资源",done:"已完成资源收集",failed:"资源收集失败"},create_agents:{running:"正在创建并运行 Agent",done:"已完成 Agent 创建",failed:"Agent 创建失败"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit 技能中心",knowledge_base:"知识库",tool:"工具"},agentTypes:{llm:"LLM 智能体",sequential:"顺序智能体",parallel:"并行智能体",loop:"循环智能体",workflow:"工作流"},skill:"技能",subAgents:"子智能体",builtinTool:"内置工具",skillCenter:"AgentKit 技能中心",selfAuthoredTools:"自写工具",dependencies:"依赖:{{items}}",fullCode:"{{name}} 完整代码",itemCount:"{{label}} {{count}} 项",collectionAria:"召回资源信息",retrieving:"正在检索资源",retrievalFailed:"资源检索未完成",checkConfig:"请检查资源服务配置后重试。",notSearched:"未检索",notConfigured:"未配置",resourceList:"{{label}}资源列表",searchKeywords:"检索关键词",skillHubSkipped:"未提供检索关键词,本次未检索 Skill Hub。",sourceSkipped:"未配置 {{label}},本次未检索该来源。",noResources:"本次检索未返回该类别的资源。",resultAria:"创建 Agent 结果",creationFailed:"Agent 创建未完成",agentResources:"{{name}} 具备的资源",knowledgeBase:"知识库",toolsLabel:"工具",creating:"正在创建 Agent",noAgents:"没有可展示的 Agent",noAgentResult:"工具返回中未包含 Agent 配置或执行结果。",sourceLabels:{tool:"工具",knowledge:"AgentKit 知识库",skillCenter:"AgentKit 技能中心",unknown:"未知来源"},unnamedResource:"未命名资源",unnamedAgent:"未命名 Agent"},branchCompare:{ariaLabel:"分支对比",selectDirection:"选择方向",continue:"继续这个方向"},codexProgress:{planTitle:"Codex 执行计划",fallback:{fileChange:"修改文件",approval:"等待操作批准",status:"Codex 状态",command:"运行命令"},planSummary:"已完成 {{completed}}/{{total}} 项",command:{running:"正在执行命令",completed:"命令执行完成",failed:"命令执行失败"},projectFiles:"{{count}} 个项目文件",projectFile:"项目文件",fileChange:{running:"正在更新{{subject}}",completed:"已更新{{subject}}",failed:"更新{{subject}}失败"},externalTool:"外部工具",mcp:{running:"正在调用工具 {{tool}}",completed:"已调用工具 {{tool}}",failed:"工具 {{tool}} 调用未完成"},collaboration:{spawn_agent:{running:"正在启动子任务",completed:"子任务已启动",failed:"子任务启动失败"},send_input:{running:"正在向子任务发送信息",completed:"已向子任务发送信息",failed:"向子任务发送信息失败"},wait:{running:"正在等待子任务",completed:"子任务等待已结束",failed:"等待子任务失败"},close_agent:{running:"正在结束子任务",completed:"子任务已结束",failed:"子任务结束失败"},default:{running:"正在协调子任务",completed:"子任务协作已完成",failed:"子任务协作失败"}},webSearch:{running:"正在进行网络搜索",completed:"已完成网络搜索",failed:"网络搜索未完成"},errorDetail:"Codex 执行未完成。",errorTitle:"Codex 执行遇到错误"}},Qge={segments:{system:"系统与工具",input:"输入与历史",output:"输出与思考",remaining:"剩余"},modelUnavailable:"模型信息未提供",promptWithSystem:"提示词(含系统)",systemUnknown:"系统与工具占用未知",systemApprox:"系统与工具约 {{count}} Token",ariaKnown:"上下文已使用 {{percentage}}%,{{system}},{{inputLabel}} {{input}} Token,输出与思考 {{output}} Token,剩余 {{remaining}} Token",ariaUnknown:"{{model}},上下文窗口未知,会话累计使用 {{count}} Token",composition:"上下文构成",percentageUsed:"{{percentage}}% 已用",gridAria:"100 格上下文构成图,每格代表上下文窗口的百分之一",estimated:"估算",unknown:"未知",summaryPercentage:"{{used}} 已用,剩余 {{remaining}}",summaryTokens:"{{used}} 已用,剩余 {{remaining}},总计 {{total}}",overflow:"已超出上下文 {{count}} Token",title:"上下文用量",unknownModel:"暂未收录该模型的上下文窗口",unknownRuntime:"当前 Runtime 未提供模型信息"},zge={title:"添加 AgentKit 智能体",noAgents:"连接成功,但该地址未发现任何 Agent(/list-apps 为空)。",connectionFailed:"连接失败:{{error}}。请检查 URL、API Key,以及该网关是否允许跨域。",description:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。",url:"访问地址 URL",apiKeyHint:"以 Authorization: Bearer 方式连接",displayName:"显示名称(可选)",displayNameHint:"默认取 URL 的主机名",cancel:"取消",connecting:"连接中…",connect:"连接并添加"},Vge={placeholder:"输入消息…",inputAria:"输入消息",generating:"正在生成",send:"发送"},Hge={ariaLabel:"本轮调用上下文",removeSkill:"移除技能 {{name}}",removeAgent:"移除 Agent {{name}}"},qge={cardAria:"{{label}} 图表",viewAria:"{{label}} 显示方式",preview:"预览",code:"代码",invalidEcharts:"ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。",renderFailed:"图表暂时无法渲染,请切换到代码检查内容。",echartsAria:"ECharts 图表预览",rendering:"正在渲染图表…",mermaidFailed:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。",mermaidAria:"Mermaid 图表预览"},Wge={playVideo:"点击播放视频:{{name}}",enlargeImage:"放大预览:{{name}}",image:"图片",enlargeVideo:"点击放大视频",videoPreview:"视频预览",downloadVideo:"下载视频",close:"关闭"},Kge={annotation:Mge,media:Lge,runtimeLogs:$ge,trace:Fge,share:Bge,blocks:Uge,tokenUsage:Qge,addAgentKit:zge,composer:Vge,invocation:Hge,visualization:qge,markdown:Wge},J7e=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:zge,annotation:Mge,blocks:Uge,composer:Vge,default:Kge,invocation:Hge,markdown:Wge,media:Lge,runtimeLogs:$ge,share:Bge,tokenUsage:Qge,trace:Fge,visualization:qge},Symbol.toStringTag,{value:"Module"})),Gge={back:"返回",cancel:"取消",deploy:"部署",delete:"删除",loading:"读取中…",next:"下一步",notSupported:"暂不支持",previous:"上一步",required:"必填",retry:"重试",actions:"操作",value:"值",disabled:"关闭",enabled:"已开启",none:"无",close:"关闭",name:"名称",description:"描述",send:"发送"},Xge={heading:"VeADK Agent 结构配置",importHint:"可在「创建 Agent」页通过「导入 YAML」重新载入。"},Yge={agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"},runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}},Zge={description:"一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",instruction:`你是一个专业、可靠的智能助手。 +{{response}}`,loadArkApiKeysFailed:"加载 Ark API Key 失败",loadModelsFailed:"加载模型列表失败",runtimeAccessDenied:"当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。",privateRuntimeUnavailable:"Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",runtimeTemporarilyUnavailable:"Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",runtimeConnectionUnsupported:"该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",runtimeConnectionDenied:"Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。",listAgentsFailed:"读取 Agent 列表失败",invalidListAppsJson:"Runtime /list-apps 返回了无法解析的 JSON 响应。",invalidListAppsFormat:"Runtime /list-apps 返回格式无效,应为非空字符串数组。",createSessionFailedWithStatus:"创建会话失败 ({{status}})",createSessionFailed:"创建会话失败",getSessionFailed:"读取会话失败",getSessionFailedWithDetail:"读取会话失败:{{status}}:{{detail}}",feedbackRuntimeOnly:"只有连接到 AgentKit Runtime 的会话支持反馈回流",feedbackRegionMissing:"Runtime 缺少地域信息,无法提交反馈",submitFeedbackFailed:"提交反馈失败",loadEvaluationSetsFailed:"读取评测集失败",loadAutoEvaluationStatusFailed:"读取自动评测状态失败",loadOptimizationsFailed:"读取优化项失败",deleteEvaluationCaseFailed:"删除评测案例失败",downloadFileFailed:"下载文件失败",fileUnavailable:"文件内容不可用",uploadFileFailed:"文件上传失败",traceDisabled:"该 Agent 暂未开启链路观测,请到控制台打开后使用。",loadTraceFailed:"加载调用链路失败",contentTypeMissing:"Content-Type 缺失",traceNonJson:"加载调用链路失败:服务端返回了非 JSON 响应({{contentType}}),请检查 Studio API 代理配置",invalidTraceFormat:"加载调用链路失败:返回格式无效",submitIssueFeedbackFailed:"问题反馈上报失败",issueFeedbackNotConfirmed:"问题反馈上报失败:服务端未确认提交结果",noPreviewableAgent:"该 Runtime 未提供可预览的 Agent。",agentSearchFailed:"Agent 检索失败",emptySseBody:"HTTP 200,SSE 响应体为空。",noDisplayableSseReply:"HTTP 200,SSE 响应中没有可展示的模型回复。",firstSseEventTimeout:"60 秒内未收到首个 SSE 事件。请稍后重试,或查看 Runtime、模型、网关日志定位原因。",runSessionFailed:"运行会话失败",runSseFailedWithDetail:"运行会话失败:{{status}}:{{detail}}",checkRuntimeNameFailed:"检查 Runtime 名称失败",invalidRuntimeNameCheck:"检查 Runtime 名称失败:服务返回格式错误",loadCloudResourcesFailed:"加载云资源失败",invalidCloudResources:"云资源列表响应格式无效",invalidEnvironmentMount:"挂载环境响应格式无效",environmentMountMismatch:"挂载环境响应与请求不一致",environmentMountNetworkFailed:"无法连接 Studio 服务,环境挂载未完成。请检查网络后重试。",environmentMountFailed:"挂载环境失败",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",clipboardWriteFailed:"无法写入剪贴板,请检查剪贴板权限。",loadSystemInfoFailed:"加载系统信息失败",invalidSystemInfo:"系统信息响应格式无效",invalidEnvironmentBuild:"环境构建响应格式无效",invalidEnvironmentBuildStep:"环境构建步骤响应格式无效",invalidEnvironmentManifest:"环境 Manifest 响应格式无效",invalidImageRepository:"环境镜像仓库响应格式无效",invalidCodeRepository:"环境代码仓库响应格式无效",invalidImageSource:"环境镜像来源响应格式无效",invalidEnvironment:"环境响应格式无效",invalidWorkspace:"工作区响应格式无效",loadWorkspacesFailed:"加载工作区失败",invalidWorkspaceList:"工作区列表响应格式无效",saveWorkspaceFailed:"保存工作区失败",deleteWorkspaceFailed:"删除工作区失败",loadEnvironmentsFailed:"加载环境失败",invalidEnvironmentList:"环境列表响应格式无效",probeRepositoryFailed:"探查代码仓库失败",invalidRepositoryProbe:"代码仓库探查响应格式无效",exportEnvironmentCodeFailed:"导出环境分享码失败",invalidEnvironmentCode:"环境分享码响应格式无效",inspectEnvironmentCodeFailed:"检测环境分享码失败",invalidEnvironmentCodeInspection:"环境分享码检测响应格式无效",importEnvironmentCodeFailed:"导入环境分享码失败",invalidEnvironmentCodeImport:"环境分享码导入响应格式无效",studioUnavailable:"无法连接 Studio 服务,请确认后端已启动后重试。",saveEnvironmentFailed:"保存环境失败",deleteEnvironmentFailed:"删除环境失败",startEnvironmentBuildFailed:"启动环境构建失败",loadEnvironmentBuildFailed:"读取环境构建详情失败",loadEnvironmentManifestFailed:"读取环境 Manifest 失败",invalidEnvironmentResource:"环境资源响应格式无效",loadEnvironmentResourcesFailed:"加载环境构建资源失败",updateCodexSandboxFailed:"更新 Codex Sandbox 失败",invalidCodexSandboxUpdate:"Codex Sandbox 更新响应格式无效",loadUserPoolsFailed:"加载用户池失败",invalidUserPoolList:"用户池列表响应格式无效",syncGithubFailed:"同步 GitHub 代码失败 ({{status}})",validatingMigrationArtifact:"正在校验迁移产物",uploadingCodePackage:"正在上传代码包",migrationArtifactValidated:"迁移产物校验完成",codePackageUploaded:"代码包上传完成",deploymentProgress:{preparing:"正在准备部署",uploading:"正在上传代码包",building:"正在构建镜像",buildLogsSyncing:"正在构建镜像,构建日志已同步。",buildLogsComplete:"构建日志同步完成。",buildFailedLogsSynced:"镜像构建失败,最终构建日志已同步。",buildLogsUnavailable:"暂时无法读取构建日志。",finalBuildLogsUnavailable:"暂时无法读取最终构建日志。",deploying:"正在部署服务",publishing:"正在发布服务",evaluating:"正在创建评测集",updating:"正在更新 Runtime 配置",completing:"正在完成部署",github:"正在配置 GitHub 持续交付",inProgress:"正在部署"},deploymentFailed:"部署失败",deploymentDisconnected:"部署失败:连接中断",deploymentMissingAgentName:"部署失败:返回缺少 Agent 名称",deploymentMissingConnection:"部署失败:返回缺少 AgentKit 连接信息",cancelDeploymentFailed:"取消部署失败 ({{status}})",loadFailed:"加载失败 ({{status}})",loadPermissionsFailed:"加载权限失败 ({{status}})",invalidPermissionResponse:"权限服务返回了无法解析的响应",checkStudioUpdateFailed:"检查 Studio 更新失败 ({{status}})",studioUpdatePreflightFailed:"Studio 更新权限预检失败 ({{status}})",submitStudioUpdateFailed:"提交 Studio 更新失败 ({{status}})",loadAgentUsageFailed:"加载 Agent 用量失败",notProvided:"未提供",agentUsageNonJson:"加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP {{status}},Content-Type: {{contentType}})。",checkStudioGateway:"请确认当前服务以 Studio 模式启动,并检查代理或网关配置。",agentUsageInvalidJson:"加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP {{status}},Content-Type: {{contentType}})。",retryCheckGateway:"请稍后重试;若问题持续,请检查代理或网关配置。",loadCronJobsFailed:"加载定时任务失败",loadCronJobFailed:"加载定时任务详情失败",createCronJobFailed:"创建定时任务失败",updateCronJobFailed:"更新定时任务失败",enableCronJobFailed:"启用定时任务失败",pauseCronJobFailed:"暂停定时任务失败",runCronJobFailed:"立即执行定时任务失败",loadCronHistoryFailed:"加载执行历史失败",stopCronRunFailed:"终止执行失败",deleteCronJobFailed:"删除定时任务失败",loadRuntimeFailed:"加载 Runtime 失败",loadLocalToolsFailed:"读取本地工具失败",connectDynamicRouteFailed:"连接 Studio 动态路由失败",a2aProbeDenied:"Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。",loadA2aCardFailed:"读取 A2A Agent Card 失败",loadRuntimeApiKeyFailed:"读取 Runtime API Key 失败",runtimeApiKeyMissing:"Runtime 未返回可用的 API Key",loadMcpCredentialsFailed:"读取 MCP 认证信息失败",invalidMcpCredentials:"Studio 返回的 MCP 认证信息格式无效",deleteFailed:"删除失败 ({{status}})",runtimeManageForbidden:"当前账号没有管理该 Runtime 的权限。",runtimeNotFound:"该 Runtime 不存在或已被删除。",runtimeUnavailable:"当前账号无法访问该 Runtime。",checkRuntimeUpdateFailed:"检查 Runtime 更新能力失败(HTTP {{status}}),请稍后重试。",loadRuntimeDetailFailed:"加载 Runtime 详情失败",generateProjectFailed:"生成项目失败",generateProjectTimedOut:"生成发布预览项目超时,请稍后重试。",generateAgentConfigFailed:"生成 Agent 配置失败",createDebugRunFailed:"创建调试运行失败",createDebugSessionFailed:"创建调试会话失败",loadDebugTraceFailed:"加载调试调用链路失败",invalidDebugTrace:"加载调试调用链路失败:返回格式无效",debugRunFailed:"调试运行失败",cleanupDebugRunFailed:"清理调试运行失败"},fme={loadFailed:"读取会话模式能力失败(HTTP {{status}})",invalidResponse:"会话模式能力响应格式错误"},hme={nonJson:"{{fallback}}:服务端返回非 JSON 响应(HTTP {{status}},{{contentType}}){{detail}}"},pme={busy:"工作区正在处理较多请求,请稍后重试",notFound:"工作区不存在",duplicates:"检测到多个个人工作区会话,请联系管理员处理",timeout:"工作区恢复超时,项目仍保留,请重试",unavailable:"工作区暂时无法恢复,原项目仍保留,请重试",persistence:"当前 Sandbox 未启用持久化快照,请检查工作区配置",startup:"个人工作区启动失败,请检查 Sandbox 状态",exists:"项目名称已存在,请从项目列表打开",directory:"项目目录不存在",configuration:"请先配置工作区 Sandbox 镜像",state:"暂时无法确认工作区状态,请重试",list:"恢复工作区或读取项目列表失败,请重试",create:"项目初始化失败,请确认镜像可用后重试",open:"恢复工作区或打开项目失败,请重试",connection:"工作区暂时无法连接,请重试",invalidWorkspaceUrl:"工作区返回了无效的访问地址",operation:"项目操作失败,请重试",invalidProjectUrl:"项目访问地址无效",listFallback:"读取项目列表失败",connectionState:"暂时无法连接工作区,请重试"},mme={reporting:"正在补齐交付信息",packaging:"正在整理产物",savingVersion:"正在保存版本",finishing:"正在完成请求",submitResult:"提交构建结果",requestFailed:"任务请求失败,请重试。",invalidResponse:"任务状态响应无效。",eventGap:"正在补齐任务输出。",reconnecting:"连接暂时中断,正在重连。已有输出已保留。",input:{pending:"等待送达",sending:"正在确认送达",delivered:"已送达",withdrawn:"已停止发送"},plan:"执行计划",diff:"文件变更",preparing:"正在准备任务",preparingEnvironment:"正在准备开发环境…",connectingEnvironment:"正在连接开发环境…",processing:"正在处理请求",thinking:"正在思考",read:"读取文件 · {{target}}",listFiles:"查看目录 · {{target}}",search:"搜索 · {{target}}",command:"执行命令 · {{target}}",editFiles:"修改文件 · {{target}}",webSearch:"搜索网页 · {{target}}",processSummary:"已处理 {{count}} 项",duration:"{{seconds}} 秒",durationUnits:{milliseconds:"{{value}} 毫秒",hours:"{{value}} 小时",minutes:"{{value}} 分",seconds:"{{value}} 秒"},failedTools:"{{count}} 项执行失败",toolFailed:"执行失败",toolCalls:"{{count}} 次工具调用",turnDuration:"本轮耗时 {{duration}}",toolDuration:"工具累计耗时 {{duration}}",toolDurationPartial:"已记录工具耗时 {{duration}}",toolDurationHelp:"各工具执行耗时之和;并行调用可能使累计耗时超过本轮耗时。",turnStatus:{completed:"已完成",failed:"未完成",interrupted:"已中断",cancelled:"已中断",unavailable:"任务已结束"},notReported:"未上报",partial:"已记录",partialHelp:"本轮记录可能不完整。",tokenDetails:"本轮 Token 用量",model:"本轮模型",totalTokens:"总量",inputTokens:"输入",cachedInputTokens:"缓存命中输入",uncachedInputTokens:"未命中输入",cacheWriteInputTokens:"缓存写入",outputTokens:"输出",reasoningOutputTokens:"推理输出",cacheHitRate:"输入缓存命中率",tokenHelp:"缓存命中属于输入,推理输出属于输出,不重复计入总量。未命中输入 = 输入 − 缓存命中。"},g9={common:qpe,agentkitCli:Wpe,cloudRegion:Kpe,connections:Gpe,feishuBot:Xpe,requestError:Ype,runSse:Zpe,runtimeLogs:Jpe,search:eme,skills:tme,sse:nme,identity:ime,github:rme,video:sme,websiteIntegration:ome,knowledge:ame,intelligentDevelopment:lme,migrations:cme,sandbox:ume,client:dme,newChatCapabilities:fme,jsonResponse:hme,workspaceProjects:pme,developmentRuns:mme},q7e=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:Wpe,client:dme,cloudRegion:Kpe,common:qpe,connections:Gpe,default:g9,developmentRuns:mme,feishuBot:Xpe,github:rme,identity:ime,intelligentDevelopment:lme,jsonResponse:hme,knowledge:ame,migrations:cme,newChatCapabilities:fme,requestError:Ype,runSse:Zpe,runtimeLogs:Jpe,sandbox:ume,search:eme,skills:tme,sse:nme,video:sme,websiteIntegration:ome,workspaceProjects:pme},Symbol.toStringTag,{value:"Module"})),gme="智能体审核",bme="申请企业内全员使用,审批后生效",yme="关闭",vme="刷新",xme="状态",wme="申请人",Ome="申请时间",kme="当前版本",Sme="模型",Eme="退回人",Cme="通过人",Tme="审批时间",Ame="智能体描述",_me="申请说明",jme="退回理由",Nme="审批意见",Rme="退回理由(必填)",Ime="提交后内容已变化,请退回并重新申请",Pme="撤回后可以修改 Agent,需要公开时重新申请",Dme="取消公开后其他用户将无法继续使用,确定取消公开吗?",Mme="取消",Lme="确认",$me="正在保存",Fme="取消公开",Bme="撤回申请",Ume="通过",Qme="直接公开",zme="申请公开",Vme="全员可见",Hme={pending:"待审核",approved:"已通过",returned:"已退回",withdrawn:"已撤回"},qme="搜索智能体或申请人",Wme="地域",Kme="全部状态",Gme="智能体",Xme="操作",Yme="查看并审批",Zme="申请详情",Jme="没有符合条件的申请",ege="暂无智能体审核申请",tge="{{count}} / {{limit}} 字",W7e={title:gme,dialogDescription:bme,close:yme,refresh:vme,statusTitle:xme,submitter:wme,submittedAt:Ome,version:kme,model:Sme,returnedBy:Eme,approvedBy:Cme,reviewedAt:Tme,description:Ame,message:_me,reason:jme,comment:Nme,reasonRequired:Rme,contentChanged:Ime,withdrawConfirm:Pme,unpublishConfirm:Dme,cancel:Mme,confirm:Lme,saving:$me,unpublish:Fme,withdraw:Bme,return:"退回",approve:Ume,publish:Qme,submit:zme,private:"仅自己可见",enterprise:Vme,status:Hme,search:qme,region:Wme,all:Kme,agent:Gme,actions:Xme,review:Yme,details:Zme,noMatches:Jme,empty:ege,textCount:tge},K7e=Object.freeze(Object.defineProperty({__proto__:null,actions:Xme,agent:Gme,all:Kme,approve:Ume,approvedBy:Cme,cancel:Mme,close:yme,comment:Nme,confirm:Lme,contentChanged:Ime,default:W7e,description:Ame,details:Zme,dialogDescription:bme,empty:ege,enterprise:Vme,message:_me,model:Sme,noMatches:Jme,publish:Qme,reason:jme,reasonRequired:Rme,refresh:vme,region:Wme,returnedBy:Eme,review:Yme,reviewedAt:Tme,saving:$me,search:qme,status:Hme,statusTitle:xme,submit:zme,submittedAt:Ome,submitter:wme,textCount:tge,title:gme,unpublish:Fme,unpublishConfirm:Dme,version:kme,withdraw:Bme,withdrawConfirm:Pme},Symbol.toStringTag,{value:"Module"})),nge={backToEvaluationCase:"返回评测案例",cancel:"取消",copied:"已复制",copy:"复制",exportConversation:"导出会话",retry:"重试"},ige={title:"您想以哪种方式添加 Agent 来运行?",subtitle:"选择最适合你的方式,下一步即可开始",quickCreate:{title:"从 0 快速创建",description:"用智能、自定义、模板或工作流的方式从零创建一个 Agent。"},intelligent:{title:"智能模式",description:"描述目标,按你的意图构建、调试并验证 Agent。"},package:{title:"从代码包添加和部署",description:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。"},migrate:{title:"从存量迁移",description:"从您的 LangChain、Dify 等存量项目迁移至 AgentKit Runtime。"}},rge={subject:{file:"文件修改",command:"命令执行"},decision:{accept:"已允许本次{{subject}}",acceptForSession:"已在本会话中允许{{subject}}",decline:"已拒绝{{subject}}",cancel:"已取消{{subject}}审批"},details:{command:"命令",grantRoot:"授权路径",cwd:"执行目录"}},sge={noDescription:"暂无描述",region:"地域",unknownAgent:"未知 Agent"},oge={agentTransfer:"智能体移交",annotationHint:"模型回复;选中文字后可添加批注",continueBranch:"继续“{{branch}}”这个方向",emptyResponse:"本次没有返回可显示的内容。",subagentDescription:"正在执行主 Agent 移交的任务。"},age={title:"需要配置 {{provider}} AK/SK",prefix:"智能体工作台需要 {{provider}} 凭据才能使用。请在运行环境中设置",and:"与",suffix:"后重试。"},lge={buildRunning:{title:"当前构建仍在进行",description:"离开将停止本轮构建;当前会话仍会保留,可稍后从历史会话重新进入。",confirm:"停止并离开"},deleteThread:{title:"删除 Codex 历史会话",description:"将删除“{{name}}”,并从历史会话中移除。",confirm:"确认删除"},returnToCreate:{title:"返回创建首页?",description:"返回后当前填写的内容将会丢失,确定要返回吗?",confirm:"确定返回"}},cge={additionalAgentDeleteFailures:";另有 {{count}} 个失败",agentDeleteFailures:"{{count}} 个 Agent 删除失败:{{failures}}{{suffix}}",agentToolsMissing:"当前 Agent 缺少任务工具:{{tools}}",buildStopUnconfirmed:"已离开开发环境,但未能确认本轮构建已停止。任务可能仍在运行,请稍后从历史会话检查状态。",builtinAgentSendFailed:"内置智能体发送失败:{{message}}",bytePlusEvaluationUnsupported:"BytePlus 暂不支持 AgentKit 评测集",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",cloudCodexEmptyReply:"云端 Codex 已结束,但没有生成回复,请重新发送任务。",cloudCodexSessionMissing:"云端 Codex Session 暂未出现在列表中,请稍后重试。",deploymentRuntimeIdMissing:"部署完成,但未返回 Runtime ID。",environmentExpired:"所选环境已失效,请刷新后重新选择。",environmentsLoadFailed:"读取环境失败",evaluationCaseSessionMissing:"这条案例缺少会话定位信息,无法跳转。",evaluationUnsupportedForReply:"当前回复暂不支持加入评测集",firstFrameRequired:"首尾帧生成需要先添加首帧图片。",incompletePromptOptimization:"提示词优化结果不完整,请重新优化后再试。",intelligentCapabilityCheckFailed:"智能开发能力检查失败(HTTP {{status}})",intelligentSessionCreateFailed:"智能开发会话创建失败",invalidIntelligentCapability:"智能开发模型能力格式错误。",localBffToolsNotConfigured:"本地 Studio BFF 没有配置工具。",localToolsLoadFailed:"读取本地工具失败",loginPopupBlocked:"登录窗口被浏览器拦截,请允许弹出窗口后重试。",loginPopupClosed:"登录窗口已关闭,请重新登录以继续当前操作。",mediaTooLarge:"{{fileName}} 超出当前平台允许的素材大小。",mountEnvironmentFailed:"挂载环境失败",noConnectedSandbox:"当前没有已连接的 Sandbox。",noCreateAgentPermission:"当前账号没有添加 Agent 的权限。",noManageAgentPermission:"当前账号没有管理 Agent 的权限。",noOptimizationBaseline:"当前版本没有可对比的优化前版本。",oauthUrlMissing:"事件中没有授权地址。",onlyCloudAgentUpdatable:"仅支持更新已部署的云端智能体。",optimizationVersionMissing:"无法找到本次优化对应的项目版本,可能已被删除。",persistentStorageNotConfigured:"管理员未配置持久化存储",readDraftFailed:"无法读取本机草稿,请稍后重试。",runtimeAgentNameMissing:"Runtime 缺少智能体名称,无法更新。",runtimeBffToolsDisabled:"当前 Runtime Agent 未开启 BFF 工具能力。",runtimeDeploymentConfigUnavailable:"该 Runtime 的原发布配置不可恢复,无法安全更新。",runtimeMissingForConnection:"缺少 Runtime 信息,无法连接智能体。",runtimeRegionMissingForDelete:"Runtime 缺少地域信息,无法删除",runtimeRegionMissingForUpdate:"Runtime 缺少地域信息,无法更新。",runtimeUpdateUnsupported:"当前 Runtime 不支持原地更新。",sandboxRuntimeUnavailable:"当前 Agent 没有可用的 Sandbox Runtime。",sandboxToolsUnavailable:"当前 Studio BFF 未提供 Sandbox 执行工具。",saveDraftLocationRejected:"浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。",saveDraftRejected:"浏览器拒绝保存草稿,请稍后重试。",selectSkillToOptimize:"请先选择需要优化的 Skill。",sessionMissingForMount:"当前会话不存在,无法挂载环境。",sessionNotReady:"会话尚未就绪。",sessionUnavailable:"当前会话不可用,请关闭后重试。",sourceNotReady:"该源码尚未准备好,请返回对话继续处理。",textVideoRejectsReferences:"文生视频不使用参考素材,请先移除已添加的图片或视频。",videoEditRequiresVideo:"视频编辑需要先添加待编辑视频。",videoExtendRequiresVideo:"视频续写需要先添加基础视频。",videoGenerationFailed:"视频生成失败,请稍后重试。",videoModeUnsupported:"当前平台暂不支持所选视频任务模式。",videoPreviewMissing:"视频任务已完成,但服务端未返回预览地址。",videoReferenceRequired:"参考素材生视频需要至少添加一项参考图片或参考视频。"},uge={like:"赞",removeLike:"取消点赞",dislike:"踩",removeDislike:"取消点踩",reportIssue:"问题反馈",traceFlameGraph:"Tracing 火焰图"},dge={0:"今天想做点什么?",1:"有什么可以帮你的?",2:"需要我帮你查点什么吗?",3:"有问题尽管问我",4:"嗨,我们开始吧",5:"开始一段新对话吧",6:"今天想先解决哪件事?",7:"把你的想法告诉我吧",8:"我们从哪里开始?",9:"有什么任务交给我?",10:"准备好一起推进了吗?",11:"说说你现在最关心的问题",12:"今天也一起把事情做好",13:"我在,随时可以开始",intelligentDevelopment:"让灵感自由生长"},fge={agentCapabilities:"正在检查 Agent 能力…",session:"加载会话…"},hge={cancelled:"授权已取消。",pasteCallbackUrl:"授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:",popupBlocked:"弹窗被拦截,请允许弹窗后重试。",unsupportedUrl:"授权链接不是 http/https 地址,已阻止打开。"},pge={volcengine:"火山引擎"},mge={checkingPersistence:"正在检查持久化能力…",exitDevelopment:"退出开发环境",fileUploaded:"已上传文件到 Sandbox",filesUploaded:"已上传 {{count}} 个文件到 Sandbox",intelligentDevelopment:"智能开发",mode:{readOnly:"只读",workspaceWrite:"工作区写入",fullAccess:"完全访问"},approvalPolicy:{untrusted:"仅不可信命令",onRequest:"按需审批",never:"不审批"},reviewer:{user:"由我审批",autoReview:"自动审查"},labels:{approvalPolicy:"审批策略",file:"文件",fileNumber:"文件 {{number}}",mode:"沙箱模式",networkAccess:"网络访问",reviewer:"审批方式",workingDirectory:"工作目录"},network:{allowed:"允许",disabled:"关闭"},permissionsUpdated:"已更新当前 Sandbox Session 的 Codex 权限",persistenceUnknown:"暂时无法确认持久化能力",stoppedReady:"已停止,可继续输入",uploadedFilesPrompt:"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",workspaceUpdated:"已更新工作空间"},gge={addAgent:"添加智能体",addFromPackage:"从代码包添加",agent:"智能体",automations:"自动化",createAgent:"创建智能体",createSkill:"创建技能",cronJobs:"定时任务",issueFeedback:"问题反馈",library:"资源库",migrateAgent:"迁移智能体",newConversation:"新会话",optimizeSkill:"优化 {{name}}",search:"搜索",skill:"技能",skillLibrary:"技能库",systemInfo:"系统信息",updateAgent:"更新 {{name}}",codeProjects:"代码项目",reviewCenter:"审核中心"},bge={title:"从工作区新建",description:"创建和管理代码项目,在 VS Code 中编写和调试"},yge={actions:nge,addAgent:ige,approval:rge,common:sge,conversation:oge,credentials:age,dialogs:lge,errors:cge,feedback:uge,greetings:dge,loading:fge,oauth:hge,providers:pge,sandbox:mge,titles:gge,workspaceProjectEntry:bge},G7e=Object.freeze(Object.defineProperty({__proto__:null,actions:nge,addAgent:ige,approval:rge,common:sge,conversation:oge,credentials:age,default:yge,dialogs:lge,errors:cge,feedback:uge,greetings:dge,loading:fge,oauth:hge,providers:pge,sandbox:mge,titles:gge,workspaceProjectEntry:bge},Symbol.toStringTag,{value:"Module"})),vge="自动化",xge="连接研发工具,为智能体扩展自动化工作流",wge="搜索自动化",Oge="自动化分类",kge={development:"研发",channels:"消息渠道"},Sge="{{category}}自动化列表",Ege="打开{{name}}",Cge="仅本地部署可用",Tge="没有匹配的自动化",Age="请尝试搜索其他名称",_ge="返回自动化列表",jge={"coding-agents":{name:"配置 Coding Agents",badge:"本地",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},template:{name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},delivery:{name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},review:{name:"GitHub PR 自动评审",description:"通过 GitHub App 在隔离 Sandbox 中评审 Pull Request。",title:"GitHub PR 自动评审",subtitle:"通过 GitHub App 触发 Sandbox 评审,并将结果发布到 Pull Request",panel:"请先将 GitHub App 安装到目标仓库,再为每个仓库启用自动评审。",submitLabel:"安装 GitHub App",regionHelp:"",pullRequest:{title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},sandboxToolId:{label:"沙箱工具 ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv"},modelName:{label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称"},modelBaseUrl:{label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址"}}},"gitlab-review":{name:"GitLab MR 自动评审",description:"通过 GitLab 集成在隔离 Sandbox 中评审 Merge Request。"},feishu:{name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},"website-integration":{name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"}},Nge={required:"必填",optional:"可选",region:"地域",tokenLabel:"GitHub Token",getToken:"获取 Token",createToken:"创建 GitHub Token",tokenPlaceholder:"需要仓库 Contents 与 Pull requests 写权限",tokenWorkflowPlaceholder:"需要 Contents、Pull requests、Workflows 写权限",hideToken:"隐藏 Token",showToken:"显示 Token",tokenHelp:"Token 仅用于本次提交,不会保存在浏览器或写入 PR",tokenWorkflowHelp:"此处 Token 用于创建配置 PR;它不是 Sandbox 的通用必填项,且不会保存在浏览器或写入 PR",prCreated:"PR #{{number}} 已创建",configPrCreated:"配置 PR #{{number}} 已创建",configPrNextStep:"合并后,后续同仓库 PR 会自动触发评审。",viewOnGitHub:"在 GitHub 查看",viewConfigPr:"查看配置 PR",secretsHeading:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:",secretsConfigHeading:"合并配置 PR 前,请在目标仓库添加运行时密钥",openSecrets:"打开 Secrets 设置",secretsPath:"路径:Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"将为 {{repository}} 添加 PR 自动评审配置",repositoryReviewHelp:"将使用 GitHub App 校验 {{repository}} 的 Pull Request",secretPair:"{{accessKey}}、{{secretKey}}(必填)",sessionToken:"{{sessionToken}}(使用临时凭据时必填)",requiredSecret:"{{name}}(必填)",temporaryCredentialRequired:"(使用临时凭据时必填)",requiredSuffix:"(必填)",submitting:"提交 PR 中…",validation:{required:"此项不能为空",repository:"请输入 owner/repository 或完整 GitHub 仓库 URL",baseBranch:"目标分支格式不正确",projectPath:"请输入仓库内的相对目录",runtimeId:"运行时 ID 格式不正确",sandboxToolId:"沙箱工具 ID 格式不正确",modelName:"模型名称格式不正确",modelBaseUrlSafe:"请输入不含凭据、查询参数或锚点的 HTTPS 地址",modelBaseUrl:"请输入有效的 HTTPS 地址",runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}}},Rge={title:"配置 Coding Agents",description:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。",retry:"重试",clients:{ariaLabel:"选择 Coding Agent",title:"本机客户端",detectAgain:"重新检测",detecting:"正在检测本机客户端…",detected:"已检测到客户端",available:"可用",unavailable:"未检测到"},skills:{ariaLabel:"选择内置 Skill",title:"内置 Skills",viewFiles:"查看文件",items:{"veadk-agent-development":{name:"VeADK Agent 开发",description:"使用 VeADK 开发和完善 Agent。"},"agentkit-cli":{name:"AgentKit CLI",description:"通过 AgentKit CLI 管理和部署 AgentKit 资源。"}}},global:{ariaLabel:"全局安装目录",title:"全局安装",description:"配置后可在本机其他项目中使用",empty:"选择客户端后显示对应安装目录。"},success:"已为 {{agentCount}} 个客户端配置 {{skillCount}} 个 Skill",selection:"已选择 {{agentCount}} 个客户端、{{skillCount}} 个 Skill",selectClient:"请先选择客户端",configuring:"正在配置…",configure:"配置",errors:{detect:"检测本机客户端失败",configure:"配置失败,请检查用户目录权限后重试"},preview:{description:"只读浏览随 Studio 提供的 Skill 文件",close:"关闭文件预览",loading:"正在读取文件…",error:"读取 Skill 文件失败",skillFiles:"{{name}} 文件",files:"文件",fileContent:"文件内容",notPreviewable:"此文件不是可预览的 UTF-8 文本。",noFiles:"没有可预览的文件。"}},Ige={title:"飞书机器人",description:"创建一个由 AgentKit Runtime 驱动的飞书智能体",panel:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。",agentName:"智能体名称",agentNameHelp:"将作为新 Runtime 中的根智能体名称",region:"部署地域",regionHelp:"Runtime 与构建产物将创建在该地域",regions:{"cn-beijing":"北京","cn-shanghai":"上海"},appId:"飞书 App ID",appIdHelp:"来自飞书开放平台的应用凭证",appSecret:"飞书 App Secret",appSecretPlaceholder:"请输入 App Secret",appSecretHelp:"仅写入新 Runtime 的环境变量",hideSecret:"隐藏 App Secret",showSecret:"显示 App Secret",hide:"隐藏",show:"显示",confirmCancel:"取消部署将停止任务并清理已创建的 Runtime,确定继续吗?",status:{preparing:"正在生成 basic 智能体",running:"正在创建 Runtime",cancelling:"正在取消部署",succeeded:"飞书机器人 Runtime 已创建",cancelled:"部署已取消",failed:"创建失败"},steps:{prepare:"生成智能体",build:"构建镜像",deploy:"创建 Runtime",publish:"发布服务"},openConsole:"打开 Runtime 控制台",credentials:{title:"凭据处理",description:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"},cancelDeployment:"取消部署",creating:"正在创建…",create:"创建飞书机器人 Runtime",validation:{appId:"请输入飞书 App ID",appSecret:"请输入飞书 App Secret",agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}},generatedAgent:{description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。"}},Pge={title:vge,description:xge,search:wge,categoriesLabel:Oge,categories:kge,resultsLabel:Sge,open:Ege,localOnly:Cge,emptyTitle:Tge,emptyDescription:Age,backToAutomations:_ge,cards:jge,github:Nge,codingAgents:Rge,feishu:Ige},X7e=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:_ge,cards:jge,categories:kge,categoriesLabel:Oge,codingAgents:Rge,default:Pge,description:xge,emptyDescription:Age,emptyTitle:Tge,feishu:Ige,github:Nge,localOnly:Cge,open:Ege,resultsLabel:Sge,search:wge,title:vge},Symbol.toStringTag,{value:"Module"})),Dge={"zh-CN":"简体中文","en-US":"English"},Y7e={languageNames:Dge},Z7e=Object.freeze(Object.defineProperty({__proto__:null,default:Y7e,languageNames:Dge},Symbol.toStringTag,{value:"Module"})),Mge={selectedExcerptLabel:"选中片段",commentLabel:"批注",commentSeparator:":",successTitle:"已加入 Bad case 评测集",successDescription:"这条批注已关联当前问题和完整模型回复。",done:"完成",ariaLabel:"批注选中的模型回复",title:"添加批注",content:"批注内容",placeholder:"说明问题或期望的修改方式",retryError:"{{error}},请重试。",cancel:"取消",submit:"加入 Bad Case"},Lge={attachment:"附件",image:"图片",preview:"预览 {{name}}",uploading:"上传中",uploadFailed:"上传失败",remove:"移除 {{name}}",previewDialog:"{{name}}预览",download:"下载",close:"关闭",reading:"正在读取文档…",loadFailed:"文档加载失败:{{error}}"},$ge={errorTitle:"云端日志错误",copyError:"复制完整错误信息",retry:"重试",statuses:{live:"实时",connecting:"连接中",retrying:"重连中",idle:"未连接"},title:"实例日志",description:"当前对话请求所在的 VeFaaS 实例",close:"关闭实例日志",instanceId:"实例 ID",waitingInstance:"等待实例",request:"请求 {{id}}",ariaLabel:"VeFaaS 实例实时日志",notCapturedTitle:"尚未捕获到实例",notCapturedDescription:"发送一条消息后,这里会显示实际处理请求的实例和实时日志。",connectingTitle:"正在连接实例日志",connectingDescription:"正在通过 Studio BFF 建立安全日志流。",emptyTitle:"暂无日志",emptyDescription:"已连接实例,等待新的日志输出。",retention:"日志自动刷新,仅保留最近 {{count}} 行"},Fge={title:"调用链路观测",statuses:{loading:"加载中",ready:"",collecting:"采集中",disabled:"未开启",forbidden:"权限不足",error:"加载失败"},errors:{collecting:"调用链路仍在采集中,请稍候。",disabled:"该 Agent 未开启链路观测,请到控制台开启后重试。",forbidden:"当前账号无权读取 APMPlus 调用链路,请联系管理员补充只读权限。",error:"调用链路加载失败,请稍后重试。"},callCount:"{{count}} 个调用 · {{duration}} ms",close:"关闭",loading:"加载调用链路…",retryNow:"立即重试",reload:"重新加载",empty:"该会话暂无调用链路(可能尚未产生调用)。",attributes:"属性",selectCall:"选择左侧的一个调用查看详情"},Bge={exportNote:"上述会话由 AgentKit Studio 导出,仅供参考",imageFailed:"图片生成失败,请重试。",browserUnsupported:"浏览器无法生成会话图片,请重试。",copyUnsupported:"当前浏览器不支持复制图片,请下载后使用。",exportFailed:"导出失败,请重试。",title:"导出会话",description:"选择格式并下载截至当前回复的全部输入与输出。",close:"关闭",generatingContent:"正在生成导出内容…",retry:"重试生成",previewPage:"预览第 1 页,共 {{count}} 页",previewAlt:"会话导出内容第 1 页,共 {{count}} 页",format:"导出格式",generatingFormat:"正在生成 {{format}}…",copying:"正在复制…",copiedFirst:"已复制第一页",copied:"已复制",copyFirst:"复制第一页",copyImage:"复制图片",generating:"正在生成…",downloadArchive:"下载 PNG 压缩包({{count}} 页)",downloadFormat:"下载 {{format}}"},Uge={unsupportedComponent:"不支持的组件:{{component}}",sandboxIdentity:"Codex Sandbox 执行标识",useSkill:"使用 {{name}} 技能",thinkingDone:"已完成思考",thinking:"思考中",justNow:"刚刚",sourceUnavailable:"暂时无法读取生成的源码,请稍后重试。",downloadStarted:"已开始下载",verifiedDelivery:"已验证交付物",generatedSource:"生成的 Agent 源码",entryPoint:"入口",fileCount:"文件数",size:"大小",validationTime:"验证时间",generationTime:"生成时间",checksPassed:"{{count}} 项检查通过",sourceReady:"源码已准备好,可部署",sourceGuidance:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。",viewSource:"查看源码",preparing:"正在准备…",viewChanges:"查看本次变更",downloadSource:"下载源码",sourceNotReady:"源码尚未准备好",manualDeploy:"手动部署到 Runtime",deployAgent:"部署 Agent",beforeOptimization:"优化前",afterOptimization:"优化后",planStatuses:{pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"},renderUi:"渲染 UI",truncated:"…(已截断)",agentAdjusting:"Agent 正在调整",sandboxDetails:"Codex Sandbox 详细输出",waitingCodex:"正在等待 Codex 输出",arguments:"参数",result:"返回",artifacts:"产物",downloadNamed:"下载 {{name}}",powerpoint:"PowerPoint 演示文稿",preview:"预览",download:"下载",previewDialog:"{{name}} 预览",closePreview:"关闭预览",slidePreview:"{{name}} 幻灯片预览",mcpToolset:"MCP 工具集",authorized:"已授权 · {{tool}}",authorizationRequired:"{{tool}} 需要授权",oauthDescription:"工具集 {{tool}} 使用 OAuth 保护,需登录授权后方可调用。",oauthProvider:"将跳转至 {{provider}} 完成登录。",oauthContinue:"授权完成后对话自动继续。",waitingAuthorization:"等待授权…",authorize:"去授权",missingAuthorizationUrl:"未在事件中找到授权地址。",tools:{web_search:{running:"正在进行网络搜索",done:"已完成网络搜索"},link_reader:{running:"正在读取网页",done:"已完成网页读取"},run_code:{running:"正在 AgentKit 沙箱中执行代码",done:"已在 AgentKit 沙箱中完成代码执行"},list_envs:{running:"正在查看可用环境",done:"已读取可用环境"},get_env_manifest:{running:"正在读取环境 Manifest",done:"已读取环境 Manifest"},execute_in_sandbox:{running:"正在环境中执行命令",done:"已在环境中完成命令执行"},delegate_to_codex_sandbox:{running:"Codex Sandbox 正在执行",done:"Codex Sandbox 已完成",failed:"Codex Sandbox 执行失败"},image_generate:{running:"正在生成图片",done:"已完成图片生成"},video_generate:{running:"正在生成视频",done:"已完成视频生成"},ppt_generate:{running:"正在生成 PPT",done:"已完成 PPT 生成"},load_memory:{running:"正在检索长期记忆",done:"已完成记忆检索"},load_knowledgebase:{running:"正在检索知识库",done:"已完成知识库检索"},load_skill:{running:"正在加载技能",done:"已加载技能"},collect_resources:{running:"正在收集可用资源",done:"已完成资源收集",failed:"资源收集失败"},create_agents:{running:"正在创建并运行 Agent",done:"已完成 Agent 创建",failed:"Agent 创建失败"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit 技能中心",knowledge_base:"知识库",tool:"工具"},agentTypes:{llm:"LLM 智能体",sequential:"顺序智能体",parallel:"并行智能体",loop:"循环智能体",workflow:"工作流"},skill:"技能",subAgents:"子智能体",builtinTool:"内置工具",skillCenter:"AgentKit 技能中心",selfAuthoredTools:"自写工具",dependencies:"依赖:{{items}}",fullCode:"{{name}} 完整代码",itemCount:"{{label}} {{count}} 项",collectionAria:"召回资源信息",retrieving:"正在检索资源",retrievalFailed:"资源检索未完成",checkConfig:"请检查资源服务配置后重试。",notSearched:"未检索",notConfigured:"未配置",resourceList:"{{label}}资源列表",searchKeywords:"检索关键词",skillHubSkipped:"未提供检索关键词,本次未检索 Skill Hub。",sourceSkipped:"未配置 {{label}},本次未检索该来源。",noResources:"本次检索未返回该类别的资源。",resultAria:"创建 Agent 结果",creationFailed:"Agent 创建未完成",agentResources:"{{name}} 具备的资源",knowledgeBase:"知识库",toolsLabel:"工具",creating:"正在创建 Agent",noAgents:"没有可展示的 Agent",noAgentResult:"工具返回中未包含 Agent 配置或执行结果。",sourceLabels:{tool:"工具",knowledge:"AgentKit 知识库",skillCenter:"AgentKit 技能中心",unknown:"未知来源"},unnamedResource:"未命名资源",unnamedAgent:"未命名 Agent"},branchCompare:{ariaLabel:"分支对比",selectDirection:"选择方向",continue:"继续这个方向"},codexProgress:{planTitle:"Codex 执行计划",fallback:{fileChange:"修改文件",approval:"等待操作批准",status:"Codex 状态",command:"运行命令"},planSummary:"已完成 {{completed}}/{{total}} 项",command:{running:"正在执行命令",completed:"命令执行完成",failed:"命令执行失败"},projectFiles:"{{count}} 个项目文件",projectFile:"项目文件",fileChange:{running:"正在更新{{subject}}",completed:"已更新{{subject}}",failed:"更新{{subject}}失败"},externalTool:"外部工具",mcp:{running:"正在调用工具 {{tool}}",completed:"已调用工具 {{tool}}",failed:"工具 {{tool}} 调用未完成"},collaboration:{spawn_agent:{running:"正在启动子任务",completed:"子任务已启动",failed:"子任务启动失败"},send_input:{running:"正在向子任务发送信息",completed:"已向子任务发送信息",failed:"向子任务发送信息失败"},wait:{running:"正在等待子任务",completed:"子任务等待已结束",failed:"等待子任务失败"},close_agent:{running:"正在结束子任务",completed:"子任务已结束",failed:"子任务结束失败"},default:{running:"正在协调子任务",completed:"子任务协作已完成",failed:"子任务协作失败"}},webSearch:{running:"正在进行网络搜索",completed:"已完成网络搜索",failed:"网络搜索未完成"},errorDetail:"Codex 执行未完成。",errorTitle:"Codex 执行遇到错误"}},Qge={segments:{system:"系统与工具",input:"输入与历史",output:"输出与思考",remaining:"剩余"},modelUnavailable:"模型信息未提供",promptWithSystem:"提示词(含系统)",systemUnknown:"系统与工具占用未知",systemApprox:"系统与工具约 {{count}} Token",ariaKnown:"上下文已使用 {{percentage}}%,{{system}},{{inputLabel}} {{input}} Token,输出与思考 {{output}} Token,剩余 {{remaining}} Token",ariaUnknown:"{{model}},上下文窗口未知,会话累计使用 {{count}} Token",composition:"上下文构成",percentageUsed:"{{percentage}}% 已用",gridAria:"100 格上下文构成图,每格代表上下文窗口的百分之一",estimated:"估算",unknown:"未知",summaryPercentage:"{{used}} 已用,剩余 {{remaining}}",summaryTokens:"{{used}} 已用,剩余 {{remaining}},总计 {{total}}",overflow:"已超出上下文 {{count}} Token",title:"上下文用量",unknownModel:"暂未收录该模型的上下文窗口",unknownRuntime:"当前 Runtime 未提供模型信息"},zge={title:"添加 AgentKit 智能体",noAgents:"连接成功,但该地址未发现任何 Agent(/list-apps 为空)。",connectionFailed:"连接失败:{{error}}。请检查 URL、API Key,以及该网关是否允许跨域。",description:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。",url:"访问地址 URL",apiKeyHint:"以 Authorization: Bearer 方式连接",displayName:"显示名称(可选)",displayNameHint:"默认取 URL 的主机名",cancel:"取消",connecting:"连接中…",connect:"连接并添加"},Vge={placeholder:"输入消息…",inputAria:"输入消息",generating:"正在生成",send:"发送"},Hge={ariaLabel:"本轮调用上下文",removeSkill:"移除技能 {{name}}",removeAgent:"移除 Agent {{name}}"},qge={cardAria:"{{label}} 图表",viewAria:"{{label}} 显示方式",preview:"预览",code:"代码",invalidEcharts:"ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。",renderFailed:"图表暂时无法渲染,请切换到代码检查内容。",echartsAria:"ECharts 图表预览",rendering:"正在渲染图表…",mermaidFailed:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。",mermaidAria:"Mermaid 图表预览"},Wge={playVideo:"点击播放视频:{{name}}",enlargeImage:"放大预览:{{name}}",image:"图片",enlargeVideo:"点击放大视频",videoPreview:"视频预览",downloadVideo:"下载视频",close:"关闭"},Kge={annotation:Mge,media:Lge,runtimeLogs:$ge,trace:Fge,share:Bge,blocks:Uge,tokenUsage:Qge,addAgentKit:zge,composer:Vge,invocation:Hge,visualization:qge,markdown:Wge},J7e=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:zge,annotation:Mge,blocks:Uge,composer:Vge,default:Kge,invocation:Hge,markdown:Wge,media:Lge,runtimeLogs:$ge,share:Bge,tokenUsage:Qge,trace:Fge,visualization:qge},Symbol.toStringTag,{value:"Module"})),Gge={back:"返回",cancel:"取消",deploy:"部署",delete:"删除",loading:"读取中…",next:"下一步",notSupported:"暂不支持",previous:"上一步",required:"必填",retry:"重试",actions:"操作",value:"值",disabled:"关闭",enabled:"已开启",none:"无",close:"关闭",name:"名称",description:"描述",send:"发送"},Xge={heading:"VeADK Agent 结构配置",importHint:"可在「创建 Agent」页通过「导入 YAML」重新载入。"},Yge={agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"},runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}},Zge={description:"一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",instruction:`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 @@ -115,12 +115,12 @@ ${i.detail}`;if(i.detail&&typeof i.detail=="object"){const r=i.detail;if(typeof ${JSON.stringify(i,null,2)}`}catch{return`${t} ${n}`}}async function*iYe({runtimeId:e,region:t,instanceName:n,sessionId:i,follow:r=!0,signal:s}){const o=new URLSearchParams({region:t,follow:String(r)});n&&o.set("instance_name",n),i&&o.set("session_id",i);const l=await fetch(Zo(`/web/runtime-logs/${encodeURIComponent(e)}/stream?${o.toString()}`),{headers:Pl(uu({Accept:"text/event-stream"})),cache:"no-store",signal:s});if(!l.ok)throw new Error(z("runtimeLogs.loadFailedWithDetail",{detail:await nYe(l)}));for await(const c of AI(l)){if(!tYe(c))throw new Error(z("runtimeLogs.invalidFormat"));yield c}}const rYe=255,sYe=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function oYe(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let i=0,r="";for(const s of t){if(!sYe.test(s))continue;const o=n.encode(s).byteLength;if(i+o>rYe)break;r+=s,i+=o}return r.replace(/ +/g," ").trimEnd()}const aYe=/RunPipeline result could not be reconciled|Polling build status failed/i;class w_ extends Error{constructor({taskId:n,cause:i}={}){super("The deployment request may still be running, but its status could not be confirmed.");rn(this,"taskId");this.name="DeploymentStatusUnconfirmedError",this.taskId=n}}function WSe(e){if(e instanceof w_)return!0;const t=e instanceof Error?e.message:String(e??"");return aYe.test(t)}function KSe(e){return!!(e&&typeof e=="object"&&"name"in e&&e.name==="AbortError")}async function lYe({load:e,signal:t,timeoutMs:n=30*6e4,intervalMs:i=2e3,shouldRetry:r=()=>!0}){if(t!=null&&t.aborted)throw t.reason??new DOMException("Aborted","AbortError");const s=Date.now()+Math.max(0,n);for(;!(t!=null&&t.aborted)&&Date.now()<=s;){try{const o=await e(t);if(o.done)return o}catch(o){if(t!=null&&t.aborted||KSe(o)||!r(o))throw o}if(t!=null&&t.aborted)throw t.reason??new DOMException("Aborted","AbortError");i<=0||await new Promise((o,l)=>{const c=()=>{globalThis.clearTimeout(u),t==null||t.removeEventListener("abort",c),l((t==null?void 0:t.reason)??new DOMException("Aborted","AbortError"))},u=globalThis.setTimeout(()=>{t==null||t.removeEventListener("abort",c),o()},i);t==null||t.addEventListener("abort",c,{once:!0})})}return null}const C6="ap-southeast-1",nU="cn-beijing",cYe="https://ark.ap-southeast.bytepluses.com/api/v3",uYe="https://ark.cn-beijing.volces.com/api/v3/",dYe="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",fYe="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",hYe="dola-seed-2-1-turbo-260628",pYe="doubao-seed-2-1-pro-260628",mYe="skylark-embedding-vision-250615",gYe="doubao-embedding-vision-250615",bYe="seed-2-0-lite-260228",yYe="doubao-seed-2-0-lite-260428",vYe="dola-seedream-5-0-pro-260628",xYe="doubao-seedream-5-0-260128",wYe="seededit-3-0-i2i-250628",OYe="doubao-seededit-3-0-i2i-250628",kYe="dreamina-seedance-2-0-260128",SYe="doubao-seedance-2-0-260128";function Jc(e){return e==="byteplus"?[{value:C6,label:C6}]:[{value:"cn-beijing",label:z("cloudRegion.cnBeijing")},{value:"cn-shanghai",label:z("cloudRegion.cnShanghai")}]}function Ki(e){var t;return((t=Jc(e)[0])==null?void 0:t.value)||nU}const EYe=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function _I(e){return typeof e=="string"&&EYe.has(e)}function If(e,t){var i;return((i=(t?Jc(t):[...Jc("volcengine"),...Jc("byteplus")]).find(r=>r.value===e))==null?void 0:i.label)||e||"-"}function lp(e){return e==="byteplus"?hYe:pYe}function va(e){return e==="byteplus"?cYe:uYe}function CYe(e){return e==="byteplus"?dYe:fYe}function TYe(e){return e==="byteplus"?mYe:gYe}function AYe(e){return e==="byteplus"?bYe:yYe}function _Ye(e){return e==="byteplus"?vYe:xYe}function jYe(e){return e==="byteplus"?wYe:OYe}function NYe(e){return e==="byteplus"?kYe:SYe}const iU="veadk.messageFeedback.v1";function rU(e,t,n,i){return[e,t,n,i].join(":")}function sU(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(iU)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function RYe(e,t,n){if(typeof window>"u")return;const i=sU();i[e]={...i[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(iU,JSON.stringify(i))}function GSe(e){if(typeof window>"u")return;const t=rU(e.runtimeId,e.appName,e.userId,e.sessionId),n=sU(),i=n[t];if(i){for(const r of e.eventIds)delete i[`veadk_feedback:${r}`];Object.keys(i).length===0?delete n[t]:n[t]=i,localStorage.setItem(iU,JSON.stringify(n))}}const O_="",oU=new Map;function XSe(e,t){oU.set(e,t)}function YSe(){oU.clear()}function fc(e){const t=oU.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function $t(e,t={},n={},i=Ba){const r=Ua(t.signal,i),s=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",o={...t,...s?{method:"POST"}:{},headers:Pl(uu(t.headers))},l=()=>{const d={...o,signal:r};if(n.runtimeId){const f=new URLSearchParams;n.region&&f.set("_runtime_region",n.region),n.retryProbe&&f.set("probe_retry","connect"),s&&f.set("_method","DELETE");const h=f.toString()?`${e.includes("?")?"&":"?"}${f.toString()}`:"";return fetch(Zo(`${O_}/web/runtime-proxy/${n.runtimeId}${e}${h}`),d)}if(n.base){const f=new Headers(d.headers);return f.set("X-AgentKit-Base",n.base),n.apiKey&&f.set("X-AgentKit-Key",n.apiKey),fetch(Zo(`${O_}/agentkit-proxy${e}`),{...d,headers:f})}return fetch(Zo(`${O_}${e}`),d)},c=async d=>{if(UXe(d))return!0;if(d.status!==401)return!1;try{return await MXe()}catch{return!1}};let u=await l();for(;await c(u);)await QXe(r),u=await l();return u}function gn(e,t={},n=Ba){return $t(e,t,{},n)}function IYe(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const i=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",r=String(t.msg??"");return i?`${i}: ${r}`:r}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function fn(e,t){const n=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status}),i=await e.text().catch(()=>"");if(!i)return n;try{const r=JSON.parse(i),s=IYe(r.detail??r.error);return s?z("client.errorWithDetailAndRawResponse",{context:n,detail:s,response:i}):z("client.errorWithRawResponse",{context:n,response:i})}catch{return z("client.errorWithRawResponse",{context:n,response:i})}}async function aU(e,t=!1){const n=await $t(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,z("client.loadArkApiKeysFailed")));return await n.json()}async function ZSe(e,t){const n=await $t(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,z("client.loadArkApiKeysFailed")));return await n.json()}async function Mw(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true"),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),i=await $t(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.loadModelsFailed")));return await i.json()}async function JSe(){const e=await $t("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Lw extends Error{constructor(){super(z("client.runtimeAccessDenied")),this.name="RuntimeAccessDeniedError"}}class co extends Error{constructor(t,n=!1,i=!1){super(t),this.unsupported=n,this.retryable=i,this.name="RuntimeProbeError"}}const eEe=()=>z("client.privateRuntimeUnavailable"),tEe=()=>z("client.runtimeTemporarilyUnavailable"),MX=["cn-beijing","cn-shanghai"],PYe=3e4,$w=5*60*1e3,nEe=60*1e3;let IS="volcengine";const Zv=new Map,pb=new Map,mb=new Map,bd=new Map,Br=new Map;function lU(e,t,n){return`${t}:${e}:${n??""}`}function iEe(e){e!==IS&&Br.clear(),IS=e}function uC(e){const t=(e||"").trim();if(IS==="byteplus")return[t&&!t.startsWith("cn-")?t:C6];const n=t&&!t.startsWith("ap-")?t:nU;return MX.includes(n)?[n,...MX.filter(i=>i!==n)]:[n]}function jI(e){const t=(e||"").trim();return t?[t]:uC()}function Uy(...e){return e.map(t=>String(t??"")).join("")}function Tg(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function cU(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}function fA(e,t){return t?t.aborted?Promise.reject(new DOMException("The operation was aborted.","AbortError")):new Promise((n,i)=>{const r=()=>{i(new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",r,{once:!0}),e.then(s=>{t.removeEventListener("abort",r),n(s)},s=>{t.removeEventListener("abort",r),i(s)})}):e}async function rEe(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function dC(e,t,n,i,r=Ba){const s=await $t("/list-apps",{signal:i},n??{base:e,apiKey:t},r),o=n!=null&&n.runtimeId?await rEe(s):"";if(n!=null&&n.runtimeId&&o==="runtime_access_denied")throw new Lw;if(n!=null&&n.runtimeId&&o==="runtime_private_endpoint_unreachable")throw new co(eEe());if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(o))throw new co(tEe(),!1,!0);if(n!=null&&n.runtimeId&&s.status===404)throw new co(z("client.runtimeConnectionUnsupported"),!0,!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new co(z("client.runtimeConnectionDenied"));if(!s.ok)throw new Error(await fn(s,z("client.listAgentsFailed")));let l;try{l=await s.json()}catch{throw new co(z("client.invalidListAppsJson"))}if(!Array.isArray(l)||l.some(u=>typeof u!="string"||!u.trim()))throw new co(z("client.invalidListAppsFormat"));const c=l.map(u=>u.trim());return n!=null&&n.runtimeId&&Zv.set(lU(n.runtimeId,n.region??"",n.runtimeVersion),{apps:c,expiresAt:Date.now()+PYe}),c}async function sEe(e,t){const{app:n,ep:i}=fc(e),r=await $t(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!r.ok){const o=z("client.createSessionFailedWithStatus",{status:r.status}),l=await fn(r,z("client.createSessionFailed"));throw new Error(l===o?o:z("common.fallbackWithDetail",{fallback:o,detail:l}))}return(await r.json()).id}async function uU(e,t){const{app:n,ep:i}=fc(e),r=await $t(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!r.ok)throw new Error(`list sessions failed: ${r.status}`);return r.json()}async function NI(e,t,n){const{app:i,ep:r}=fc(e),s=await $t(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},r);if(!s.ok){const l=await fn(s,z("client.getSessionFailed"));throw new Error(z("client.getSessionFailedWithDetail",{status:s.status,detail:l}))}const o=await s.json();if(r.runtimeId){const l=rU(r.runtimeId,i,t,n);o.state={...sU()[l]??{},...o.state??{}}}return o}async function oEe(e){const{app:t,ep:n}=fc(e.appName);if(!n.runtimeId)throw new Error(z("client.feedbackRuntimeOnly"));if(!n.region)throw new Error(z("client.feedbackRegionMissing"));const i=await $t("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},xr);if(!i.ok)throw new Error(await fn(i,z("client.submitFeedbackFailed")));const r=await i.json(),s=rU(n.runtimeId,t,e.userId,e.sessionId);return RYe(s,e.eventId,r),r}async function RI(e,t={}){const n=Uy(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=Tg(bd,n,nEe);if(!t.force&&i)return i;const r=bd.get(n);if(!t.force&&(r!=null&&r.promise))return r.promise;let s=null;const o=(async()=>{for(const l of jI(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await $t(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return cU(bd,n,await u.json());s=new Error(await fn(u,z("client.loadEvaluationSetsFailed")))}throw s??new Error(z("client.loadEvaluationSetsFailed"))})();bd.set(n,{...r,promise:o,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await o}finally{const l=bd.get(n);(l==null?void 0:l.promise)===o&&bd.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function T6(e){let t=null;for(const n of jI(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),r=await $t(`/web/evaluation/statuses?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,z("client.loadAutoEvaluationStatusFailed")))}throw t??new Error(z("client.loadAutoEvaluationStatusFailed"))}async function aEe(e){let t=null;for(const n of jI(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),r=await $t(`/web/evaluation/optimizations?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,z("client.loadOptimizationsFailed")))}throw t??new Error(z("client.loadOptimizationsFailed"))}function lEe(e){return Tg(bd,Uy(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),nEe)}function DYe(e){RI(e).catch(()=>{})}function cEe(e){RI(e,{force:!0}).catch(()=>{})}function uEe(e,t){return["good","bad"].map(n=>{const i=e.find(r=>r.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(r=>r.kind===n).length}})}function k_(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[i,r]of bd.entries()){const s=r.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const o=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),l=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...o]:o;bd.set(i,{value:{...s,sets:uEe(s.sets,l),items:l},updatedAt:Date.now(),promise:r.promise})}}async function dEe(e){let t=null;for(const n of jI(e.region)){const i=await $t("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},xr);if(i.ok){const r=await i.json(),s=new Set(e.itemIds);for(const[o,l]of bd.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));bd.set(o,{value:{...c,sets:uEe(c.sets,u),items:u},updatedAt:Date.now()})}return r}t=new Error(await fn(i,z("client.deleteEvaluationCaseFailed")))}throw t??new Error(z("client.deleteEvaluationCaseFailed"))}async function A6(e,t,n){const{app:i,ep:r}=fc(e),s=await $t(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},r);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function MYe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),r=new Uint8Array(i.length);for(let s=0;sURL.revokeObjectURL(l),0)}async function fEe(e,t,n,i,r){const{app:s,ep:o}=fc(e),l=r==null?"":`?version=${encodeURIComponent(r)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${l}`,u=await $t(c,{},o,xr);if(!u.ok)throw new Error(await fn(u,z("client.downloadFileFailed")));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error(z("client.fileUnavailable"));const h=MYe(f.data),m=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([m],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??i}}async function fU(e,t,n,i,r){const{blob:s}=await fEe(e,t,n,i,r);return URL.createObjectURL(s)}async function LYe(e){const t=await $t("/web/media/capabilities");if(!t.ok)throw new Error(await fn(t,"media capabilities failed"));return t.json()}async function hEe(e,t,n,i){const{app:r}=fc(e),s=new FormData;s.set("app_name",r),s.set("user_id",t),s.set("session_id",n),s.set("file",i);const o=await $t("/web/media",{method:"POST",body:s},{},xr);if(!o.ok)throw new Error(await fn(o,z("client.uploadFileFailed")));return{...await o.json(),status:"ready"}}async function _6(e,t,n){const{app:i}=fc(e),r=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await $t(r,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await fn(s,"media cleanup failed"))}function pEe(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((i,r)=>![1,3,5].includes(r)).join("/")}`}catch{return}}async function S_(e,t){const n=pEe(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await $t(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await fn(i,"media cleanup failed"))}function mEe(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=pEe(t);if(!n)return t;const i=`${n}/content`;return Zo(`${O_}${i}`)}async function lN(e,t,n){const{app:i,ep:r}=fc(e);let s;if(r.runtimeId){const c=new URLSearchParams({runtimeId:r.runtimeId,sessionId:t,region:r.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await $t(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error(z("client.traceDisabled"))}else s=await $t(`/dev/apps/${encodeURIComponent(i)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(await fn(s,z("client.loadTraceFailed")));const o=s.headers.get("content-type")??"";if(!o.includes("application/json")){const c=o.split(";",1)[0]||z("client.contentTypeMissing");throw new Error(z("client.traceNonJson",{contentType:c}))}const l=await s.json();if(!Array.isArray(l))throw new Error(z("client.invalidTraceFormat"));return l}async function j6(e){const t=await $t("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,z("client.submitIssueFeedbackFailed")));if((await t.json()).submitted!==!0)throw new Error(z("client.issueFeedbackNotConfirmed"));return{submitted:!0}}async function gEe(e,t,n=!0){const i=await $t(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const r=await i.json();if(n&&!r.draft)try{const s=await $t(`/web/agent-draft/${e}`,{},t);if(s.ok){const o=await s.json();r.draft=o.draft}}catch{}return{appName:e,name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function N6(e){const{app:t,ep:n}=fc(e);return gEe(t,n,!1)}async function $Ye(e,t,n){let i=null;for(const r of uC(t)){const s={runtimeId:e,region:r};try{const o=lU(e,r),l=Zv.get(o);l&&l.expiresAt<=Date.now()&&Zv.delete(o);const c=Zv.get(o),u=n||(c==null?void 0:c.apps[0])||(await dC("","",s))[0];if(!u)throw new Error(z("client.noPreviewableAgent"));return gEe(u,s)}catch(o){if(o instanceof Lw||o instanceof co&&!o.unsupported)throw o;i=o instanceof Error?o:new Error(String(o))}}throw i??new Error(z("client.noPreviewableAgent"))}async function hU(e,t,n={},i={}){const r=typeof n=="string"?n:void 0,s=typeof n=="string"?i:n,o=Uy(e,t||"cn-beijing",r??""),l=Tg(pb,o,$w);if(!s.force&&l)return l;const c=pb.get(o);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=$Ye(e,t,r).then(d=>cU(pb,o,d));pb.set(o,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=pb.get(o);(d==null?void 0:d.promise)===u&&pb.set(o,{value:d.value,updatedAt:d.updatedAt})}}function bEe(e,t,n=""){return Tg(pb,Uy(e,t||"cn-beijing",n),$w)}function yEe(e,t,n=""){hU(e,t,n).catch(()=>{})}async function vEe(e,t,n,i){const{app:r,ep:s}=fc(e),o=new URLSearchParams({source:t,app_name:r,q:n,user_id:i}),l=await $t(`/web/search?${o.toString()}`,{},s);if(!l.ok)throw new Error(await fn(l,z("client.agentSearchFailed")));return l.json()}async function xEe(e,t){const{app:n}=fc(e),i=await $t(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}function wEe(){return om(z("client.emptySseBody"))}function E_(){return om(z("client.noDisplayableSseReply"))}const FYe=6e4;function zx(){return z("client.firstSseEventTimeout")}function OEe(e){if(e!=null&&e.aborted)return{signal:e,clearDeadline:()=>{},cleanup:()=>{},timedOut:()=>!1};const t=new AbortController;let n=!1,i=!1;const r=()=>{i||(i=!0,clearTimeout(o))},s=()=>{t.signal.aborted||t.abort((e==null?void 0:e.reason)??new DOMException("Aborted","AbortError"))},o=setTimeout(()=>{i||t.signal.aborted||(n=!0,i=!0,t.abort(new Error(zx())))},FYe);return e==null||e.addEventListener("abort",s,{once:!0}),{signal:t.signal,clearDeadline:r,cleanup:()=>{r(),e==null||e.removeEventListener("abort",s)},timedOut:()=>n}}async function*R6({appName:e,userId:t,sessionId:n,text:i,attachments:r=[],invocation:s,platformTools:o,environmentMounts:l,environmentMount:c,functionResponses:u=[],signal:d,onRuntimeContext:f}){const{app:h,ep:m}=fc(e),g=r.flatMap(S=>S.status&&S.status!=="ready"?[]:S.uri?[{fileData:{mimeType:S.mimeType,fileUri:S.uri,displayName:S.name},partMetadata:{veadkMedia:{id:S.id,uri:S.uri,name:S.name,mimeType:S.mimeType,sizeBytes:S.sizeBytes}}}]:S.data?[{inlineData:{mimeType:S.mimeType,data:S.data,displayName:S.name}}]:[]),b=s&&(s.skills.length>0||s.targetAgent)?s:void 0,v=[...g,...u.map(S=>({functionResponse:{id:S.id,name:S.name,response:S.response}})),...i.trim()?[{text:i}]:[]];if(b&&v.length>0){const S=v[0],k=S.partMetadata;v[0]={...S,partMetadata:{...k,veadkInvocation:b}}}let y;const x=OEe(d);try{y=await $t("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:h,user_id:t,session_id:n,new_message:{role:"user",parts:v},streaming:!0,...o!==void 0?{platform_tools:[...o]}:{},...l!==void 0?{environment_mounts:[...l]}:c?{environment_mount:c}:{},custom_metadata:b?{veadkInvocation:b}:void 0}),signal:x.signal},m,0)}catch(S){throw x.cleanup(),x.timedOut()?new Error(zx()):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(om(S))}const w=JXe(y,m.runtimeId??"",m.region??"");if(w&&(f==null||f(w)),!y.ok){x.cleanup();const S=await fn(y,z("client.runSessionFailed"));throw new Error(om(z("client.runSseFailedWithDetail",{status:y.status,detail:S})))}let O=!1;try{for await(const S of AI(y)){O=!0,x.clearDeadline();const k=S;typeof k.error=="string"&&(k.error=om(k.error)),typeof k.errorMessage=="string"&&(k.errorMessage=om(k.errorMessage)),typeof k.error_message=="string"&&(k.error_message=om(k.error_message)),yield k}}catch(S){throw x.timedOut()?new Error(zx()):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(om(S))}finally{x.cleanup()}if(!O)throw new Error(wEe())}async function II(e,t){const n=new URLSearchParams({name:e,region:t}),i=await $t(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.checkRuntimeNameFailed")));const r=await i.json();if(typeof r.available!="boolean")throw new Error(z("client.invalidRuntimeNameCheck"));return{available:r.available}}async function kEe(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const i=await $t(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!i.ok)throw new Error(await fn(i,z("client.loadCloudResourcesFailed")));const r=await i.json();if(typeof r.serviceRegion!="string"||!Array.isArray(r.items)||typeof r.pageNumber!="number"||typeof r.pageSize!="number"||typeof r.totalCount!="number"||typeof r.hasMore!="boolean")throw new Error(z("client.invalidCloudResources"));const s=r.items.map(o=>{if(!o||typeof o!="object"||typeof o.id!="string"||typeof o.name!="string"||typeof o.region!="string"||typeof o.status!="string")throw new Error(z("client.invalidCloudResources"));return o});return{serviceRegion:r.serviceRegion,items:s,pageNumber:r.pageNumber,pageSize:r.pageSize,totalCount:r.totalCount,hasMore:r.hasMore}}function SEe(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.mounts))throw new Error(z("client.invalidEnvironmentMount"));if(n.mounts.length!==t.length)throw new Error(z("client.environmentMountMismatch"));return n.mounts.map((i,r)=>{const s=t[r];if(!i||typeof i!="object"||typeof i.environment_id!="string"||typeof i.environment_version_id!="string"||typeof i.mount_instance_id!="string"||typeof i.sandbox_session_id!="string"||!i.environment_id||!i.environment_version_id||!i.mount_instance_id||!i.sandbox_session_id)throw new Error(z("client.invalidEnvironmentMount"));if(i.environment_id!==s.environment_id||i.environment_version_id!==s.environment_version_id||s.mount_instance_id!==void 0&&i.mount_instance_id!==s.mount_instance_id)throw new Error(z("client.environmentMountMismatch"));return i})}async function EEe({runtimeId:e,appName:t,userId:n,sessionId:i,environmentMounts:r}){const{app:s}=fc(t);let o;try{o=await $t("/web/v3/session-environment-mounts/prepare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtime_id:e,app_name:s,user_id:n,session_id:i,environment_mounts:[...r]})})}catch(l){throw l instanceof TypeError?new Error(z("client.environmentMountNetworkFailed")):l}if(!o.ok)throw new Error(await fn(o,z("client.environmentMountFailed")));return SEe(await o.json(),r)}function pU(e){const t=new Set,n=[];for(const i of e.split(/[,,\n\r]+/)){const r=i.trim();!r||t.has(r)||(t.add(r),n.push(r))}return n}async function CEe(e,t=typeof navigator>"u"?void 0:navigator.clipboard){if(!(t!=null&&t.writeText))throw new Error(z("client.clipboardUnsupported"));try{await t.writeText(e)}catch{throw new Error(z("client.clipboardWriteFailed"))}}const LX={codex:0,codex_snapshot:1,deepseek_harness:2,deepseek_harness_snapshot:3,openclaw:4,openclaw_snapshot:5,hermes:6,hermes_snapshot:7,dev:8};async function TEe(e){var r;const t=await $t("/web/system-info",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadSystemInfoFailed")));const n=await t.json();if(typeof((r=n.storage)==null?void 0:r.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error(z("client.invalidSystemInfo"));const i=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean"||typeof s.needsModelEnvUpdate!="boolean"||typeof s.canUpdateModelEnv!="boolean"||typeof s.modelEnvError!="string"||typeof s.modelEnvErrorCode!="string")throw new Error(z("client.invalidSystemInfo"));return s}).sort((s,o)=>(LX[s.kind]??Number.MAX_SAFE_INTEGER)-(LX[o.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:i}}const AEe=new Set(["preparing","queued","building","scanning","available","failed"]);function mU(e){if(e===null)return null;if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentBuild"));const t=e;if(typeof t.versionId!="string"||!AEe.has(t.status)||typeof t.image!="string"||typeof t.error!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.resources!==null&&typeof t.resources!="object")throw new Error(z("client.invalidEnvironmentBuild"));const n=Array.isArray(t.steps)?t.steps.map(i=>{if(!i||typeof i!="object"||typeof i.key!="string"||typeof i.label!="string"||!["pending","running","succeeded","failed"].includes(i.status)||i.startedAt!==null&&typeof i.startedAt!="string"||i.finishedAt!==null&&typeof i.finishedAt!="string")throw new Error(z("client.invalidEnvironmentBuildStep"));return i}):[];return{...t,toolId:typeof t.toolId=="string"?t.toolId:"",toolStatus:["creating","ready","failed"].includes(t.toolStatus)?t.toolStatus:"",runId:typeof t.runId=="string"?t.runId:"",currentStep:typeof t.currentStep=="string"?t.currentStep:"",sourceCommitSha:typeof t.sourceCommitSha=="string"?t.sourceCommitSha:"",steps:n,progressError:typeof t.progressError=="string"?t.progressError:"",logTail:typeof t.logTail=="string"?t.logTail:"",logTruncated:t.logTruncated===!0,logUpdatedAt:typeof t.logUpdatedAt=="string"?t.logUpdatedAt:null,logError:typeof t.logError=="string"?t.logError:""}}function _Ee(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentManifest"));const t=e;if(!["agentkit.studio/v3","agentkit.studio/v1alpha1"].includes(t.apiVersion)||t.kind!=="Environment"||!t.metadata||typeof t.metadata.id!="string"||typeof t.metadata.name!="string"||typeof t.metadata.version!="string"||typeof t.metadata.description!="string"||!t.spec||typeof t.spec.image!="string"||!["ubuntu","aio-sandbox","codex-sandbox"].includes(t.spec.baseEnvironment)||typeof t.spec.baseImage!="string"||!["ubuntu-22.04","ubuntu-24.04"].includes(t.spec.operatingSystem)||!["python-3.10","python-3.12"].includes(t.spec.language)||t.spec.executionRuntime!=="veadk"||!Array.isArray(t.spec.packages)||!t.spec.packages.every(n=>typeof n=="string")||!Array.isArray(t.spec.capabilities)||!t.spec.capabilities.every(n=>typeof n=="string")||!Array.isArray(t.spec.skills)||!t.status||!AEe.has(t.status.phase)||typeof t.status.createdAt!="string"||typeof t.status.updatedAt!="string")throw new Error(z("client.invalidEnvironmentManifest"));return t}function jEe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error(z("client.invalidImageRepository"));const t=e;if(typeof t.region!="string"||typeof t.registry!="string"||typeof t.namespace!="string"||typeof t.repository!="string")throw new Error(z("client.invalidImageRepository"));return t}function BYe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error(z("client.invalidCodeRepository"));const t=e;if(typeof t.repositoryUrl!="string"||t.ref!==void 0&&typeof t.ref!="string"||typeof t.dockerfilePath!="string")throw new Error(z("client.invalidCodeRepository"));return t}function UYe(e){const t=jEe(e);if(!t)return;const n=e;if(typeof n.reference!="string")throw new Error(z("client.invalidImageSource"));return{...t,reference:n.reference}}function gU(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironment"));const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||t.baseEnvironment!==void 0&&t.baseEnvironment!=="ubuntu"&&t.baseEnvironment!=="aio-sandbox"&&t.baseEnvironment!=="codex-sandbox"||t.operatingSystem!=="ubuntu-22.04"&&t.operatingSystem!=="ubuntu-24.04"||t.language!=="python-3.10"&&t.language!=="python-3.12"||!Array.isArray(t.optionIds)||!t.optionIds.every(n=>typeof n=="string")||t.selectedSkills!==void 0&&!Array.isArray(t.selectedSkills)||typeof t.dockerfile!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error(z("client.invalidEnvironment"));return{...t,baseEnvironment:t.baseEnvironment==="aio-sandbox"?"aio-sandbox":t.baseEnvironment==="codex-sandbox"?"codex-sandbox":"ubuntu",selectedSkills:t.selectedSkills??[],gitSource:BYe(t.gitSource),containerRepository:jEe(t.containerRepository),imageSource:UYe(t.imageSource),latestVersion:mU(t.latestVersion)}}function NEe(e){if(!e||typeof e!="object")throw new Error(z("client.invalidWorkspace"));const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||!Array.isArray(t.environmentIds)||!t.environmentIds.every(n=>typeof n=="string")||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error(z("client.invalidWorkspace"));return t}async function bU(e){const t=await $t("/web/workspaces",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadWorkspacesFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidWorkspaceList"));return n.items.map(NEe)}async function REe(e,t,n,i){const r=await $t(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});if(!r.ok)throw new Error(await fn(r,z("client.saveWorkspaceFailed")));return NEe(await r.json())}function IEe(e,t){return REe("/web/workspaces","POST",e,t)}function PEe(e,t,n){return REe(`/web/workspaces/${encodeURIComponent(e)}`,"PATCH",t,n)}async function DEe(e,t){const n=await $t(`/web/workspaces/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.deleteWorkspaceFailed")))}async function fC(e){const t=await $t("/web/v3/environments",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadEnvironmentsFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidEnvironmentList"));return n.items.map(gU)}async function MEe(e,t){const n=await $t("/web/v3/environment-repositories/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.probeRepositoryFailed")));const i=await n.json();if(typeof i.repositoryUrl!="string"||typeof i.ref!="string"||typeof i.commitSha!="string"||!Array.isArray(i.dockerfiles)||!i.dockerfiles.every(r=>typeof r=="string"))throw new Error(z("client.invalidRepositoryProbe"));return i}async function LEe(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}/share-code`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.exportEnvironmentCodeFailed")));const i=await n.json();if(typeof i.shareCode!="string"||typeof i.name!="string")throw new Error(z("client.invalidEnvironmentCode"));return i}async function $Ee(e,t){const n=await $t("/web/v3/environment-share-codes/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.inspectEnvironmentCodeFailed")));const i=await n.json();if(!Array.isArray(i.items))throw new Error(z("client.invalidEnvironmentCodeInspection"));return i.items.map(r=>{if(!r||typeof r!="object")throw new Error(z("client.invalidEnvironmentCodeInspection"));const s=r,o=s.status==="valid"||s.valid===!0?"valid":s.status==="invalid"||s.valid===!1?"invalid":null;if(!Number.isInteger(s.index)||o===null||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error(z("client.invalidEnvironmentCodeInspection"));return{index:s.index,status:o,name:s.name??"",error:s.error??""}})}async function FEe(e,t){const n=await $t("/web/v3/environment-share-codes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.importEnvironmentCodeFailed")));const i=await n.json();if(!Array.isArray(i.items))throw new Error(z("client.invalidEnvironmentCodeImport"));return i.items.map(r=>{if(!r||typeof r!="object")throw new Error(z("client.invalidEnvironmentCodeImport"));const s=r;if(!Number.isInteger(s.index)||!(s.status==="created"||s.status==="duplicate"||s.status==="failed")||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error(z("client.invalidEnvironmentCodeImport"));return{index:s.index,status:s.status,name:s.name??"",environment:s.environment===void 0||s.environment===null?void 0:gU(s.environment),error:s.error??""}})}async function BEe(e,t,n,i){let r;try{r=await $t(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i})}catch(s){throw s instanceof DOMException&&s.name==="AbortError"?s:s instanceof TypeError?new Error(z("client.studioUnavailable")):s}if(!r.ok)throw new Error(await fn(r,z("client.saveEnvironmentFailed")));return gU(await r.json())}function UEe(e,t){return BEe("/web/v3/environments","POST",e,t)}function QEe(e,t,n){return BEe(`/web/v3/environments/${encodeURIComponent(e)}`,"PATCH",t,n)}async function zEe(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.deleteEnvironmentFailed")))}async function I6(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}/build`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.startEnvironmentBuildFailed")));const i=mU(await n.json());if(!i)throw new Error(z("client.invalidEnvironmentBuild"));return i}async function VEe(e,t,n={}){const i=n.includeLogs?"?includeLogs=true":"",r=await $t(`/web/v3/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}${i}`,{signal:n.signal});if(!r.ok)throw new Error(await fn(r,z("client.loadEnvironmentBuildFailed")));const s=mU(await r.json());if(!s)throw new Error(z("client.invalidEnvironmentBuild"));return s}async function HEe(e,t,n){const i=await $t(`/web/v3/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}/manifest`,{signal:n});if(!i.ok)throw new Error(await fn(i,z("client.loadEnvironmentManifestFailed")));return _Ee(await i.json())}function $X(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentResource"));const t=e;if(t.source!=="provided"&&t.source!=="managed"||typeof t.consoleUrl!="string")throw new Error(z("client.invalidEnvironmentResource"));return t}async function qEe(e){const t=await $t("/web/v3/environment-resources",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadEnvironmentResourcesFailed")));const n=await t.json();if(n.provider!=="volcengine"&&n.provider!=="byteplus"||typeof n.region!="string")throw new Error(z("client.invalidEnvironmentResource"));return{provider:n.provider,region:n.region,codePipeline:$X(n.codePipeline),containerRegistry:$X(n.containerRegistry)}}async function QYe(e,t){const n=await $t(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/model-env`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.updateCodexSandboxFailed")));const i=await n.json();if(i.kind!=="codex"&&i.kind!=="codex_snapshot"||typeof i.toolId!="string"||typeof i.updated!="boolean")throw new Error(z("client.invalidCodexSandboxUpdate"));return i}async function PI(e){const t=await $t("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadUserPoolsFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidUserPoolList"));return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error(z("client.invalidUserPoolList"));return i})}class FX extends Error{constructor(t,n){super(n),this.status=t,this.name="DeploymentRecoveryHttpError"}}const Ik=new Map;function zYe(e){if(typeof e=="string")return e?{message:e}:null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.message=="string"?t.message:typeof t.error=="string"?t.error:"";return n?{message:n,phase:typeof t.phase=="string"?t.phase:void 0,runtimeId:typeof t.runtimeId=="string"?t.runtimeId:void 0,logPath:typeof t.logPath=="string"?t.logPath:void 0}:null}class Pk extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function Op(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),i=zYe(n.detail??n.error);if(i)return new Pk(i)}catch{return new Pk({message:t})}return new Pk({message:z("client.syncGithubFailed",{status:e.status})})}async function WEe(e){const t=await $t("/web/github-delivery/source-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,region:e.region,cloudProvider:e.cloudProvider})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function KEe(e){const t=await $t("/web/github-delivery/cicd-pipeline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function GEe(e){const t=await $t("/web/github-delivery/init-main",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function VYe(e){const t=await $t("/web/github-delivery/source-sync/cicd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipelineId:e.pipelineId,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function XEe(e){const t=await $t(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await Op(t);const n=await t.json();return n.pipelineId?n:null}async function C_(e){const t=await $t(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await Op(t);return t.json()}async function YEe(e){const t=await $t("/web/github-delivery/rollback-pr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Op(t);return t.json()}async function yU(e){const t=await $t("/web/github-cicd/runtime-binding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Op(t);return t.json()}async function ZEe(e){const t=await $t("/web/github-cicd/runtime-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,project:e.project})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function Qy(e,t,n,i){var h,m,g,b,v;const r=i==null?void 0:i.taskId,s=r?new AbortController:void 0;r&&s&&Ik.set(r,s);const o=()=>{r&&Ik.get(r)===s&&Ik.delete(r)},l=async y=>{if(KSe(y))throw y;if(!r||!(i!=null&&i.runtimeId)||typeof i.baseRuntimeVersion!="number")throw new w_({taskId:r,cause:y});const x=await lYe({signal:s==null?void 0:s.signal,shouldRetry:w=>!(w instanceof FX)||w.status===404||w.status===408||w.status===429||w.status>=500,load:async w=>{const O=await $t("/web/deploy-agentkit/status",{method:"POST",headers:{"Content-Type":"application/json"},signal:w,body:JSON.stringify({taskId:r,runtimeId:i.runtimeId,runtimeName:i.runtimeName,appName:i.appName??e,region:n.region,projectName:n.projectName,baseRuntimeVersion:i.baseRuntimeVersion})},{},3e4);if(!O.ok)throw new FX(O.status,await fn(O,z("client.deploymentFailed")));return O.json()}});if(!x)throw new w_({taskId:r,cause:y});return x};let c=null,u=null;try{const y=!!(i!=null&&i.migrationTaskId);(h=i==null?void 0:i.onStage)==null||h.call(i,{level:"info",phase:"upload",message:z(y?"client.validatingMigrationArtifact":"client.uploadingCodePackage"),pct:0}),c=await $t("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:r,migrationTaskId:i==null?void 0:i.migrationTaskId,runtimeId:i==null?void 0:i.runtimeId,runtimeName:i==null?void 0:i.runtimeName,appName:i==null?void 0:i.appName,editMode:i==null?void 0:i.editMode,draft:i==null?void 0:i.draft,updateEtag:i==null?void 0:i.updateEtag,baseRuntimeVersion:i==null?void 0:i.baseRuntimeVersion,removeRuntimeEnvKeys:i==null?void 0:i.removeRuntimeEnvKeys,mcpSecretValues:i==null?void 0:i.mcpSecretValues,mcpCredentialReuses:i==null?void 0:i.mcpCredentialReuses,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:oYe((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs,resources:i==null?void 0:i.resources,source:(i==null?void 0:i.source)??(i!=null&&i.migrationTaskId?{kind:"migration",migrationId:i.migrationTaskId}:{kind:"inlineFiles"}),harnessSidecar:i==null?void 0:i.harnessSidecar,environment:i==null?void 0:i.environment})},{},0),(m=i==null?void 0:i.onStage)==null||m.call(i,{level:"success",phase:"upload",message:z(y?"client.migrationArtifactValidated":"client.codePackageUploaded"),pct:100})}catch(y){try{u=await l(y)}finally{o()}}if(c&&!c.ok){const y=await fn(c,z("client.deploymentFailed"));throw o(),new Error(y)}if(c)try{for await(const y of AI(c)){const x=y;if(x&&x.done){u=x;break}x&&x.message&&((g=i==null?void 0:i.onStage)==null||g.call(i,x))}}catch(y){try{u=await l(y)}finally{o()}}if(u)o();else try{u=await l()}finally{o()}if(!u.success){const y=new Error(u.error||z("client.deploymentFailed"));throw WSe(y)?new w_({taskId:r,cause:y}):y}if(!u.agentName)throw new Error(z("client.deploymentMissingAgentName"));if(!u.runtimeId&&!u.url)throw new Error(z("client.deploymentMissingConnection"));const d=(b=u.runtimeName)!=null&&b.trim()?u.agentName:e,f=((v=u.runtimeName)==null?void 0:v.trim())||u.agentName;return{apikey:u.apikey??"",url:u.url??"",agentName:d,runtimeName:f,runtimeId:u.runtimeId,consoleUrl:u.consoleUrl,region:u.region,version:u.version,warnings:u.warnings,feishuChannel:u.feishuChannel}}async function JEe(e){var n;const t=await $t("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||z("client.cancelDeploymentFailed",{status:t.status}))}(n=Ik.get(e))==null||n.abort(),Ik.delete(e)}async function HYe(e=nU){const t=await $t(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(z("client.loadFailed",{status:t.status}));return(await t.json()).runtimes??[]}const PS={title:"AgentKit Studio",logoUrl:""},P6={enabled:!1},TL={studio:!1,version:"",provider:"volcengine",branding:PS,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:P6};function qYe(e){if(!e||typeof e!="object")return P6;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return P6;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:"",accountIdResolutionError:typeof n.accountIdResolutionError=="string"?n.accountIdResolutionError:""}}}async function eCe(){var e,t;try{const n=await $t("/web/ui-config");if(!n.ok)return TL;const i=await n.json(),r=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:PS.logoUrl,s=i.provider==="byteplus"?"byteplus":"volcengine";return iEe(s),{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",provider:s,branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:PS.title,logoUrl:r?Zo(r):""},features:{...TL.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local",telemetry:qYe(i.telemetry)}}catch{return TL}}const tCe={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,createPersonalAgents:!1,manageAgents:!1,runtimeScope:"mine",manageUsers:!1}};async function nCe(){var n,i,r,s,o,l;const e=await $t("/web/access");if(!e.ok)throw new Error(z("client.loadPermissionsFailed",{status:e.status}));const t=await e.json();if(!["super_admin","admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((i=t.capabilities)==null?void 0:i.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.createPersonalAgents)!="boolean"||typeof((s=t.capabilities)==null?void 0:s.manageAgents)!="boolean"||((o=t.capabilities)==null?void 0:o.manageUsers)!==void 0&&typeof t.capabilities.manageUsers!="boolean"||!["all","mine"].includes((l=t.capabilities)==null?void 0:l.runtimeScope))throw new Error(z("client.invalidPermissionResponse"));return t}async function iCe(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",r=await $t(`/web/studio-update${i}`);if(!r.ok)throw new Error(z("client.checkStudioUpdateFailed",{status:r.status}));return await r.json()}async function rCe(){const e=await $t("/web/studio-update/permissions");if(!e.ok){let t="";try{const n=await e.json();t=typeof n.detail=="string"?n.detail:""}catch{t=""}throw new Error(t||z("client.studioUpdatePreflightFailed",{status:e.status}))}return await e.json()}async function sCe(e){const t=await $t("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},xr);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||z("client.submitStudioUpdateFailed",{status:t.status}))}return await t.json()}async function oCe({runtimeId:e,region:t,appName:n,page:i=1,pageSize:r=20,signal:s}){const o=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(i),pageSize:String(r)}),l=await $t(`/web/agent-usage?${o.toString()}`,{signal:s});if(!l.ok)throw new Error(await fn(l,z("client.loadAgentUsageFailed")));const c=l.headers.get("content-type")||z("client.notProvided"),u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(z("client.agentUsageNonJson",{status:l.status,contentType:c})+z("client.checkStudioGateway"));try{return await l.json()}catch{throw new Error(z("client.agentUsageInvalidJson",{status:l.status,contentType:c})+z("client.retryCheckGateway"))}}function kp(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function D6(e){const t=await $t(kp(),{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadCronJobsFailed")));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function WYe(e,t){const n=await $t(kp(e),{signal:t});if(!n.ok)throw new Error(await fn(n,z("client.loadCronJobFailed")));return await n.json()}async function aCe(e){const t=await $t(kp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,z("client.createCronJobFailed")));return await t.json()}async function lCe(e,t){const n=await $t(`${kp(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await fn(n,z("client.updateCronJobFailed")));return await n.json()}async function cCe(e,t){const n=t?"enable":"disable",i=await $t(`${kp(e)}/${n}`,{method:"POST"});if(!i.ok)throw new Error(await fn(i,z(t?"client.enableCronJobFailed":"client.pauseCronJobFailed")));return await i.json()}async function uCe(e){const t=await $t(`${kp(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await fn(t,z("client.runCronJobFailed")));return await t.json()}async function M6(e,t){const n=await $t(`${kp(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await fn(n,z("client.loadCronHistoryFailed")));const i=await n.json();return Array.isArray(i)?i:i.items??[]}async function dCe(e,t){const n=await $t(`${kp(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await fn(n,z("client.stopCronRunFailed")));return await n.json()}async function fCe(e){const t=await $t(kp(e),{method:"DELETE"});if(!t.ok)throw new Error(await fn(t,z("client.deleteCronJobFailed")))}class vU extends Error{constructor(t,n){super(t),this.status=n,this.name="RuntimeListError"}}async function Fw(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await $t(`/web/runtimes?${t.toString()}`,{signal:e.signal});if(!n.ok){const r=await fn(n,z("client.loadRuntimeFailed"));throw new vU(r,n.status)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function Vx(e,t,n={}){if(n.preferCached){const i=lU(e,t,n.currentVersion),r=Zv.get(i);if(r&&r.expiresAt>Date.now())return[...r.apps];r&&Zv.delete(i)}try{const i={runtimeId:e,region:t,runtimeVersion:n.currentVersion};return n.retryProbe&&(i.retryProbe=!0),await dC("","",i,n.signal,n.timeoutMs)}catch(i){if(i instanceof Lw||i instanceof co||i instanceof Error)throw i;return null}}async function hCe(e,t){const n=new URLSearchParams({region:t}),i=await $t(`/web/runtime-tool-channel/${encodeURIComponent(e)}/capabilities?${n.toString()}`);if(!i.ok)throw new co(await fn(i,z("client.loadLocalToolsFailed")),!1,!0);return await i.json()}async function pCe(e,t){const n=new URLSearchParams({region:t}),i=await $t(`/web/runtime-route-channel/${encodeURIComponent(e)}/connect?${n.toString()}`,{method:"POST"});if(!i.ok)throw new co(await fn(i,z("client.connectDynamicRouteFailed")),!1,!0);return await i.json()}async function mCe(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const r=await $t("/.well-known/agent-card.json",{},i),s=await rEe(r);if(s==="runtime_access_denied")throw new Lw;if(s==="runtime_private_endpoint_unreachable")throw new co(eEe());if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new co(tEe());if(r.status===404)return null;if(r.status===401||r.status===403)throw new co(z("client.a2aProbeDenied"));if(!r.ok)throw new Error(await fn(r,z("client.loadA2aCardFailed")));const o=await r.json().catch(()=>null),l=typeof(o==null?void 0:o.url)=="string"?o.url.trim():"";return l?{name:typeof(o==null?void 0:o.name)=="string"?o.name:"",description:typeof(o==null?void 0:o.description)=="string"?o.description:"",endpoint:l}:null}async function gCe(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await $t(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.loadRuntimeApiKeyFailed")));const r=await i.json();if(typeof r.apiKey!="string"||!r.apiKey)throw new Error(z("client.runtimeApiKeyMissing"));return r.apiKey}async function bCe(e,t){const n=await $t("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||z("client.deleteFailed",{status:n.status}))}}async function yCe({runtimeId:e,region:t,appName:n,etag:i,signal:r}){const s=await $t("/web/runtime-mcp-credentials",{method:"POST",cache:"no-store",signal:r,headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t,appName:n,etag:i})});if(!s.ok)throw new Error(await fn(s,z("client.loadMcpCredentialsFailed")));const o=await s.json().catch(()=>null);if(!Array.isArray(o==null?void 0:o.credentials))throw new Error(z("client.invalidMcpCredentials"));return o.credentials.map(l=>{if(!l||typeof l!="object")throw new Error(z("client.invalidMcpCredentials"));const c=l,u={agentName:c.agentName,name:c.name,url:c.url,authTokenEnv:c.authTokenEnv,value:c.value};if(Object.values(u).some(d=>typeof d!="string"))throw new Error(z("client.invalidMcpCredentials"));return u})}function T_({runtimeId:e,region:t,appName:n,currentVersion:i}){return Uy(IS,t,e,i??"",(n==null?void 0:n.trim())??"")}async function KYe({runtimeId:e,region:t,appName:n,currentVersion:i,force:r=!1}){const s=new URLSearchParams({runtimeId:e,region:t});n&&s.set("appName",n),i!=null&&s.set("currentVersion",String(i)),r&&s.set("refresh","true");const o=await $t(`/web/runtime-update-capability?${s.toString()}`);if(!o.ok)throw new Error(await GYe(o));return await o.json()}function DI({runtimeId:e,region:t,appName:n,currentVersion:i,signal:r,force:s=!1}){var u,d;const o={runtimeId:e,region:t,appName:n,currentVersion:i},l=T_(o);if(s&&Br.delete(l),!s){const f=Tg(Br,l,$w);if(f)return fA(Promise.resolve(f),r);const h=(u=Br.get(l))==null?void 0:u.promise;if(h)return fA(h,r);if(n){const m=T_({...o,appName:""}),g=(d=Br.get(m))==null?void 0:d.promise;if(g){let b;return b=g.then(v=>{var x,w,O,S,k;if(v.recoveryStatus==="preparing")return((x=Br.get(l))==null?void 0:x.promise)===b&&Br.delete(l),v;const y=((O=(w=v.agent)==null?void 0:w.appName)==null?void 0:O.trim())??"";return y&&y!==n.trim()?(((S=Br.get(l))==null?void 0:S.promise)===b&&Br.delete(l),DI(o)):(((k=Br.get(l))==null?void 0:k.promise)===b&&Br.set(l,{value:v,updatedAt:Date.now()}),v)},v=>{var y;throw((y=Br.get(l))==null?void 0:y.promise)===b&&Br.delete(l),v}),Br.set(l,{promise:b,updatedAt:0}),fA(b,r)}}}let c;return c=KYe({...o,force:s}).then(f=>{var h,m,g,b,v;if(f.recoveryStatus==="preparing")return((h=Br.get(l))==null?void 0:h.promise)===c&&Br.delete(l),f;if(((m=Br.get(l))==null?void 0:m.promise)===c){Br.set(l,{value:f,updatedAt:Date.now()});const y=new Set(["",((b=(g=f.agent)==null?void 0:g.appName)==null?void 0:b.trim())??""]);for(const x of y){const w=T_({...o,appName:x});w!==l&&!((v=Br.get(w))!=null&&v.promise)&&Br.set(w,{value:f,updatedAt:Date.now()})}}return f},f=>{var h;throw((h=Br.get(l))==null?void 0:h.promise)===c&&Br.delete(l),f}),Br.set(l,{promise:c,updatedAt:0}),fA(c,r)}function L6({runtimeId:e,region:t,appName:n,currentVersion:i}){return Tg(Br,T_({runtimeId:e,region:t,appName:n,currentVersion:i}),$w)}function $6(e){return DI(e).then(()=>{},()=>{})}function F6(e,t){if(!e){Br.clear();return}for(const n of Br.keys()){const[i,r,s]=n.split("");i===IS&&s===e&&(!t||r===t)&&Br.delete(n)}}async function GYe(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?z("client.runtimeManageForbidden"):e.status===404?z(n==="runtime_not_found"?"client.runtimeNotFound":"client.runtimeUnavailable"):z("client.checkRuntimeUpdateFailed",{status:e.status})}async function XYe(e,t){let n=null;for(const i of uC(t)){const r=await $t(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(r.ok)return r.json();n=new Error(await fn(r,z("client.loadRuntimeDetailFailed")))}throw n??new Error(z("client.loadRuntimeDetailFailed"))}async function xU(e,t="cn-beijing",n={}){const i=Uy(e,t||"cn-beijing"),r=Tg(mb,i,$w);if(!n.force&&r)return r;const s=mb.get(i);if(!n.force&&(s!=null&&s.promise))return s.promise;const o=XYe(e,t).then(l=>cU(mb,i,l));mb.set(i,{...s,promise:o,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await o}finally{const l=mb.get(i);(l==null?void 0:l.promise)===o&&mb.set(i,{value:l.value,updatedAt:l.updatedAt})}}function vCe(e,t="cn-beijing"){return Tg(mb,Uy(e,t||"cn-beijing"),$w)}function xCe(e,t="cn-beijing"){xU(e,t).catch(()=>{})}async function Dk(e){const t=await $t("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await fn(t,z("client.generateProjectFailed")));return t.json()}const YYe=19e4,ZYe=12e4;async function wCe(e){const t=await $t("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},YYe);if(!t.ok)throw new Error(await fn(t,z("client.generateAgentConfigFailed")));return TI(t,z("client.generateAgentConfigFailed"))}async function OCe(e,t){const n=await $t("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region,mcpCredentialReuses:t==null?void 0:t.mcpCredentialReuses})},{},ZYe);if(!n.ok)throw new Error(await fn(n,z("client.createDebugRunFailed")));return TI(n,z("client.createDebugRunFailed"))}async function kCe(e,t){const n=await $t(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await fn(n,z("client.createDebugSessionFailed")));return(await TI(n,z("client.createDebugSessionFailed"))).id}async function SCe(e,t){const n=await $t(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await fn(n,z("client.loadDebugTraceFailed")));const i=await TI(n,z("client.loadDebugTraceFailed"));if(!Array.isArray(i))throw new Error(z("client.invalidDebugTrace"));return i}async function*ECe({runId:e,userId:t,sessionId:n,text:i,signal:r}){const s=i.trim()?[{text:i}]:[],o=OEe(r);let l;try{l=await $t(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:s},streaming:!0}),signal:o.signal},{},0)}catch(c){throw o.cleanup(),o.timedOut()?new Error(zx()):c}if(!l.ok)throw o.cleanup(),new Error(await fn(l,z("client.debugRunFailed")));try{for await(const c of AI(l))o.clearDeadline(),yield c}catch(c){throw o.timedOut()?new Error(zx()):c}finally{o.cleanup()}}async function rv(e){const t=await $t(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await fn(t,z("client.cleanupDebugRunFailed")))}function CCe(e){if(!e||typeof e!="object")throw new Error(z("client.invalidSandboxVersion"));const t=e;if(typeof t.toolId!="string"||typeof t.error!="string")throw new Error(z("client.invalidSandboxVersion"));if(!t.error&&(t.provider!=="volcengine"&&t.provider!=="byteplus"||typeof t.region!="string"||typeof t.status!="string"||typeof t.currentImage!="string"||typeof t.latestImage!="string"||typeof t.needsImageUpdate!="boolean"||typeof t.canUpdate!="boolean"||typeof t.needsModelEnvUpdate!="boolean"||typeof t.canUpdateModelEnv!="boolean"||typeof t.modelEnvError!="string"))throw new Error(z("client.invalidSandboxVersion"));return t}async function TCe(e){const t=await $t("/web/system-info/sandbox-tools/updates",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadSandboxVersionsFailed")));const n=await t.json();if(!Array.isArray(n.tools))throw new Error(z("client.invalidSandboxVersion"));return n.tools.map(CCe)}async function ACe(e){const t=await $t(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/update`,{method:"POST"},{},33e4);if(!t.ok)throw new Error(await fn(t,z("client.updateSandboxFailed")));const n=await t.json();if(typeof n.updated!="boolean")throw new Error(z("client.invalidSandboxUpdate"));return{updated:n.updated,state:CCe(n.state)}}const JYe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:PS,DEFAULT_STUDIO_ACCESS:tCe,GithubCicdPipelineError:Pk,RuntimeAccessDeniedError:Lw,RuntimeListError:vU,RuntimeProbeError:co,attachGithubDeliveryCicdToSourceSync:VYe,bindGithubCicdRuntime:yU,buildEnvironment:I6,cancelAgentkitDeployment:JEe,cancelCronJobRun:dCe,checkRuntimeNameAvailability:II,clearMessageFeedbackCache:GSe,clearRemoteApps:YSe,componentSearch:vEe,createCronJob:aCe,createEnvironment:UEe,createGeneratedAgentTestRun:OCe,createGeneratedAgentTestSession:kCe,createGithubCicdPipeline:WEe,createGithubDeliveryCicdPipeline:KEe,createGithubDeliveryRollbackPr:YEe,createSession:sEe,createWorkspace:IEe,deleteAgentFeedbackCases:dEe,deleteCronJob:fCe,deleteEnvironment:zEe,deleteGeneratedAgentTestRun:rv,deleteMedia:S_,deleteRuntime:bCe,deleteSession:A6,deleteSessionMedia:_6,deleteWorkspace:DEe,deployAgentkitProject:Qy,downloadArtifact:dU,ensureRuntimeRouteChannel:pCe,exportEnvironmentShareCode:LEe,fetchRemoteApps:dC,generateAgentDraftFromRequirement:wCe,generateAgentProject:Dk,getAgentFeedbackCases:RI,getAgentInfo:N6,getAgentOptimizations:aEe,getAgentUsage:oCe,getAutomaticEvaluationStatuses:T6,getCachedAgentFeedbackCases:lEe,getCachedRuntimeAgentInfo:bEe,getCachedRuntimeDetail:vCe,getCachedRuntimeUpdateCapability:L6,getCronJob:WYe,getEnvironmentBuild:VEe,getEnvironmentManifest:HEe,getEnvironmentResources:qEe,getGeneratedAgentTestTrace:SCe,getGithubCicdRuntimeBinding:XEe,getGithubDeliveryVersions:C_,getMediaCapabilities:LYe,getMyRuntimes:HYe,getRuntimeAgentInfo:hU,getRuntimeDetail:xU,getRuntimeMcpCredentials:yCe,getRuntimeStudioToolCapabilities:hCe,getRuntimeUpdateCapability:DI,getRuntimes:Fw,getSandboxImageUpdates:TCe,getSession:NI,getSessionTrace:lN,getStudioAccess:nCe,getStudioUpdatePermissions:rCe,getStudioUpdateStatus:iCe,getSystemInfo:TEe,getUiConfig:eCe,httpErrorMessage:fn,importEnvironmentShareCodes:FEe,initializeGithubDeliveryMain:GEe,inspectEnvironmentRepository:MEe,inspectEnvironmentShareCodes:$Ee,invalidateRuntimeUpdateCapabilityCache:F6,listApps:JSe,listCronJobRuns:M6,listCronJobs:D6,listDeploymentResources:kEe,listEnvironments:fC,listIdentityUserPools:PI,listModelApiKeys:aU,listModelOptions:Mw,listSessions:uU,listWorkspaces:bU,mediaContentUrl:mEe,parseEnvironmentManifest:_Ee,parseEnvironmentShareCodes:pU,parsePreparedSessionEnvironmentMounts:SEe,prefetchAgentFeedbackCases:DYe,prefetchRuntimeAgentInfo:yEe,prefetchRuntimeDetail:xCe,prefetchRuntimeUpdateCapability:$6,prepareSessionEnvironmentMounts:EEe,previewArtifact:fU,probeRuntimeA2a:mCe,probeRuntimeApps:Vx,refreshAgentFeedbackCases:cEe,registerRemoteApp:XSe,revealModelApiKey:ZSe,revealRuntimeApiKey:gCe,runCronJobNow:uCe,runGeneratedAgentTestSSE:ECe,runSSE:R6,runSseEmptyResponseError:wEe,runSseFirstEventTimeoutError:zx,runSseIncompleteResponseError:E_,runtimeRegionCandidates:uC,setClientCloudProvider:iEe,setCronJobEnabled:cCe,startStudioUpdate:sCe,studioFetch:gn,submitIssueFeedback:j6,submitMessageFeedback:oEe,syncGithubCicdRuntime:ZEe,updateCodexSandboxToolModelEnv:QYe,updateCronJob:lCe,updateEnvironment:QEe,updateSandboxTool:ACe,updateWorkspace:PEe,uploadMedia:hEe,upsertCachedAgentFeedbackCase:k_,webSearch:xEe,writeEnvironmentShareCode:CEe},Symbol.toStringTag,{value:"Module"})),eZe="/web/sandbox/sessions",BX="/web/sandbox/codex-project-handoff",UX=3e4,AL=33e4,tZe=6e4,nZe=6e5,G1=15e3,wh=6e4,iZe=33e4,QX=3e4,rZe=60*60,B6=40;function MI(e){const t=e.trim().toLowerCase();return["ready","running","wakeable"].includes(t)?"ready":t}function wU(e){switch(e.trim().toLowerCase()){case"ready":return z("sandbox.status.ready");case"wakeable":return z("sandbox.status.wakeable");case"creating":return z("sandbox.status.creating");case"starting":case"initializing":return z("sandbox.status.starting");case"pending":return z("sandbox.status.pending");case"running":return z("sandbox.status.running");case"failed":case"error":return z("sandbox.status.failed");case"stopped":return z("sandbox.status.stopped");case"expired":return z("sandbox.status.expired");case"deleting":return z("sandbox.status.deleting");case"deleted":return z("sandbox.status.deleted");default:return z("sandbox.status.unknown")}}function Yr(e){const t=Pl(e);return t.has("Accept")||t.set("Accept","application/json"),t}class OU extends Error{constructor(n,i={}){var r;super(n);rn(this,"code");rn(this,"retryable");rn(this,"publicMessage");rn(this,"httpStatus");this.name="SandboxServiceError",this.code=i.code??"",this.retryable=i.retryable===!0,this.publicMessage=((r=i.publicMessage)==null?void 0:r.trim())||n,this.httpStatus=i.httpStatus}}function sZe(e){return e instanceof OU?e.publicMessage:e instanceof Error&&e.name==="TimeoutError"?z("sandbox.developmentTimeout"):e instanceof TypeError?z("sandbox.developmentDisconnected"):z("sandbox.developmentFailed")}async function Es(e,t){const n=await e.text().catch(()=>"");let i={};try{i=JSON.parse(n)}catch{const d=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status});return new Error(n?z("common.fallbackWithDetail",{fallback:d,detail:n}):d)}const r=i.detail,s=r&&typeof r=="object"?r:i,o=r&&typeof r=="object"&&"message"in r?r.message:r??i.error??i.message,l=typeof o=="string"?o:o==null?"":JSON.stringify(o),c=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status}),u=l?z("common.fallbackWithDetail",{fallback:c,detail:l}):c;return new OU(u,{code:typeof s.code=="string"?s.code:"",retryable:s.retryable===!0,publicMessage:l||c,httpStatus:e.status})}async function zX(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(z("sandbox.invalidStudioResponse",{fallback:t}))}}function Xg(e,t="codex",n=e.toolName==="intelligent-development"){if(!e.sessionId||!e.status)throw new Error(z("sandbox.invalidSession"));return{resourceType:"session",id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",persistent:e.persistent!==!1,toolType:e.toolType??"",intelligentDevelopment:n,createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0,threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:LI(e.permissions),...e.conversation===void 0?{}:{restoredConversation:gb(e.conversation)}}}function VX(e,t="codex"){if(!e.snapshotId||!e.status)throw new Error(z("sandbox.invalidSnapshot"));return{resourceType:"snapshot",id:e.snapshotId,snapshotId:e.snapshotId,sourceSessionId:e.sessionId??"",toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,snapshotStatus:e.snapshotStatus??"Unknown",reason:e.reason??"",createdAt:e.createdAt??"",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0}}function HX(e,t){if((t==null?void 0:t.autoResumeSnapshots)===void 0)return e;const n=new URLSearchParams({autoResumeSnapshots:String(t.autoResumeSnapshots)});return`${e}?${n.toString()}`}const X1={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function LI(e){if(!e||typeof e!="object")return{...X1};const t=e,n=t.approvalPolicy,i=t.approvalsReviewer,r=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:X1.approvalPolicy,approvalsReviewer:i==="user"||i==="auto_review"?i:X1.approvalsReviewer,sandboxMode:r==="read-only"||r==="workspace-write"||r==="danger-full-access"?r:X1.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:X1.networkAccess}}function qX(e){if(!e||typeof e!="object")throw new Error(z("sandbox.invalidSettings"));const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:LI(t.permissions)}}function oo(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function oZe(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function aZe(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function _Ce(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function gb(e){const t=oo(e),n=_Ce(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error(z("sandbox.invalidThreadSnapshot"));const i=t.messages.flatMap(r=>{const s=oo(r);if(!s||typeof s.id!="string"||s.role!=="user"&&s.role!=="assistant"||typeof s.content!="string"||typeof s.timestamp!="number")return[];const o=Array.isArray(s.skillNames)?s.skillNames.filter(c=>typeof c=="string"&&!!c):[],l=Array.isArray(s.images)?s.images.flatMap(c=>{const u=oo(c);return!u||typeof u.mimeType!="string"||!u.mimeType.startsWith("image/")||typeof u.data!="string"||!u.data?[]:[{mimeType:u.mimeType,data:u.data,...typeof u.name=="string"&&u.name?{name:u.name}:{},...typeof u.alt=="string"&&u.alt?{alt:u.alt}:{}}]}):[];return[{id:s.id,role:s.role,content:s.content,timestamp:s.timestamp,...o.length?{skillNames:o}:{},...l.length?{images:l}:{}}]});return{thread:n,threadId:t.threadId,messages:i,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:LI(t.permissions)}}function U6(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(i=>typeof i!="number"||!Number.isFinite(i)||i<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function lZe(e){const t=U6(e.usage);if(!t||typeof e.turnId!="string")return;const n=U6(e.threadTotal),i=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof i=="number"&&Number.isFinite(i)&&i>=0?{modelContextWindow:Math.trunc(i)}:{}}}function cZe(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}function jCe(e={}){let t="";const n=[],i=new Map,r=new Map;let s,o;function l(){var h;const f=s?[...n,s]:n;(h=e.onBlocks)==null||h.call(e,[...f])}function c(f){t+=f;const h=n[n.length-1],m=n.length-1,g=[...i.values()].includes(m);(h==null?void 0:h.kind)==="text"&&!g?n[m]={...h,text:h.text+f}:n.push({kind:"text",text:f}),l()}function u(f){if(typeof f.id!="string"||f.kind!=="thinking"&&f.kind!=="commentary"&&f.kind!=="tool"||f.status!=="running"&&f.status!=="done"&&f.status!=="error")return;const h=f.status!=="running";let m;if(f.kind==="thinking")m={kind:"thinking",text:typeof f.text=="string"?f.text:"",done:h};else if(f.kind==="commentary"){if(typeof f.text!="string"||!f.text)return;m={kind:"text",text:f.text}}else{if(typeof f.name!="string"||!f.name)return;m={kind:"tool",name:f.name,args:f.args,response:f.response,status:f.status==="error"?"failed":h?"completed":"running",done:h}}m={...m,id:f.id,...typeof f.itemType=="string"?{itemType:f.itemType}:{},...typeof f.phase=="string"?{phase:f.phase}:{},...typeof f.durationMs=="number"?{durationMs:f.durationMs}:{}};const g=i.get(f.id);g===void 0?(i.set(f.id,n.length),n.push(m)):n[g]=m,l()}function d(f){var b,v,y,x;let h="message";const m=[];for(const w of f.split(/\r?\n/))w.startsWith("event:")&&(h=w.slice(6).trim()),w.startsWith("data:")&&m.push(w.slice(5).trimStart());if(m.length===0)return;let g;try{g=JSON.parse(m.join(` -`))}catch{throw new Error(z("sandbox.invalidConversationResponse"))}if(h==="error"){const w=typeof g.message=="string"&&g.message?g.message:z("sandbox.conversationFailed");throw new OU(w,{code:typeof g.code=="string"?g.code:"",retryable:g.retryable===!0,publicMessage:w})}if(h==="progress"&&typeof g.text=="string"&&(s=g.text?{kind:"progress",text:g.text}:void 0,l()),["activity","delta","tool_output","tool_progress","plan","diff"].includes(h)&&(s=void 0),h==="activity"&&u(g),(h==="tool_output"||h==="tool_progress")&&typeof g.id=="string"){const w=i.get(g.id),O=w===void 0?void 0:n[w];if((O==null?void 0:O.kind)==="tool"&&w!==void 0&&typeof g.text=="string"){const S=oo(O.response)||{};n[w]=h==="tool_progress"?{...O,progressText:g.text}:{...O,response:{...S,output:(g.snapshot?"":String(S.output||""))+g.text}},l()}}if((h==="plan"||h==="diff")&&typeof g.id=="string"){const w=typeof g.text=="string"?g.text:"",O=Array.isArray(g.items)?g.items:Array.isArray(g.plan)?g.plan:[],S=h==="diff"?{kind:"diff",id:g.id,text:w,done:g.status==="done"}:{kind:"plan",id:g.id,title:z("developmentRuns.plan"),summary:w,done:g.status==="done",items:O.flatMap(C=>{const E=oo(C);if(!E||typeof(E.text??E.step)!="string")return[];const R=E.status==="inProgress"?"in_progress":E.status;return[{text:String(E.text??E.step),status:R==="completed"||R==="failed"||R==="in_progress"?R:"pending"}]})},k=i.get(g.id);k===void 0?(i.set(g.id,n.length),n.push(S)):n[k]=S,l()}if(h==="development.source_ready"||h==="development.succeeded"){const w=oo(g.payload),O=oo(w==null?void 0:w.delivery),S=h==="development.succeeded";if(O&&typeof O.sessionId=="string"&&typeof O.artifactSha256=="string"&&typeof O.validationReportSha256=="string"&&typeof O.agentName=="string"&&typeof O.entryPoint=="string"&&typeof O.fileCount=="number"&&typeof O.artifactSize=="number"&&typeof O.validatedAt=="string"&&O.deployable===!0&&O.verified===S&&typeof O.validationSummary=="string"&&Array.isArray(O.gateSummary)&&O.gateSummary.every(k=>typeof k=="string")){const k={kind:"delivery",value:{sessionId:O.sessionId,...typeof O.projectId=="string"&&typeof O.versionId=="string"?{projectId:O.projectId,versionId:O.versionId,...O.parentVersionId===null||typeof O.parentVersionId=="string"?{parentVersionId:O.parentVersionId}:{}}:{},artifactSha256:O.artifactSha256,validationReportSha256:O.validationReportSha256,agentName:O.agentName,entryPoint:O.entryPoint,fileCount:O.fileCount,artifactSize:O.artifactSize,validatedAt:O.validatedAt,gateSummary:O.gateSummary,deployable:O.deployable,verified:O.verified,validationSummary:O.validationSummary}},C=n.findIndex(E=>E.kind==="delivery"&&E.value.sessionId===O.sessionId&&E.value.artifactSha256===O.artifactSha256&&E.value.validationReportSha256===O.validationReportSha256);C===-1?n.push(k):n[C]=k,l()}}if(h==="approval"){const w=cZe(g);w&&((b=e.onApproval)==null||b.call(e,w))}if(h==="usage"){const w=lZe(g);w&&(o=w,(v=e.onUsage)==null||v.call(e,w))}if(h==="approval_resolved"&&typeof g.approvalId=="string"&&((y=e.onApprovalResolved)==null||y.call(e,g.approvalId)),h==="delta"&&typeof g.text=="string")if(typeof g.id=="string"&&g.id){const w=r.get(g.id),O=w===void 0?void 0:n[w],S=((x=oo(g))==null?void 0:x.snapshot)===!0;(O==null?void 0:O.kind)==="text"?n[w]={...O,phase:typeof g.phase=="string"&&g.phase?g.phase:O.phase,text:S?O.text.startsWith(g.text)?O.text:g.text:O.text+g.text}:(r.set(g.id,n.length),n.push({kind:"text",text:g.text,id:g.id,itemType:typeof g.itemType=="string"?g.itemType:void 0,phase:typeof g.phase=="string"?g.phase:void 0})),t=n.filter(k=>k.kind==="text").map(k=>k.text).join(""),l()}else c(g.text);if(h==="done"&&!t&&typeof g.text=="string"&&c(g.text),h==="done"){for(let w=0;w({text:t,blocks:n.map(f=>({...f})),...o?{usage:o}:{}})}}async function uZe(e,t={}){if(!e.body)throw new Error(z("sandbox.emptyConversationResponse"));const n=e.body.getReader(),i=new TextDecoder;let r="";const s=jCe(t);for(;;){const{done:l,value:c}=await n.read();r+=i.decode(c,{stream:!l});const u=r.split(/\r?\n\r?\n/);if(r=u.pop()??"",u.forEach(s.consumeFrame),l)break}r.trim()&&s.consumeFrame(r),s.consumeFrame(`event: done -data: {}`);const o=s.result();if(o.blocks.length===0)throw new Error(z("sandbox.emptyReply"));return o}async function Cc(e,t,n,{method:i="GET",body:r,options:s={},fallback:o}){if(!t)throw new Error(z("sandbox.missingSession"));const l=await gn(`${e}/${encodeURIComponent(t)}/${n}`,{method:i,headers:Yr(r===void 0?void 0:{"Content-Type":"application/json"}),...r===void 0?{}:{body:JSON.stringify(r)},signal:s.signal},wh);if(!l.ok)throw await Es(l,o);return l.json()}function NCe(e,t={}){return{async listSessions(n={}){const i=await gn(HX(e,n),{method:"GET",headers:Yr(),signal:n.signal},UX);if(!i.ok)throw await Es(i,z("sandbox.listCodexFailed"));const r=await i.json();if(!Array.isArray(r.sessions))throw new Error(z("sandbox.invalidSessionList"));if(r.snapshots!==void 0&&!Array.isArray(r.snapshots))throw new Error(z("sandbox.invalidSnapshotList"));return[...r.sessions.map(s=>Xg(s,"codex",t.intelligentDevelopment)),...(r.snapshots??[]).map(s=>VX(s))]},async startSession(n={}){var s,o;const i=((s=n.displayName)==null?void 0:s.trim())??"",r=await gn(e,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({displayName:t.textOnly&&n.projectId?Array.from(i).slice(0,B6).join(""):i,...(o=n.modelId)!=null&&o.trim()?{modelId:n.modelId.trim()}:{},...t.textOnly&&n.projectId?{projectId:n.projectId,...n.baseVersionId?{baseVersionId:n.baseVersionId}:{}}:{},...t.textOnly?{}:{persistent:n.persistent??!0},...n.diskGb!==void 0?{diskGb:n.diskGb}:{}}),signal:n.signal},AL);if(!r.ok)throw await Es(r,z("sandbox.startFailed"));return Xg(await r.json(),"codex",t.intelligentDevelopment)},async listAgentSessions(n,i={}){const r=await gn(HX(`/web/${n}/sessions`,i),{method:"GET",headers:Yr(),signal:i.signal},UX);if(!r.ok)throw await Es(r,z("sandbox.listAgentFailed",{kind:n}));const s=await r.json();if(!Array.isArray(s.sessions))throw new Error(z("sandbox.invalidKindSessionList",{kind:n}));if(s.snapshots!==void 0&&!Array.isArray(s.snapshots))throw new Error(z("sandbox.invalidKindSnapshotList",{kind:n}));return[...s.sessions.map(o=>Xg(o,n)),...(s.snapshots??[]).map(o=>VX(o,n))]},async startAgentSession(n,i={}){var s;const r=await gn(`/web/${n}/sessions`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=i.displayName)==null?void 0:s.trim())??"",persistent:i.persistent??!0,...i.diskGb!==void 0?{diskGb:i.diskGb}:{}}),signal:i.signal},AL);if(!r.ok)throw await Es(r,z("sandbox.createAgentFailed",{kind:n}));return Xg(await r.json(),n)},async openAgentSession(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSessionToOpen"));const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}/open`,{method:"POST",headers:Yr(),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.openAgentFailed",{kind:n}));const o=await s.json();if(typeof o.webuiUrl!="string"||!o.webuiUrl.startsWith("/"))throw new Error(z("sandbox.invalidAgentHomeUrl",{kind:n}));return{session:Xg(o,n),kind:n,webuiUrl:Zo(o.webuiUrl)}},async launchAgentTerminal(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSessionForTerminal"));const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}/terminal`,{method:"POST",headers:Yr(),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.openTerminalFailed",{kind:n}));const o=await s.json();return{url:RCe(o.url,`${n} Terminal`),...typeof o.shellSessionId=="string"?{shellSessionId:o.shellSessionId}:{}}},async deleteAgentSession(n,i,r={}){if(!i)return;const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}`,{method:"DELETE",headers:Yr(),signal:r.signal},G1);if(!s.ok&&s.status!==404)throw await Es(s,z("sandbox.deleteAgentFailed",{kind:n}))},async resumeSnapshot(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSnapshot"));const s=n==="codex"?"/web/sandbox":`/web/${n}`,o=await gn(`${s}/snapshots/${encodeURIComponent(i)}/resume`,{method:"POST",headers:Yr(),signal:r.signal},AL);if(!o.ok)throw await Es(o,z("sandbox.resumeSnapshotFailed"));return Xg(await o.json(),n)},async deleteSnapshot(n,i,r={}){if(!i)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,o=await gn(`${s}/snapshots/${encodeURIComponent(i)}`,{method:"DELETE",headers:Yr(),signal:r.signal},G1);if(!o.ok&&o.status!==404)throw await Es(o,z("sandbox.deleteSnapshotFailed"))},async connectSession(n,i={}){if(!n)throw new Error(z("sandbox.missingSessionToConnect"));const r=await gn(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),signal:i.signal},tZe);if(!r.ok)throw await Es(r,z("sandbox.connectCodexFailed"));const s=Xg(await r.json(),"codex",t.intelligentDevelopment);if(s.status.toLowerCase()!=="ready")throw new Error(z("sandbox.sessionNotReady",{status:s.status}));return s},async sendMessage(n,i={}){var s;if(!n.sessionId||!n.text.trim())throw new Error(z("sandbox.invalidMessage"));const r=await gn(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:Yr({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:n.text,...!t.textOnly&&((s=n.skillIds)!=null&&s.length)?{skillIds:n.skillIds}:{}}),signal:i.signal},t.messageTimeoutMs??nZe);if(!r.ok)throw await Es(r,z("sandbox.conversationFailed"));return uZe(r,i)},async interruptSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:Yr(),signal:i.signal},t.interruptTimeoutMs??G1);if(!r.ok&&![404,409].includes(r.status))throw await Es(r,z("sandbox.interruptFailed"))},async getStatus(n,i={}){const r=await Cc(e,n,"status",{options:i,fallback:z("sandbox.getStatusFailed")}),s=qX(r),o=oo(r),l=U6(o==null?void 0:o.threadTotal),c=o==null?void 0:o.modelContextWindow;return{...s,...l?{threadTotal:l}:{},...typeof c=="number"&&Number.isFinite(c)&&c>=0?{modelContextWindow:Math.trunc(c)}:{}}},async getEndpoint(n,i={}){const r=oo(await Cc(e,n,"endpoint",{options:i,fallback:z("sandbox.getEndpointFailed")}));if(typeof(r==null?void 0:r.endpoint)!="string"||!r.endpoint.trim())throw new Error(z("sandbox.invalidEndpoint"));return{endpoint:r.endpoint,sessionId:typeof r.sessionId=="string"?r.sessionId:n,...typeof r.expireAt=="string"?{expireAt:r.expireAt}:{}}},async createCodexProjectHandoffPairing(n={}){const i=await gn(`${BX}/pairings`,{method:"POST",headers:Yr({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:rZe}),signal:n.signal},QX);if(!i.ok)throw await Es(i,z("sandbox.createHandoffPairingFailed"));const r=oo(await zX(i,z("sandbox.createHandoffPairingFailed")));if(typeof(r==null?void 0:r.pairingCode)!="string"||!r.pairingCode.trim()||typeof r.expireAt!="string"||!r.expireAt.trim())throw new Error(z("sandbox.invalidHandoffPairing"));const s=typeof r.studioUrl=="string"&&r.studioUrl.trim()?r.studioUrl.trim():window.location.origin;return{pairingCode:r.pairingCode,expireAt:r.expireAt,studioUrl:s}},async getCodexProjectHandoffStatus(n,i={}){const r=await gn(`${BX}/pairings/${encodeURIComponent(n)}`,{headers:Yr({Accept:"application/json"}),signal:i.signal},QX);if(!r.ok)throw await Es(r,z("sandbox.getHandoffStatusFailed"));const s=oo(await zX(r,z("sandbox.getHandoffStatusFailed"))),o=new Set(["issued","creating","session-created","continuing","running","completed","failed"]);if(typeof(s==null?void 0:s.state)!="string"||!o.has(s.state)||typeof s.expireAt!="string"||!s.expireAt.trim())throw new Error(z("sandbox.invalidHandoffStatus"));return{state:s.state,expireAt:s.expireAt,...typeof s.projectName=="string"?{projectName:s.projectName}:{},...typeof s.agentName=="string"?{agentName:s.agentName}:{},...typeof s.sessionId=="string"?{sessionId:s.sessionId}:{},...typeof s.error=="string"?{error:s.error}:{},...s.failedStage==="creating-session"||s.failedStage==="uploading-project"||s.failedStage==="restoring-project"||s.failedStage==="continuing-task"?{failedStage:s.failedStage}:{}}},async listModels(n,i={}){const r=oo(await Cc(e,n,"models",{options:i,fallback:z("sandbox.listModelsFailed")}));if(!Array.isArray(r==null?void 0:r.models))throw new Error(z("sandbox.invalidModelList"));return r.models.flatMap(s=>{const o=oZe(s);return o?[o]:[]})},async setModel(n,i,r={}){const s=oo(await Cc(e,n,"model",{method:"PUT",body:{model:i},options:r,fallback:z("sandbox.setModelFailed")}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error(z("sandbox.invalidModel"));return s.model},async listSkills(n,i=!1,r={}){const o=oo(await Cc(e,n,`skills${i?"?force_reload=true":""}`,{options:r,fallback:z("sandbox.listSkillsFailed")}));if(!Array.isArray(o==null?void 0:o.skills))throw new Error(z("sandbox.invalidSkillList"));return o.skills.flatMap(l=>{const c=aZe(l);return c?[c]:[]})},async listThreads(n,i={},r={}){const s=new URLSearchParams;i.cursor&&s.set("cursor",i.cursor),i.search&&s.set("search",i.search),i.archived&&s.set("archived","true");const o=s.size?`?${s}`:"",l=oo(await Cc(e,n,`threads${o}`,{options:r,fallback:z("sandbox.listThreadsFailed")}));if(!Array.isArray(l==null?void 0:l.threads))throw new Error(z("sandbox.invalidThreadList"));return{threads:l.threads.flatMap(c=>{const u=_Ce(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,i={}){return gb(await Cc(e,n,"threads/new",{method:"POST",options:i,fallback:z("sandbox.createThreadFailed")}))},async readThread(n,i,r={}){if(!i)throw new Error(z("sandbox.missingThread"));return gb(await Cc(e,n,`threads/${encodeURIComponent(i)}`,{options:r,fallback:z("sandbox.readThreadFailed")}))},async resumeThread(n,i,r={}){return gb(await Cc(e,n,"threads/resume",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.resumeThreadFailed")}))},async forkThread(n,i={}){return gb(await Cc(e,n,"threads/fork",{method:"POST",options:i,fallback:z("sandbox.forkThreadFailed")}))},async archiveThread(n,i,r={}){const s=oo(await Cc(e,n,"threads/archive",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.archiveThreadFailed")}));if((s==null?void 0:s.archived)!==!0)throw new Error(z("sandbox.invalidArchiveResult"));return{archived:!0,...s.thread?{snapshot:gb(s)}:{}}},async deleteThread(n,i,r={}){const s=oo(await Cc(e,n,"threads/delete",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.deleteThreadFailed")}));if((s==null?void 0:s.deleted)!==!0)throw new Error(z("sandbox.invalidDeleteResult"));return{deleted:!0,...s.thread?{snapshot:gb(s)}:{}}},async compactThread(n,i={}){await Cc(e,n,"threads/compact",{method:"POST",options:i,fallback:z("sandbox.compactThreadFailed")})},async getSettings(n,i={}){const r=await gn(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:Yr(),signal:i.signal},wh);if(!r.ok)throw await Es(r,z("sandbox.getSettingsFailed"));return qX(await r.json())},async updatePermissions(n,i,r={}){const s=await gn(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify(i),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.updatePermissionsFailed"));const o=await s.json();return LI(o.permissions)},async updateWorkspace(n,i,r={}){const s=await gn(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({cwd:i}),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.updateWorkspaceFailed"));const o=await s.json();if(typeof o.cwd!="string"||!o.cwd)throw new Error(z("sandbox.invalidWorkingDirectory"));return o.cwd},async listDirectories(n,i,r={}){const s=new URLSearchParams({path:i}),o=await gn(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:Yr(),signal:r.signal},wh);if(!o.ok)throw await Es(o,z("sandbox.listDirectoriesFailed"));const l=await o.json();if(typeof l.path!="string"||!Array.isArray(l.directories)||l.directories.some(c=>!c||typeof c.name!="string"||typeof c.path!="string"))throw new Error(z("sandbox.invalidDirectoryList"));return{path:l.path,...typeof l.parent=="string"?{parent:l.parent}:{},directories:l.directories}},async resolveApproval(n,i,r,s={}){const o=await gn(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(i)}`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({decision:r}),signal:s.signal},wh);if(!o.ok)throw await Es(o,z("sandbox.resolveApprovalFailed"))},async launchTerminal(n,i={}){return WX(e,n,"terminal",i)},async launchBrowser(n,i={}){return WX(e,n,"browser",i)},async uploadFile(n,i,r={}){const s=new FormData;s.set("file",i,i.name);const o=await gn(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:Yr(),body:s,signal:r.signal},iZe);if(!o.ok)throw await Es(o,z("sandbox.uploadFileFailed"));const l=await o.json();if(typeof l.id!="string"||typeof l.path!="string"||typeof l.name!="string"||typeof l.mimeType!="string"||typeof l.sizeBytes!="number")throw new Error(z("sandbox.invalidUploadResult"));return l},async closeSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:Yr(),signal:i.signal},G1);if(!r.ok&&r.status!==404)throw await Es(r,z("sandbox.disconnectCodexFailed"))},async deleteSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:Yr(),signal:i.signal},G1);if(!r.ok&&r.status!==404)throw await Es(r,z("sandbox.deleteCodexFailed"))}}}const Sr=NCe(eZe),I0=NCe("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3,intelligentDevelopment:!0});async function WX(e,t,n,i){const r=await gn(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:Yr(),signal:i.signal},wh);if(!r.ok)throw await Es(r,z(n==="terminal"?"sandbox.openSandboxTerminalFailed":"sandbox.openSandboxBrowserFailed"));const s=await r.json();return{url:RCe(s.url,z("sandbox.toolLabel")),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function RCe(e,t){if(typeof e!="string")throw new Error(z("sandbox.invalidToolUrl",{label:t}));if(e.startsWith("/"))return Zo(e);let n;try{n=new URL(e)}catch{throw new Error(z("sandbox.invalidToolUrl",{label:t}))}const i=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!i)throw new Error(z("sandbox.unsafeToolUrl",{label:t}));return n.toString()}const Fc=e=>["succeeded","cancelled","failed"].includes(e.state),ICe="/web/intelligent-development";class Hx extends Error{constructor(t,n){super(t),this.status=n}}async function Yg(e,t="GET",n,i){const r=await gn(`${ICe}${e}`,{method:t,signal:i,headers:Yr(n===void 0?void 0:{"Content-Type":"application/json"}),...n===void 0?{}:{body:JSON.stringify(n)}},3e4);if(!r.ok){const s=await r.json().catch(()=>null),o=s==null?void 0:s.detail;throw new Hx(typeof o=="string"?o:(o==null?void 0:o.message)||z("developmentRuns.requestFailed"),r.status)}return r.json()}function P0(e){const t=e;if(!t||typeof t.runId!="string"||typeof t.sessionId!="string"||!["queued","running","recovering","waiting_user","stopping","succeeded","cancelled","failed"].includes(t.state))throw new Error(z("developmentRuns.invalidResponse"));return t}const pd={async active(e){const t=await Yg("/runs","GET",void 0,e);if(!Array.isArray(t.runs))throw new Error(z("developmentRuns.invalidResponse"));return t.runs.map(P0)},async get(e,t){return P0(await Yg(`/runs/${encodeURIComponent(e)}`,"GET",void 0,t))},async list(e,t){const n=await Yg(`/sessions/${encodeURIComponent(e)}/runs`,"GET",void 0,t);if(!Array.isArray(n.runs))throw new Error(z("developmentRuns.invalidResponse"));return n.runs.map(P0)},async create(e,t,n){return P0(await Yg(`/sessions/${encodeURIComponent(e)}/runs`,"POST",{message:t,requestId:n}))},async steer(e,t,n){await Yg(`/runs/${encodeURIComponent(e)}/inputs`,"POST",{message:t,clientId:n})},async stop(e){return P0(await Yg(`/runs/${encodeURIComponent(e)}/stop`,"POST"))},async resume(e){return P0(await Yg(`/runs/${encodeURIComponent(e)}/resume`,"POST"))}};class dZe{constructor(t){rn(this,"cursor",0);rn(this,"turns",[]);rn(this,"activeInput");rn(this,"itemTurns",new Map);rn(this,"nativeInputs",new Map);rn(this,"metrics",new Map);rn(this,"inputOrder",[]);rn(this,"projections",new Map);rn(this,"itemInputs",new Map);this.run=t,this.activeInput=t.requestId}projection(t){let n=this.projections.get(t);if(!n){const i={role:"assistant",blocks:[],meta:{localId:`${t}:assistant`}},r=this.turns.findIndex(s=>{var o;return((o=s.meta)==null?void 0:o.localId)===`${t}:user`});this.turns.splice(r<0?this.turns.length:r+1,0,i),n=jCe({onBlocks:s=>{i.blocks=s.map(o=>({...o,turnId:this.itemTurns.get(o.id||"")}))},onUsage:s=>{i.meta={...i.meta,sandboxUsage:s.usage}}}),this.projections.set(t,n)}return n}apply(t){if(t.payload.runId!==this.run.runId)throw new Error(z("developmentRuns.invalidResponse"));if(t.seq<=this.cursor)return;if(t.seq!==this.cursor+1)throw new Error(z("developmentRuns.eventGap"));for(const i of this.turns)i.blocks.some(r=>r.kind==="turn-summary")&&(i.blocks=i.blocks.filter(r=>r.kind!=="turn-summary"));const n=t.payload;if(t.type==="run.input"&&typeof n.clientId=="string"&&typeof n.message=="string")this.turns.push({role:"user",blocks:[{kind:"text",text:n.message}],meta:{localId:`${n.clientId}:user`},activity:{id:`${n.clientId}:delivery`,title:z(`developmentRuns.input.${String(n.status)}`)}}),this.inputOrder.push(n.clientId),this.projection(n.clientId),n.status==="delivered"&&this.inputOrder.indexOf(n.clientId)>=this.inputOrder.indexOf(this.activeInput)&&(this.activeInput=n.clientId);else if(t.type==="run.input_status"&&typeof n.clientId=="string"){const i=this.turns.find(r=>{var s;return((s=r.meta)==null?void 0:s.localId)===`${n.clientId}:user`});i&&(i.activity={id:`${n.clientId}:delivery`,title:z(`developmentRuns.input.${String(n.status)}`)}),n.status==="delivered"&&this.inputOrder.indexOf(n.clientId)>=this.inputOrder.indexOf(this.activeInput)&&(this.activeInput=n.clientId)}else if(t.type==="run.turn"&&typeof n.turnId=="string"){const r={...this.metrics.get(n.turnId),turnId:n.turnId,status:String(n.status||"inProgress"),toolCalls:0,toolDurationComplete:!1};for(const s of["startedAt","completedAt","durationMs"])typeof n[s]=="number"&&Number.isFinite(n[s])&&n[s]>=0&&(r[s]=n[s]);if(typeof n.model=="string"&&(r.model=n.model),n.usage&&typeof n.usage=="object"&&!Array.isArray(n.usage)){const s={};for(const o of["totalTokens","inputTokens","outputTokens","cachedInputTokens","cacheWriteInputTokens","reasoningOutputTokens"]){const l=n.usage[o];typeof l=="number"&&Number.isSafeInteger(l)&&l>=0&&(s[o]=l)}r.usage=s}n.usageIncomplete===!0&&(r.usageIncomplete=!0),this.metrics.set(n.turnId,r),this.nativeInputs.set(n.turnId,this.activeInput),this.projection(this.activeInput)}else if(t.type==="run.status"){if(this.run={...this.run,...n},Fc(this.run))for(const[i,r]of this.metrics)r.status==="inProgress"&&this.metrics.set(i,{...r,status:"unavailable",usageIncomplete:!0});if(Fc(this.run)||this.run.state==="waiting_user")for(const i of this.projections.values())i.consumeFrame(`event: done +`):e&&typeof e=="object"?JSON.stringify(e):""}async function fn(e,t){const n=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status}),i=await e.text().catch(()=>"");if(!i)return n;try{const r=JSON.parse(i),s=IYe(r.detail??r.error);return s?z("client.errorWithDetailAndRawResponse",{context:n,detail:s,response:i}):z("client.errorWithRawResponse",{context:n,response:i})}catch{return z("client.errorWithRawResponse",{context:n,response:i})}}async function aU(e,t=!1){const n=await $t(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,z("client.loadArkApiKeysFailed")));return await n.json()}async function ZSe(e,t){const n=await $t(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,z("client.loadArkApiKeysFailed")));return await n.json()}async function Mw(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true"),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),i=await $t(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.loadModelsFailed")));return await i.json()}async function JSe(){const e=await $t("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Lw extends Error{constructor(){super(z("client.runtimeAccessDenied")),this.name="RuntimeAccessDeniedError"}}class co extends Error{constructor(t,n=!1,i=!1){super(t),this.unsupported=n,this.retryable=i,this.name="RuntimeProbeError"}}const eEe=()=>z("client.privateRuntimeUnavailable"),tEe=()=>z("client.runtimeTemporarilyUnavailable"),MX=["cn-beijing","cn-shanghai"],PYe=3e4,$w=5*60*1e3,nEe=60*1e3;let IS="volcengine";const Zv=new Map,pb=new Map,mb=new Map,bd=new Map,Br=new Map;function lU(e,t,n){return`${t}:${e}:${n??""}`}function iEe(e){e!==IS&&Br.clear(),IS=e}function uC(e){const t=(e||"").trim();if(IS==="byteplus")return[t&&!t.startsWith("cn-")?t:C6];const n=t&&!t.startsWith("ap-")?t:nU;return MX.includes(n)?[n,...MX.filter(i=>i!==n)]:[n]}function jI(e){const t=(e||"").trim();return t?[t]:uC()}function Uy(...e){return e.map(t=>String(t??"")).join("")}function Tg(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function cU(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}function fA(e,t){return t?t.aborted?Promise.reject(new DOMException("The operation was aborted.","AbortError")):new Promise((n,i)=>{const r=()=>{i(new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",r,{once:!0}),e.then(s=>{t.removeEventListener("abort",r),n(s)},s=>{t.removeEventListener("abort",r),i(s)})}):e}async function rEe(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function dC(e,t,n,i,r=Ba){const s=await $t("/list-apps",{signal:i},n??{base:e,apiKey:t},r),o=n!=null&&n.runtimeId?await rEe(s):"";if(n!=null&&n.runtimeId&&o==="runtime_access_denied")throw new Lw;if(n!=null&&n.runtimeId&&o==="runtime_private_endpoint_unreachable")throw new co(eEe());if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(o))throw new co(tEe(),!1,!0);if(n!=null&&n.runtimeId&&s.status===404)throw new co(z("client.runtimeConnectionUnsupported"),!0,!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new co(z("client.runtimeConnectionDenied"));if(!s.ok)throw new Error(await fn(s,z("client.listAgentsFailed")));let l;try{l=await s.json()}catch{throw new co(z("client.invalidListAppsJson"))}if(!Array.isArray(l)||l.some(u=>typeof u!="string"||!u.trim()))throw new co(z("client.invalidListAppsFormat"));const c=l.map(u=>u.trim());return n!=null&&n.runtimeId&&Zv.set(lU(n.runtimeId,n.region??"",n.runtimeVersion),{apps:c,expiresAt:Date.now()+PYe}),c}async function sEe(e,t){const{app:n,ep:i}=fc(e),r=await $t(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!r.ok){const o=z("client.createSessionFailedWithStatus",{status:r.status}),l=await fn(r,z("client.createSessionFailed"));throw new Error(l===o?o:z("common.fallbackWithDetail",{fallback:o,detail:l}))}return(await r.json()).id}async function uU(e,t){const{app:n,ep:i}=fc(e),r=await $t(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!r.ok)throw new Error(`list sessions failed: ${r.status}`);return r.json()}async function NI(e,t,n){const{app:i,ep:r}=fc(e),s=await $t(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},r);if(!s.ok){const l=await fn(s,z("client.getSessionFailed"));throw new Error(z("client.getSessionFailedWithDetail",{status:s.status,detail:l}))}const o=await s.json();if(r.runtimeId){const l=rU(r.runtimeId,i,t,n);o.state={...sU()[l]??{},...o.state??{}}}return o}async function oEe(e){const{app:t,ep:n}=fc(e.appName);if(!n.runtimeId)throw new Error(z("client.feedbackRuntimeOnly"));if(!n.region)throw new Error(z("client.feedbackRegionMissing"));const i=await $t("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},xr);if(!i.ok)throw new Error(await fn(i,z("client.submitFeedbackFailed")));const r=await i.json(),s=rU(n.runtimeId,t,e.userId,e.sessionId);return RYe(s,e.eventId,r),r}async function RI(e,t={}){const n=Uy(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=Tg(bd,n,nEe);if(!t.force&&i)return i;const r=bd.get(n);if(!t.force&&(r!=null&&r.promise))return r.promise;let s=null;const o=(async()=>{for(const l of jI(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await $t(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return cU(bd,n,await u.json());s=new Error(await fn(u,z("client.loadEvaluationSetsFailed")))}throw s??new Error(z("client.loadEvaluationSetsFailed"))})();bd.set(n,{...r,promise:o,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await o}finally{const l=bd.get(n);(l==null?void 0:l.promise)===o&&bd.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function T6(e){let t=null;for(const n of jI(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),r=await $t(`/web/evaluation/statuses?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,z("client.loadAutoEvaluationStatusFailed")))}throw t??new Error(z("client.loadAutoEvaluationStatusFailed"))}async function aEe(e){let t=null;for(const n of jI(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),r=await $t(`/web/evaluation/optimizations?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,z("client.loadOptimizationsFailed")))}throw t??new Error(z("client.loadOptimizationsFailed"))}function lEe(e){return Tg(bd,Uy(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),nEe)}function DYe(e){RI(e).catch(()=>{})}function cEe(e){RI(e,{force:!0}).catch(()=>{})}function uEe(e,t){return["good","bad"].map(n=>{const i=e.find(r=>r.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(r=>r.kind===n).length}})}function k_(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[i,r]of bd.entries()){const s=r.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const o=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),l=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...o]:o;bd.set(i,{value:{...s,sets:uEe(s.sets,l),items:l},updatedAt:Date.now(),promise:r.promise})}}async function dEe(e){let t=null;for(const n of jI(e.region)){const i=await $t("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},xr);if(i.ok){const r=await i.json(),s=new Set(e.itemIds);for(const[o,l]of bd.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));bd.set(o,{value:{...c,sets:uEe(c.sets,u),items:u},updatedAt:Date.now()})}return r}t=new Error(await fn(i,z("client.deleteEvaluationCaseFailed")))}throw t??new Error(z("client.deleteEvaluationCaseFailed"))}async function A6(e,t,n){const{app:i,ep:r}=fc(e),s=await $t(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},r);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function MYe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),r=new Uint8Array(i.length);for(let s=0;sURL.revokeObjectURL(l),0)}async function fEe(e,t,n,i,r){const{app:s,ep:o}=fc(e),l=r==null?"":`?version=${encodeURIComponent(r)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${l}`,u=await $t(c,{},o,xr);if(!u.ok)throw new Error(await fn(u,z("client.downloadFileFailed")));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error(z("client.fileUnavailable"));const h=MYe(f.data),m=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([m],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??i}}async function fU(e,t,n,i,r){const{blob:s}=await fEe(e,t,n,i,r);return URL.createObjectURL(s)}async function LYe(e){const t=await $t("/web/media/capabilities");if(!t.ok)throw new Error(await fn(t,"media capabilities failed"));return t.json()}async function hEe(e,t,n,i){const{app:r}=fc(e),s=new FormData;s.set("app_name",r),s.set("user_id",t),s.set("session_id",n),s.set("file",i);const o=await $t("/web/media",{method:"POST",body:s},{},xr);if(!o.ok)throw new Error(await fn(o,z("client.uploadFileFailed")));return{...await o.json(),status:"ready"}}async function _6(e,t,n){const{app:i}=fc(e),r=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await $t(r,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await fn(s,"media cleanup failed"))}function pEe(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((i,r)=>![1,3,5].includes(r)).join("/")}`}catch{return}}async function S_(e,t){const n=pEe(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await $t(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await fn(i,"media cleanup failed"))}function mEe(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=pEe(t);if(!n)return t;const i=`${n}/content`;return Zo(`${O_}${i}`)}async function lN(e,t,n){const{app:i,ep:r}=fc(e);let s;if(r.runtimeId){const c=new URLSearchParams({runtimeId:r.runtimeId,sessionId:t,region:r.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await $t(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error(z("client.traceDisabled"))}else s=await $t(`/dev/apps/${encodeURIComponent(i)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(await fn(s,z("client.loadTraceFailed")));const o=s.headers.get("content-type")??"";if(!o.includes("application/json")){const c=o.split(";",1)[0]||z("client.contentTypeMissing");throw new Error(z("client.traceNonJson",{contentType:c}))}const l=await s.json();if(!Array.isArray(l))throw new Error(z("client.invalidTraceFormat"));return l}async function j6(e){const t=await $t("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,z("client.submitIssueFeedbackFailed")));if((await t.json()).submitted!==!0)throw new Error(z("client.issueFeedbackNotConfirmed"));return{submitted:!0}}async function gEe(e,t,n=!0){const i=await $t(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const r=await i.json();if(n&&!r.draft)try{const s=await $t(`/web/agent-draft/${e}`,{},t);if(s.ok){const o=await s.json();r.draft=o.draft}}catch{}return{appName:e,name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function N6(e){const{app:t,ep:n}=fc(e);return gEe(t,n,!1)}async function $Ye(e,t,n){let i=null;for(const r of uC(t)){const s={runtimeId:e,region:r};try{const o=lU(e,r),l=Zv.get(o);l&&l.expiresAt<=Date.now()&&Zv.delete(o);const c=Zv.get(o),u=n||(c==null?void 0:c.apps[0])||(await dC("","",s))[0];if(!u)throw new Error(z("client.noPreviewableAgent"));return gEe(u,s)}catch(o){if(o instanceof Lw||o instanceof co&&!o.unsupported)throw o;i=o instanceof Error?o:new Error(String(o))}}throw i??new Error(z("client.noPreviewableAgent"))}async function hU(e,t,n={},i={}){const r=typeof n=="string"?n:void 0,s=typeof n=="string"?i:n,o=Uy(e,t||"cn-beijing",r??""),l=Tg(pb,o,$w);if(!s.force&&l)return l;const c=pb.get(o);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=$Ye(e,t,r).then(d=>cU(pb,o,d));pb.set(o,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=pb.get(o);(d==null?void 0:d.promise)===u&&pb.set(o,{value:d.value,updatedAt:d.updatedAt})}}function bEe(e,t,n=""){return Tg(pb,Uy(e,t||"cn-beijing",n),$w)}function yEe(e,t,n=""){hU(e,t,n).catch(()=>{})}async function vEe(e,t,n,i){const{app:r,ep:s}=fc(e),o=new URLSearchParams({source:t,app_name:r,q:n,user_id:i}),l=await $t(`/web/search?${o.toString()}`,{},s);if(!l.ok)throw new Error(await fn(l,z("client.agentSearchFailed")));return l.json()}async function xEe(e,t){const{app:n}=fc(e),i=await $t(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}function wEe(){return om(z("client.emptySseBody"))}function E_(){return om(z("client.noDisplayableSseReply"))}const FYe=6e4;function zx(){return z("client.firstSseEventTimeout")}function OEe(e){if(e!=null&&e.aborted)return{signal:e,clearDeadline:()=>{},cleanup:()=>{},timedOut:()=>!1};const t=new AbortController;let n=!1,i=!1;const r=()=>{i||(i=!0,clearTimeout(o))},s=()=>{t.signal.aborted||t.abort((e==null?void 0:e.reason)??new DOMException("Aborted","AbortError"))},o=setTimeout(()=>{i||t.signal.aborted||(n=!0,i=!0,t.abort(new Error(zx())))},FYe);return e==null||e.addEventListener("abort",s,{once:!0}),{signal:t.signal,clearDeadline:r,cleanup:()=>{r(),e==null||e.removeEventListener("abort",s)},timedOut:()=>n}}async function*R6({appName:e,userId:t,sessionId:n,text:i,attachments:r=[],invocation:s,platformTools:o,environmentMounts:l,environmentMount:c,functionResponses:u=[],signal:d,onRuntimeContext:f}){const{app:h,ep:m}=fc(e),g=r.flatMap(S=>S.status&&S.status!=="ready"?[]:S.uri?[{fileData:{mimeType:S.mimeType,fileUri:S.uri,displayName:S.name},partMetadata:{veadkMedia:{id:S.id,uri:S.uri,name:S.name,mimeType:S.mimeType,sizeBytes:S.sizeBytes}}}]:S.data?[{inlineData:{mimeType:S.mimeType,data:S.data,displayName:S.name}}]:[]),b=s&&(s.skills.length>0||s.targetAgent)?s:void 0,v=[...g,...u.map(S=>({functionResponse:{id:S.id,name:S.name,response:S.response}})),...i.trim()?[{text:i}]:[]];if(b&&v.length>0){const S=v[0],k=S.partMetadata;v[0]={...S,partMetadata:{...k,veadkInvocation:b}}}let y;const x=OEe(d);try{y=await $t("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:h,user_id:t,session_id:n,new_message:{role:"user",parts:v},streaming:!0,...o!==void 0?{platform_tools:[...o]}:{},...l!==void 0?{environment_mounts:[...l]}:c?{environment_mount:c}:{},custom_metadata:b?{veadkInvocation:b}:void 0}),signal:x.signal},m,0)}catch(S){throw x.cleanup(),x.timedOut()?new Error(zx()):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(om(S))}const w=JXe(y,m.runtimeId??"",m.region??"");if(w&&(f==null||f(w)),!y.ok){x.cleanup();const S=await fn(y,z("client.runSessionFailed"));throw new Error(om(z("client.runSseFailedWithDetail",{status:y.status,detail:S})))}let O=!1;try{for await(const S of AI(y)){O=!0,x.clearDeadline();const k=S;typeof k.error=="string"&&(k.error=om(k.error)),typeof k.errorMessage=="string"&&(k.errorMessage=om(k.errorMessage)),typeof k.error_message=="string"&&(k.error_message=om(k.error_message)),yield k}}catch(S){throw x.timedOut()?new Error(zx()):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(om(S))}finally{x.cleanup()}if(!O)throw new Error(wEe())}async function II(e,t){const n=new URLSearchParams({name:e,region:t}),i=await $t(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.checkRuntimeNameFailed")));const r=await i.json();if(typeof r.available!="boolean")throw new Error(z("client.invalidRuntimeNameCheck"));return{available:r.available}}async function kEe(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const i=await $t(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!i.ok)throw new Error(await fn(i,z("client.loadCloudResourcesFailed")));const r=await i.json();if(typeof r.serviceRegion!="string"||!Array.isArray(r.items)||typeof r.pageNumber!="number"||typeof r.pageSize!="number"||typeof r.totalCount!="number"||typeof r.hasMore!="boolean")throw new Error(z("client.invalidCloudResources"));const s=r.items.map(o=>{if(!o||typeof o!="object"||typeof o.id!="string"||typeof o.name!="string"||typeof o.region!="string"||typeof o.status!="string")throw new Error(z("client.invalidCloudResources"));return o});return{serviceRegion:r.serviceRegion,items:s,pageNumber:r.pageNumber,pageSize:r.pageSize,totalCount:r.totalCount,hasMore:r.hasMore}}function SEe(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.mounts))throw new Error(z("client.invalidEnvironmentMount"));if(n.mounts.length!==t.length)throw new Error(z("client.environmentMountMismatch"));return n.mounts.map((i,r)=>{const s=t[r];if(!i||typeof i!="object"||typeof i.environment_id!="string"||typeof i.environment_version_id!="string"||typeof i.mount_instance_id!="string"||typeof i.sandbox_session_id!="string"||!i.environment_id||!i.environment_version_id||!i.mount_instance_id||!i.sandbox_session_id)throw new Error(z("client.invalidEnvironmentMount"));if(i.environment_id!==s.environment_id||i.environment_version_id!==s.environment_version_id||s.mount_instance_id!==void 0&&i.mount_instance_id!==s.mount_instance_id)throw new Error(z("client.environmentMountMismatch"));return i})}async function EEe({runtimeId:e,appName:t,userId:n,sessionId:i,environmentMounts:r}){const{app:s}=fc(t);let o;try{o=await $t("/web/v3/session-environment-mounts/prepare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtime_id:e,app_name:s,user_id:n,session_id:i,environment_mounts:[...r]})})}catch(l){throw l instanceof TypeError?new Error(z("client.environmentMountNetworkFailed")):l}if(!o.ok)throw new Error(await fn(o,z("client.environmentMountFailed")));return SEe(await o.json(),r)}function pU(e){const t=new Set,n=[];for(const i of e.split(/[,,\n\r]+/)){const r=i.trim();!r||t.has(r)||(t.add(r),n.push(r))}return n}async function CEe(e,t=typeof navigator>"u"?void 0:navigator.clipboard){if(!(t!=null&&t.writeText))throw new Error(z("client.clipboardUnsupported"));try{await t.writeText(e)}catch{throw new Error(z("client.clipboardWriteFailed"))}}const LX={codex:0,codex_snapshot:1,deepseek_harness:2,deepseek_harness_snapshot:3,openclaw:4,openclaw_snapshot:5,hermes:6,hermes_snapshot:7,dev:8};async function TEe(e){var r;const t=await $t("/web/system-info",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadSystemInfoFailed")));const n=await t.json();if(typeof((r=n.storage)==null?void 0:r.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error(z("client.invalidSystemInfo"));const i=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean"||typeof s.needsModelEnvUpdate!="boolean"||typeof s.canUpdateModelEnv!="boolean"||typeof s.modelEnvError!="string"||typeof s.modelEnvErrorCode!="string")throw new Error(z("client.invalidSystemInfo"));return s}).sort((s,o)=>(LX[s.kind]??Number.MAX_SAFE_INTEGER)-(LX[o.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:i}}const AEe=new Set(["preparing","queued","building","scanning","available","failed"]);function mU(e){if(e===null)return null;if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentBuild"));const t=e;if(typeof t.versionId!="string"||!AEe.has(t.status)||typeof t.image!="string"||typeof t.error!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.resources!==null&&typeof t.resources!="object")throw new Error(z("client.invalidEnvironmentBuild"));const n=Array.isArray(t.steps)?t.steps.map(i=>{if(!i||typeof i!="object"||typeof i.key!="string"||typeof i.label!="string"||!["pending","running","succeeded","failed"].includes(i.status)||i.startedAt!==null&&typeof i.startedAt!="string"||i.finishedAt!==null&&typeof i.finishedAt!="string")throw new Error(z("client.invalidEnvironmentBuildStep"));return i}):[];return{...t,toolId:typeof t.toolId=="string"?t.toolId:"",toolStatus:["creating","ready","failed"].includes(t.toolStatus)?t.toolStatus:"",runId:typeof t.runId=="string"?t.runId:"",currentStep:typeof t.currentStep=="string"?t.currentStep:"",sourceCommitSha:typeof t.sourceCommitSha=="string"?t.sourceCommitSha:"",steps:n,progressError:typeof t.progressError=="string"?t.progressError:"",logTail:typeof t.logTail=="string"?t.logTail:"",logTruncated:t.logTruncated===!0,logUpdatedAt:typeof t.logUpdatedAt=="string"?t.logUpdatedAt:null,logError:typeof t.logError=="string"?t.logError:""}}function _Ee(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentManifest"));const t=e;if(!["agentkit.studio/v3","agentkit.studio/v1alpha1"].includes(t.apiVersion)||t.kind!=="Environment"||!t.metadata||typeof t.metadata.id!="string"||typeof t.metadata.name!="string"||typeof t.metadata.version!="string"||typeof t.metadata.description!="string"||!t.spec||typeof t.spec.image!="string"||!["ubuntu","aio-sandbox","codex-sandbox"].includes(t.spec.baseEnvironment)||typeof t.spec.baseImage!="string"||!["ubuntu-22.04","ubuntu-24.04"].includes(t.spec.operatingSystem)||!["python-3.10","python-3.12"].includes(t.spec.language)||t.spec.executionRuntime!=="veadk"||!Array.isArray(t.spec.packages)||!t.spec.packages.every(n=>typeof n=="string")||!Array.isArray(t.spec.capabilities)||!t.spec.capabilities.every(n=>typeof n=="string")||!Array.isArray(t.spec.skills)||!t.status||!AEe.has(t.status.phase)||typeof t.status.createdAt!="string"||typeof t.status.updatedAt!="string")throw new Error(z("client.invalidEnvironmentManifest"));return t}function jEe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error(z("client.invalidImageRepository"));const t=e;if(typeof t.region!="string"||typeof t.registry!="string"||typeof t.namespace!="string"||typeof t.repository!="string")throw new Error(z("client.invalidImageRepository"));return t}function BYe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error(z("client.invalidCodeRepository"));const t=e;if(typeof t.repositoryUrl!="string"||t.ref!==void 0&&typeof t.ref!="string"||typeof t.dockerfilePath!="string")throw new Error(z("client.invalidCodeRepository"));return t}function UYe(e){const t=jEe(e);if(!t)return;const n=e;if(typeof n.reference!="string")throw new Error(z("client.invalidImageSource"));return{...t,reference:n.reference}}function gU(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironment"));const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||t.baseEnvironment!==void 0&&t.baseEnvironment!=="ubuntu"&&t.baseEnvironment!=="aio-sandbox"&&t.baseEnvironment!=="codex-sandbox"||t.operatingSystem!=="ubuntu-22.04"&&t.operatingSystem!=="ubuntu-24.04"||t.language!=="python-3.10"&&t.language!=="python-3.12"||!Array.isArray(t.optionIds)||!t.optionIds.every(n=>typeof n=="string")||t.selectedSkills!==void 0&&!Array.isArray(t.selectedSkills)||typeof t.dockerfile!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error(z("client.invalidEnvironment"));return{...t,baseEnvironment:t.baseEnvironment==="aio-sandbox"?"aio-sandbox":t.baseEnvironment==="codex-sandbox"?"codex-sandbox":"ubuntu",selectedSkills:t.selectedSkills??[],gitSource:BYe(t.gitSource),containerRepository:jEe(t.containerRepository),imageSource:UYe(t.imageSource),latestVersion:mU(t.latestVersion)}}function NEe(e){if(!e||typeof e!="object")throw new Error(z("client.invalidWorkspace"));const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||!Array.isArray(t.environmentIds)||!t.environmentIds.every(n=>typeof n=="string")||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error(z("client.invalidWorkspace"));return t}async function bU(e){const t=await $t("/web/workspaces",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadWorkspacesFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidWorkspaceList"));return n.items.map(NEe)}async function REe(e,t,n,i){const r=await $t(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});if(!r.ok)throw new Error(await fn(r,z("client.saveWorkspaceFailed")));return NEe(await r.json())}function IEe(e,t){return REe("/web/workspaces","POST",e,t)}function PEe(e,t,n){return REe(`/web/workspaces/${encodeURIComponent(e)}`,"PATCH",t,n)}async function DEe(e,t){const n=await $t(`/web/workspaces/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.deleteWorkspaceFailed")))}async function fC(e){const t=await $t("/web/v3/environments",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadEnvironmentsFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidEnvironmentList"));return n.items.map(gU)}async function MEe(e,t){const n=await $t("/web/v3/environment-repositories/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.probeRepositoryFailed")));const i=await n.json();if(typeof i.repositoryUrl!="string"||typeof i.ref!="string"||typeof i.commitSha!="string"||!Array.isArray(i.dockerfiles)||!i.dockerfiles.every(r=>typeof r=="string"))throw new Error(z("client.invalidRepositoryProbe"));return i}async function LEe(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}/share-code`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.exportEnvironmentCodeFailed")));const i=await n.json();if(typeof i.shareCode!="string"||typeof i.name!="string")throw new Error(z("client.invalidEnvironmentCode"));return i}async function $Ee(e,t){const n=await $t("/web/v3/environment-share-codes/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.inspectEnvironmentCodeFailed")));const i=await n.json();if(!Array.isArray(i.items))throw new Error(z("client.invalidEnvironmentCodeInspection"));return i.items.map(r=>{if(!r||typeof r!="object")throw new Error(z("client.invalidEnvironmentCodeInspection"));const s=r,o=s.status==="valid"||s.valid===!0?"valid":s.status==="invalid"||s.valid===!1?"invalid":null;if(!Number.isInteger(s.index)||o===null||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error(z("client.invalidEnvironmentCodeInspection"));return{index:s.index,status:o,name:s.name??"",error:s.error??""}})}async function FEe(e,t){const n=await $t("/web/v3/environment-share-codes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await fn(n,z("client.importEnvironmentCodeFailed")));const i=await n.json();if(!Array.isArray(i.items))throw new Error(z("client.invalidEnvironmentCodeImport"));return i.items.map(r=>{if(!r||typeof r!="object")throw new Error(z("client.invalidEnvironmentCodeImport"));const s=r;if(!Number.isInteger(s.index)||!(s.status==="created"||s.status==="duplicate"||s.status==="failed")||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error(z("client.invalidEnvironmentCodeImport"));return{index:s.index,status:s.status,name:s.name??"",environment:s.environment===void 0||s.environment===null?void 0:gU(s.environment),error:s.error??""}})}async function BEe(e,t,n,i){let r;try{r=await $t(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i})}catch(s){throw s instanceof DOMException&&s.name==="AbortError"?s:s instanceof TypeError?new Error(z("client.studioUnavailable")):s}if(!r.ok)throw new Error(await fn(r,z("client.saveEnvironmentFailed")));return gU(await r.json())}function UEe(e,t){return BEe("/web/v3/environments","POST",e,t)}function QEe(e,t,n){return BEe(`/web/v3/environments/${encodeURIComponent(e)}`,"PATCH",t,n)}async function zEe(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.deleteEnvironmentFailed")))}async function I6(e,t){const n=await $t(`/web/v3/environments/${encodeURIComponent(e)}/build`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.startEnvironmentBuildFailed")));const i=mU(await n.json());if(!i)throw new Error(z("client.invalidEnvironmentBuild"));return i}async function VEe(e,t,n={}){const i=n.includeLogs?"?includeLogs=true":"",r=await $t(`/web/v3/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}${i}`,{signal:n.signal});if(!r.ok)throw new Error(await fn(r,z("client.loadEnvironmentBuildFailed")));const s=mU(await r.json());if(!s)throw new Error(z("client.invalidEnvironmentBuild"));return s}async function HEe(e,t,n){const i=await $t(`/web/v3/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}/manifest`,{signal:n});if(!i.ok)throw new Error(await fn(i,z("client.loadEnvironmentManifestFailed")));return _Ee(await i.json())}function $X(e){if(!e||typeof e!="object")throw new Error(z("client.invalidEnvironmentResource"));const t=e;if(t.source!=="provided"&&t.source!=="managed"||typeof t.consoleUrl!="string")throw new Error(z("client.invalidEnvironmentResource"));return t}async function qEe(e){const t=await $t("/web/v3/environment-resources",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadEnvironmentResourcesFailed")));const n=await t.json();if(n.provider!=="volcengine"&&n.provider!=="byteplus"||typeof n.region!="string")throw new Error(z("client.invalidEnvironmentResource"));return{provider:n.provider,region:n.region,codePipeline:$X(n.codePipeline),containerRegistry:$X(n.containerRegistry)}}async function QYe(e,t){const n=await $t(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/model-env`,{method:"POST",signal:t});if(!n.ok)throw new Error(await fn(n,z("client.updateCodexSandboxFailed")));const i=await n.json();if(i.kind!=="codex"&&i.kind!=="codex_snapshot"||typeof i.toolId!="string"||typeof i.updated!="boolean")throw new Error(z("client.invalidCodexSandboxUpdate"));return i}async function PI(e){const t=await $t("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadUserPoolsFailed")));const n=await t.json();if(!Array.isArray(n.items))throw new Error(z("client.invalidUserPoolList"));return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error(z("client.invalidUserPoolList"));return i})}class FX extends Error{constructor(t,n){super(n),this.status=t,this.name="DeploymentRecoveryHttpError"}}const Ik=new Map;function zYe(e){if(typeof e=="string")return e?{message:e}:null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.message=="string"?t.message:typeof t.error=="string"?t.error:"";return n?{message:n,phase:typeof t.phase=="string"?t.phase:void 0,runtimeId:typeof t.runtimeId=="string"?t.runtimeId:void 0,logPath:typeof t.logPath=="string"?t.logPath:void 0}:null}class Pk extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function Op(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),i=zYe(n.detail??n.error);if(i)return new Pk(i)}catch{return new Pk({message:t})}return new Pk({message:z("client.syncGithubFailed",{status:e.status})})}async function WEe(e){const t=await $t("/web/github-delivery/source-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,region:e.region,cloudProvider:e.cloudProvider})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function KEe(e){const t=await $t("/web/github-delivery/cicd-pipeline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function GEe(e){const t=await $t("/web/github-delivery/init-main",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function VYe(e){const t=await $t("/web/github-delivery/source-sync/cicd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipelineId:e.pipelineId,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function XEe(e){const t=await $t(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await Op(t);const n=await t.json();return n.pipelineId?n:null}async function C_(e){const t=await $t(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await Op(t);return t.json()}async function YEe(e){const t=await $t("/web/github-delivery/rollback-pr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Op(t);return t.json()}async function yU(e){const t=await $t("/web/github-cicd/runtime-binding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Op(t);return t.json()}async function ZEe(e){const t=await $t("/web/github-cicd/runtime-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,project:e.project})},{},0);if(!t.ok)throw await Op(t);return t.json()}async function Qy(e,t,n,i){var h,m,g,b,v;const r=i==null?void 0:i.taskId,s=r?new AbortController:void 0;r&&s&&Ik.set(r,s);const o=()=>{r&&Ik.get(r)===s&&Ik.delete(r)},l=async y=>{if(KSe(y))throw y;if(!r||!(i!=null&&i.runtimeId)||typeof i.baseRuntimeVersion!="number")throw new w_({taskId:r,cause:y});const x=await lYe({signal:s==null?void 0:s.signal,shouldRetry:w=>!(w instanceof FX)||w.status===404||w.status===408||w.status===429||w.status>=500,load:async w=>{const O=await $t("/web/deploy-agentkit/status",{method:"POST",headers:{"Content-Type":"application/json"},signal:w,body:JSON.stringify({taskId:r,runtimeId:i.runtimeId,runtimeName:i.runtimeName,appName:i.appName??e,region:n.region,projectName:n.projectName,baseRuntimeVersion:i.baseRuntimeVersion})},{},3e4);if(!O.ok)throw new FX(O.status,await fn(O,z("client.deploymentFailed")));return O.json()}});if(!x)throw new w_({taskId:r,cause:y});return x};let c=null,u=null;try{const y=!!(i!=null&&i.migrationTaskId);(h=i==null?void 0:i.onStage)==null||h.call(i,{level:"info",phase:"upload",message:z(y?"client.validatingMigrationArtifact":"client.uploadingCodePackage"),pct:0}),c=await $t("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:r,migrationTaskId:i==null?void 0:i.migrationTaskId,runtimeId:i==null?void 0:i.runtimeId,runtimeName:i==null?void 0:i.runtimeName,appName:i==null?void 0:i.appName,editMode:i==null?void 0:i.editMode,draft:i==null?void 0:i.draft,updateEtag:i==null?void 0:i.updateEtag,baseRuntimeVersion:i==null?void 0:i.baseRuntimeVersion,removeRuntimeEnvKeys:i==null?void 0:i.removeRuntimeEnvKeys,mcpSecretValues:i==null?void 0:i.mcpSecretValues,mcpCredentialReuses:i==null?void 0:i.mcpCredentialReuses,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:oYe((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs,resources:i==null?void 0:i.resources,source:(i==null?void 0:i.source)??(i!=null&&i.migrationTaskId?{kind:"migration",migrationId:i.migrationTaskId}:{kind:"inlineFiles"}),harnessSidecar:i==null?void 0:i.harnessSidecar,environment:i==null?void 0:i.environment})},{},0),(m=i==null?void 0:i.onStage)==null||m.call(i,{level:"success",phase:"upload",message:z(y?"client.migrationArtifactValidated":"client.codePackageUploaded"),pct:100})}catch(y){try{u=await l(y)}finally{o()}}if(c&&!c.ok){const y=await fn(c,z("client.deploymentFailed"));throw o(),new Error(y)}if(c)try{for await(const y of AI(c)){const x=y;if(x&&x.done){u=x;break}x&&x.message&&((g=i==null?void 0:i.onStage)==null||g.call(i,x))}}catch(y){try{u=await l(y)}finally{o()}}if(u)o();else try{u=await l()}finally{o()}if(!u.success){const y=new Error(u.error||z("client.deploymentFailed"));throw WSe(y)?new w_({taskId:r,cause:y}):y}if(!u.agentName)throw new Error(z("client.deploymentMissingAgentName"));if(!u.runtimeId&&!u.url)throw new Error(z("client.deploymentMissingConnection"));const d=(b=u.runtimeName)!=null&&b.trim()?u.agentName:e,f=((v=u.runtimeName)==null?void 0:v.trim())||u.agentName;return{apikey:u.apikey??"",url:u.url??"",agentName:d,runtimeName:f,runtimeId:u.runtimeId,consoleUrl:u.consoleUrl,region:u.region,version:u.version,warnings:u.warnings,feishuChannel:u.feishuChannel}}async function JEe(e){var n;const t=await $t("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||z("client.cancelDeploymentFailed",{status:t.status}))}(n=Ik.get(e))==null||n.abort(),Ik.delete(e)}async function HYe(e=nU){const t=await $t(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(z("client.loadFailed",{status:t.status}));return(await t.json()).runtimes??[]}const PS={title:"AgentKit Studio",logoUrl:""},P6={enabled:!1},TL={studio:!1,version:"",provider:"volcengine",branding:PS,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:P6};function qYe(e){if(!e||typeof e!="object")return P6;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return P6;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:"",accountIdResolutionError:typeof n.accountIdResolutionError=="string"?n.accountIdResolutionError:""}}}async function eCe(){var e,t;try{const n=await $t("/web/ui-config");if(!n.ok)return TL;const i=await n.json(),r=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:PS.logoUrl,s=i.provider==="byteplus"?"byteplus":"volcengine";return iEe(s),{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",provider:s,branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:PS.title,logoUrl:r?Zo(r):""},features:{...TL.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local",telemetry:qYe(i.telemetry)}}catch{return TL}}const tCe={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,createPersonalAgents:!1,manageAgents:!1,runtimeScope:"mine",manageUsers:!1}};async function nCe(){var n,i,r,s,o,l;const e=await $t("/web/access");if(!e.ok)throw new Error(z("client.loadPermissionsFailed",{status:e.status}));const t=await e.json();if(!["super_admin","admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((i=t.capabilities)==null?void 0:i.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.createPersonalAgents)!="boolean"||typeof((s=t.capabilities)==null?void 0:s.manageAgents)!="boolean"||((o=t.capabilities)==null?void 0:o.manageUsers)!==void 0&&typeof t.capabilities.manageUsers!="boolean"||!["all","mine"].includes((l=t.capabilities)==null?void 0:l.runtimeScope))throw new Error(z("client.invalidPermissionResponse"));return t}async function iCe(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",r=await $t(`/web/studio-update${i}`);if(!r.ok)throw new Error(z("client.checkStudioUpdateFailed",{status:r.status}));return await r.json()}async function rCe(){const e=await $t("/web/studio-update/permissions");if(!e.ok){let t="";try{const n=await e.json();t=typeof n.detail=="string"?n.detail:""}catch{t=""}throw new Error(t||z("client.studioUpdatePreflightFailed",{status:e.status}))}return await e.json()}async function sCe(e){const t=await $t("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},xr);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||z("client.submitStudioUpdateFailed",{status:t.status}))}return await t.json()}async function oCe({runtimeId:e,region:t,appName:n,page:i=1,pageSize:r=20,signal:s}){const o=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(i),pageSize:String(r)}),l=await $t(`/web/agent-usage?${o.toString()}`,{signal:s});if(!l.ok)throw new Error(await fn(l,z("client.loadAgentUsageFailed")));const c=l.headers.get("content-type")||z("client.notProvided"),u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(z("client.agentUsageNonJson",{status:l.status,contentType:c})+z("client.checkStudioGateway"));try{return await l.json()}catch{throw new Error(z("client.agentUsageInvalidJson",{status:l.status,contentType:c})+z("client.retryCheckGateway"))}}function kp(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function D6(e){const t=await $t(kp(),{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadCronJobsFailed")));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function WYe(e,t){const n=await $t(kp(e),{signal:t});if(!n.ok)throw new Error(await fn(n,z("client.loadCronJobFailed")));return await n.json()}async function aCe(e){const t=await $t(kp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,z("client.createCronJobFailed")));return await t.json()}async function lCe(e,t){const n=await $t(`${kp(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await fn(n,z("client.updateCronJobFailed")));return await n.json()}async function cCe(e,t){const n=t?"enable":"disable",i=await $t(`${kp(e)}/${n}`,{method:"POST"});if(!i.ok)throw new Error(await fn(i,z(t?"client.enableCronJobFailed":"client.pauseCronJobFailed")));return await i.json()}async function uCe(e){const t=await $t(`${kp(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await fn(t,z("client.runCronJobFailed")));return await t.json()}async function M6(e,t){const n=await $t(`${kp(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await fn(n,z("client.loadCronHistoryFailed")));const i=await n.json();return Array.isArray(i)?i:i.items??[]}async function dCe(e,t){const n=await $t(`${kp(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await fn(n,z("client.stopCronRunFailed")));return await n.json()}async function fCe(e){const t=await $t(kp(e),{method:"DELETE"});if(!t.ok)throw new Error(await fn(t,z("client.deleteCronJobFailed")))}class vU extends Error{constructor(t,n){super(t),this.status=n,this.name="RuntimeListError"}}async function Fw(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await $t(`/web/runtimes?${t.toString()}`,{signal:e.signal});if(!n.ok){const r=await fn(n,z("client.loadRuntimeFailed"));throw new vU(r,n.status)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function Vx(e,t,n={}){if(n.preferCached){const i=lU(e,t,n.currentVersion),r=Zv.get(i);if(r&&r.expiresAt>Date.now())return[...r.apps];r&&Zv.delete(i)}try{const i={runtimeId:e,region:t,runtimeVersion:n.currentVersion};return n.retryProbe&&(i.retryProbe=!0),await dC("","",i,n.signal,n.timeoutMs)}catch(i){if(i instanceof Lw||i instanceof co||i instanceof Error)throw i;return null}}async function hCe(e,t){const n=new URLSearchParams({region:t}),i=await $t(`/web/runtime-tool-channel/${encodeURIComponent(e)}/capabilities?${n.toString()}`);if(!i.ok)throw new co(await fn(i,z("client.loadLocalToolsFailed")),!1,!0);return await i.json()}async function pCe(e,t){const n=new URLSearchParams({region:t}),i=await $t(`/web/runtime-route-channel/${encodeURIComponent(e)}/connect?${n.toString()}`,{method:"POST"});if(!i.ok)throw new co(await fn(i,z("client.connectDynamicRouteFailed")),!1,!0);return await i.json()}async function mCe(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const r=await $t("/.well-known/agent-card.json",{},i),s=await rEe(r);if(s==="runtime_access_denied")throw new Lw;if(s==="runtime_private_endpoint_unreachable")throw new co(eEe());if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new co(tEe());if(r.status===404)return null;if(r.status===401||r.status===403)throw new co(z("client.a2aProbeDenied"));if(!r.ok)throw new Error(await fn(r,z("client.loadA2aCardFailed")));const o=await r.json().catch(()=>null),l=typeof(o==null?void 0:o.url)=="string"?o.url.trim():"";return l?{name:typeof(o==null?void 0:o.name)=="string"?o.name:"",description:typeof(o==null?void 0:o.description)=="string"?o.description:"",endpoint:l}:null}async function gCe(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await $t(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await fn(i,z("client.loadRuntimeApiKeyFailed")));const r=await i.json();if(typeof r.apiKey!="string"||!r.apiKey)throw new Error(z("client.runtimeApiKeyMissing"));return r.apiKey}async function bCe(e,t){const n=await $t("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||z("client.deleteFailed",{status:n.status}))}}async function yCe({runtimeId:e,region:t,appName:n,etag:i,signal:r}){const s=await $t("/web/runtime-mcp-credentials",{method:"POST",cache:"no-store",signal:r,headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t,appName:n,etag:i})});if(!s.ok)throw new Error(await fn(s,z("client.loadMcpCredentialsFailed")));const o=await s.json().catch(()=>null);if(!Array.isArray(o==null?void 0:o.credentials))throw new Error(z("client.invalidMcpCredentials"));return o.credentials.map(l=>{if(!l||typeof l!="object")throw new Error(z("client.invalidMcpCredentials"));const c=l,u={agentName:c.agentName,name:c.name,url:c.url,authTokenEnv:c.authTokenEnv,value:c.value};if(Object.values(u).some(d=>typeof d!="string"))throw new Error(z("client.invalidMcpCredentials"));return u})}function T_({runtimeId:e,region:t,appName:n,currentVersion:i}){return Uy(IS,t,e,i??"",(n==null?void 0:n.trim())??"")}async function KYe({runtimeId:e,region:t,appName:n,currentVersion:i,force:r=!1}){const s=new URLSearchParams({runtimeId:e,region:t});n&&s.set("appName",n),i!=null&&s.set("currentVersion",String(i)),r&&s.set("refresh","true");const o=await $t(`/web/runtime-update-capability?${s.toString()}`);if(!o.ok)throw new Error(await GYe(o));return await o.json()}function DI({runtimeId:e,region:t,appName:n,currentVersion:i,signal:r,force:s=!1}){var u,d;const o={runtimeId:e,region:t,appName:n,currentVersion:i},l=T_(o);if(s&&Br.delete(l),!s){const f=Tg(Br,l,$w);if(f)return fA(Promise.resolve(f),r);const h=(u=Br.get(l))==null?void 0:u.promise;if(h)return fA(h,r);if(n){const m=T_({...o,appName:""}),g=(d=Br.get(m))==null?void 0:d.promise;if(g){let b;return b=g.then(v=>{var x,w,O,S,k;if(v.recoveryStatus==="preparing")return((x=Br.get(l))==null?void 0:x.promise)===b&&Br.delete(l),v;const y=((O=(w=v.agent)==null?void 0:w.appName)==null?void 0:O.trim())??"";return y&&y!==n.trim()?(((S=Br.get(l))==null?void 0:S.promise)===b&&Br.delete(l),DI(o)):(((k=Br.get(l))==null?void 0:k.promise)===b&&Br.set(l,{value:v,updatedAt:Date.now()}),v)},v=>{var y;throw((y=Br.get(l))==null?void 0:y.promise)===b&&Br.delete(l),v}),Br.set(l,{promise:b,updatedAt:0}),fA(b,r)}}}let c;return c=KYe({...o,force:s}).then(f=>{var h,m,g,b,v;if(f.recoveryStatus==="preparing")return((h=Br.get(l))==null?void 0:h.promise)===c&&Br.delete(l),f;if(((m=Br.get(l))==null?void 0:m.promise)===c){Br.set(l,{value:f,updatedAt:Date.now()});const y=new Set(["",((b=(g=f.agent)==null?void 0:g.appName)==null?void 0:b.trim())??""]);for(const x of y){const w=T_({...o,appName:x});w!==l&&!((v=Br.get(w))!=null&&v.promise)&&Br.set(w,{value:f,updatedAt:Date.now()})}}return f},f=>{var h;throw((h=Br.get(l))==null?void 0:h.promise)===c&&Br.delete(l),f}),Br.set(l,{promise:c,updatedAt:0}),fA(c,r)}function L6({runtimeId:e,region:t,appName:n,currentVersion:i}){return Tg(Br,T_({runtimeId:e,region:t,appName:n,currentVersion:i}),$w)}function $6(e){return DI(e).then(()=>{},()=>{})}function F6(e,t){if(!e){Br.clear();return}for(const n of Br.keys()){const[i,r,s]=n.split("");i===IS&&s===e&&(!t||r===t)&&Br.delete(n)}}async function GYe(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?z("client.runtimeManageForbidden"):e.status===404?z(n==="runtime_not_found"?"client.runtimeNotFound":"client.runtimeUnavailable"):z("client.checkRuntimeUpdateFailed",{status:e.status})}async function XYe(e,t){let n=null;for(const i of uC(t)){const r=await $t(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(r.ok)return r.json();n=new Error(await fn(r,z("client.loadRuntimeDetailFailed")))}throw n??new Error(z("client.loadRuntimeDetailFailed"))}async function xU(e,t="cn-beijing",n={}){const i=Uy(e,t||"cn-beijing"),r=Tg(mb,i,$w);if(!n.force&&r)return r;const s=mb.get(i);if(!n.force&&(s!=null&&s.promise))return s.promise;const o=XYe(e,t).then(l=>cU(mb,i,l));mb.set(i,{...s,promise:o,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await o}finally{const l=mb.get(i);(l==null?void 0:l.promise)===o&&mb.set(i,{value:l.value,updatedAt:l.updatedAt})}}function vCe(e,t="cn-beijing"){return Tg(mb,Uy(e,t||"cn-beijing"),$w)}function xCe(e,t="cn-beijing"){xU(e,t).catch(()=>{})}const YYe=6e4;function ZYe(e){if(!e||typeof e!="object")return!1;const t="name"in e?e.name:void 0;if(t==="TimeoutError")return!0;if(t!=="AbortError")return!1;const n="message"in e?e.message:"";return typeof n!="string"||n===""||/abort/i.test(n)}async function Dk(e){let t;try{t=await $t("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})},{},YYe)}catch(n){throw ZYe(n)?new Error(z("client.generateProjectTimedOut")):n}if(!t.ok)throw new Error(await fn(t,z("client.generateProjectFailed")));return t.json()}const JYe=19e4,eZe=12e4;async function wCe(e){const t=await $t("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},JYe);if(!t.ok)throw new Error(await fn(t,z("client.generateAgentConfigFailed")));return TI(t,z("client.generateAgentConfigFailed"))}async function OCe(e,t){const n=await $t("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region,mcpCredentialReuses:t==null?void 0:t.mcpCredentialReuses})},{},eZe);if(!n.ok)throw new Error(await fn(n,z("client.createDebugRunFailed")));return TI(n,z("client.createDebugRunFailed"))}async function kCe(e,t){const n=await $t(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await fn(n,z("client.createDebugSessionFailed")));return(await TI(n,z("client.createDebugSessionFailed"))).id}async function SCe(e,t){const n=await $t(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await fn(n,z("client.loadDebugTraceFailed")));const i=await TI(n,z("client.loadDebugTraceFailed"));if(!Array.isArray(i))throw new Error(z("client.invalidDebugTrace"));return i}async function*ECe({runId:e,userId:t,sessionId:n,text:i,signal:r}){const s=i.trim()?[{text:i}]:[],o=OEe(r);let l;try{l=await $t(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:s},streaming:!0}),signal:o.signal},{},0)}catch(c){throw o.cleanup(),o.timedOut()?new Error(zx()):c}if(!l.ok)throw o.cleanup(),new Error(await fn(l,z("client.debugRunFailed")));try{for await(const c of AI(l))o.clearDeadline(),yield c}catch(c){throw o.timedOut()?new Error(zx()):c}finally{o.cleanup()}}async function rv(e){const t=await $t(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await fn(t,z("client.cleanupDebugRunFailed")))}function CCe(e){if(!e||typeof e!="object")throw new Error(z("client.invalidSandboxVersion"));const t=e;if(typeof t.toolId!="string"||typeof t.error!="string")throw new Error(z("client.invalidSandboxVersion"));if(!t.error&&(t.provider!=="volcengine"&&t.provider!=="byteplus"||typeof t.region!="string"||typeof t.status!="string"||typeof t.currentImage!="string"||typeof t.latestImage!="string"||typeof t.needsImageUpdate!="boolean"||typeof t.canUpdate!="boolean"||typeof t.needsModelEnvUpdate!="boolean"||typeof t.canUpdateModelEnv!="boolean"||typeof t.modelEnvError!="string"))throw new Error(z("client.invalidSandboxVersion"));return t}async function TCe(e){const t=await $t("/web/system-info/sandbox-tools/updates",{signal:e});if(!t.ok)throw new Error(await fn(t,z("client.loadSandboxVersionsFailed")));const n=await t.json();if(!Array.isArray(n.tools))throw new Error(z("client.invalidSandboxVersion"));return n.tools.map(CCe)}async function ACe(e){const t=await $t(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/update`,{method:"POST"},{},33e4);if(!t.ok)throw new Error(await fn(t,z("client.updateSandboxFailed")));const n=await t.json();if(typeof n.updated!="boolean")throw new Error(z("client.invalidSandboxUpdate"));return{updated:n.updated,state:CCe(n.state)}}const tZe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:PS,DEFAULT_STUDIO_ACCESS:tCe,GithubCicdPipelineError:Pk,RuntimeAccessDeniedError:Lw,RuntimeListError:vU,RuntimeProbeError:co,attachGithubDeliveryCicdToSourceSync:VYe,bindGithubCicdRuntime:yU,buildEnvironment:I6,cancelAgentkitDeployment:JEe,cancelCronJobRun:dCe,checkRuntimeNameAvailability:II,clearMessageFeedbackCache:GSe,clearRemoteApps:YSe,componentSearch:vEe,createCronJob:aCe,createEnvironment:UEe,createGeneratedAgentTestRun:OCe,createGeneratedAgentTestSession:kCe,createGithubCicdPipeline:WEe,createGithubDeliveryCicdPipeline:KEe,createGithubDeliveryRollbackPr:YEe,createSession:sEe,createWorkspace:IEe,deleteAgentFeedbackCases:dEe,deleteCronJob:fCe,deleteEnvironment:zEe,deleteGeneratedAgentTestRun:rv,deleteMedia:S_,deleteRuntime:bCe,deleteSession:A6,deleteSessionMedia:_6,deleteWorkspace:DEe,deployAgentkitProject:Qy,downloadArtifact:dU,ensureRuntimeRouteChannel:pCe,exportEnvironmentShareCode:LEe,fetchRemoteApps:dC,generateAgentDraftFromRequirement:wCe,generateAgentProject:Dk,getAgentFeedbackCases:RI,getAgentInfo:N6,getAgentOptimizations:aEe,getAgentUsage:oCe,getAutomaticEvaluationStatuses:T6,getCachedAgentFeedbackCases:lEe,getCachedRuntimeAgentInfo:bEe,getCachedRuntimeDetail:vCe,getCachedRuntimeUpdateCapability:L6,getCronJob:WYe,getEnvironmentBuild:VEe,getEnvironmentManifest:HEe,getEnvironmentResources:qEe,getGeneratedAgentTestTrace:SCe,getGithubCicdRuntimeBinding:XEe,getGithubDeliveryVersions:C_,getMediaCapabilities:LYe,getMyRuntimes:HYe,getRuntimeAgentInfo:hU,getRuntimeDetail:xU,getRuntimeMcpCredentials:yCe,getRuntimeStudioToolCapabilities:hCe,getRuntimeUpdateCapability:DI,getRuntimes:Fw,getSandboxImageUpdates:TCe,getSession:NI,getSessionTrace:lN,getStudioAccess:nCe,getStudioUpdatePermissions:rCe,getStudioUpdateStatus:iCe,getSystemInfo:TEe,getUiConfig:eCe,httpErrorMessage:fn,importEnvironmentShareCodes:FEe,initializeGithubDeliveryMain:GEe,inspectEnvironmentRepository:MEe,inspectEnvironmentShareCodes:$Ee,invalidateRuntimeUpdateCapabilityCache:F6,listApps:JSe,listCronJobRuns:M6,listCronJobs:D6,listDeploymentResources:kEe,listEnvironments:fC,listIdentityUserPools:PI,listModelApiKeys:aU,listModelOptions:Mw,listSessions:uU,listWorkspaces:bU,mediaContentUrl:mEe,parseEnvironmentManifest:_Ee,parseEnvironmentShareCodes:pU,parsePreparedSessionEnvironmentMounts:SEe,prefetchAgentFeedbackCases:DYe,prefetchRuntimeAgentInfo:yEe,prefetchRuntimeDetail:xCe,prefetchRuntimeUpdateCapability:$6,prepareSessionEnvironmentMounts:EEe,previewArtifact:fU,probeRuntimeA2a:mCe,probeRuntimeApps:Vx,refreshAgentFeedbackCases:cEe,registerRemoteApp:XSe,revealModelApiKey:ZSe,revealRuntimeApiKey:gCe,runCronJobNow:uCe,runGeneratedAgentTestSSE:ECe,runSSE:R6,runSseEmptyResponseError:wEe,runSseFirstEventTimeoutError:zx,runSseIncompleteResponseError:E_,runtimeRegionCandidates:uC,setClientCloudProvider:iEe,setCronJobEnabled:cCe,startStudioUpdate:sCe,studioFetch:gn,submitIssueFeedback:j6,submitMessageFeedback:oEe,syncGithubCicdRuntime:ZEe,updateCodexSandboxToolModelEnv:QYe,updateCronJob:lCe,updateEnvironment:QEe,updateSandboxTool:ACe,updateWorkspace:PEe,uploadMedia:hEe,upsertCachedAgentFeedbackCase:k_,webSearch:xEe,writeEnvironmentShareCode:CEe},Symbol.toStringTag,{value:"Module"})),nZe="/web/sandbox/sessions",BX="/web/sandbox/codex-project-handoff",UX=3e4,AL=33e4,iZe=6e4,rZe=6e5,G1=15e3,wh=6e4,sZe=33e4,QX=3e4,oZe=60*60,B6=40;function MI(e){const t=e.trim().toLowerCase();return["ready","running","wakeable"].includes(t)?"ready":t}function wU(e){switch(e.trim().toLowerCase()){case"ready":return z("sandbox.status.ready");case"wakeable":return z("sandbox.status.wakeable");case"creating":return z("sandbox.status.creating");case"starting":case"initializing":return z("sandbox.status.starting");case"pending":return z("sandbox.status.pending");case"running":return z("sandbox.status.running");case"failed":case"error":return z("sandbox.status.failed");case"stopped":return z("sandbox.status.stopped");case"expired":return z("sandbox.status.expired");case"deleting":return z("sandbox.status.deleting");case"deleted":return z("sandbox.status.deleted");default:return z("sandbox.status.unknown")}}function Yr(e){const t=Pl(e);return t.has("Accept")||t.set("Accept","application/json"),t}class OU extends Error{constructor(n,i={}){var r;super(n);rn(this,"code");rn(this,"retryable");rn(this,"publicMessage");rn(this,"httpStatus");this.name="SandboxServiceError",this.code=i.code??"",this.retryable=i.retryable===!0,this.publicMessage=((r=i.publicMessage)==null?void 0:r.trim())||n,this.httpStatus=i.httpStatus}}function aZe(e){return e instanceof OU?e.publicMessage:e instanceof Error&&e.name==="TimeoutError"?z("sandbox.developmentTimeout"):e instanceof TypeError?z("sandbox.developmentDisconnected"):z("sandbox.developmentFailed")}async function Es(e,t){const n=await e.text().catch(()=>"");let i={};try{i=JSON.parse(n)}catch{const d=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status});return new Error(n?z("common.fallbackWithDetail",{fallback:d,detail:n}):d)}const r=i.detail,s=r&&typeof r=="object"?r:i,o=r&&typeof r=="object"&&"message"in r?r.message:r??i.error??i.message,l=typeof o=="string"?o:o==null?"":JSON.stringify(o),c=z("common.fallbackWithHttpStatus",{fallback:t,status:e.status}),u=l?z("common.fallbackWithDetail",{fallback:c,detail:l}):c;return new OU(u,{code:typeof s.code=="string"?s.code:"",retryable:s.retryable===!0,publicMessage:l||c,httpStatus:e.status})}async function zX(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(z("sandbox.invalidStudioResponse",{fallback:t}))}}function Xg(e,t="codex",n=e.toolName==="intelligent-development"){if(!e.sessionId||!e.status)throw new Error(z("sandbox.invalidSession"));return{resourceType:"session",id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",persistent:e.persistent!==!1,toolType:e.toolType??"",intelligentDevelopment:n,createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0,threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:LI(e.permissions),...e.conversation===void 0?{}:{restoredConversation:gb(e.conversation)}}}function VX(e,t="codex"){if(!e.snapshotId||!e.status)throw new Error(z("sandbox.invalidSnapshot"));return{resourceType:"snapshot",id:e.snapshotId,snapshotId:e.snapshotId,sourceSessionId:e.sessionId??"",toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,snapshotStatus:e.snapshotStatus??"Unknown",reason:e.reason??"",createdAt:e.createdAt??"",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0}}function HX(e,t){if((t==null?void 0:t.autoResumeSnapshots)===void 0)return e;const n=new URLSearchParams({autoResumeSnapshots:String(t.autoResumeSnapshots)});return`${e}?${n.toString()}`}const X1={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function LI(e){if(!e||typeof e!="object")return{...X1};const t=e,n=t.approvalPolicy,i=t.approvalsReviewer,r=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:X1.approvalPolicy,approvalsReviewer:i==="user"||i==="auto_review"?i:X1.approvalsReviewer,sandboxMode:r==="read-only"||r==="workspace-write"||r==="danger-full-access"?r:X1.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:X1.networkAccess}}function qX(e){if(!e||typeof e!="object")throw new Error(z("sandbox.invalidSettings"));const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:LI(t.permissions)}}function oo(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function lZe(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function cZe(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function _Ce(e){const t=oo(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function gb(e){const t=oo(e),n=_Ce(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error(z("sandbox.invalidThreadSnapshot"));const i=t.messages.flatMap(r=>{const s=oo(r);if(!s||typeof s.id!="string"||s.role!=="user"&&s.role!=="assistant"||typeof s.content!="string"||typeof s.timestamp!="number")return[];const o=Array.isArray(s.skillNames)?s.skillNames.filter(c=>typeof c=="string"&&!!c):[],l=Array.isArray(s.images)?s.images.flatMap(c=>{const u=oo(c);return!u||typeof u.mimeType!="string"||!u.mimeType.startsWith("image/")||typeof u.data!="string"||!u.data?[]:[{mimeType:u.mimeType,data:u.data,...typeof u.name=="string"&&u.name?{name:u.name}:{},...typeof u.alt=="string"&&u.alt?{alt:u.alt}:{}}]}):[];return[{id:s.id,role:s.role,content:s.content,timestamp:s.timestamp,...o.length?{skillNames:o}:{},...l.length?{images:l}:{}}]});return{thread:n,threadId:t.threadId,messages:i,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:LI(t.permissions)}}function U6(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(i=>typeof i!="number"||!Number.isFinite(i)||i<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function uZe(e){const t=U6(e.usage);if(!t||typeof e.turnId!="string")return;const n=U6(e.threadTotal),i=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof i=="number"&&Number.isFinite(i)&&i>=0?{modelContextWindow:Math.trunc(i)}:{}}}function dZe(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}function jCe(e={}){let t="";const n=[],i=new Map,r=new Map;let s,o;function l(){var h;const f=s?[...n,s]:n;(h=e.onBlocks)==null||h.call(e,[...f])}function c(f){t+=f;const h=n[n.length-1],m=n.length-1,g=[...i.values()].includes(m);(h==null?void 0:h.kind)==="text"&&!g?n[m]={...h,text:h.text+f}:n.push({kind:"text",text:f}),l()}function u(f){if(typeof f.id!="string"||f.kind!=="thinking"&&f.kind!=="commentary"&&f.kind!=="tool"||f.status!=="running"&&f.status!=="done"&&f.status!=="error")return;const h=f.status!=="running";let m;if(f.kind==="thinking")m={kind:"thinking",text:typeof f.text=="string"?f.text:"",done:h};else if(f.kind==="commentary"){if(typeof f.text!="string"||!f.text)return;m={kind:"text",text:f.text}}else{if(typeof f.name!="string"||!f.name)return;m={kind:"tool",name:f.name,args:f.args,response:f.response,status:f.status==="error"?"failed":h?"completed":"running",done:h}}m={...m,id:f.id,...typeof f.itemType=="string"?{itemType:f.itemType}:{},...typeof f.phase=="string"?{phase:f.phase}:{},...typeof f.durationMs=="number"?{durationMs:f.durationMs}:{}};const g=i.get(f.id);g===void 0?(i.set(f.id,n.length),n.push(m)):n[g]=m,l()}function d(f){var b,v,y,x;let h="message";const m=[];for(const w of f.split(/\r?\n/))w.startsWith("event:")&&(h=w.slice(6).trim()),w.startsWith("data:")&&m.push(w.slice(5).trimStart());if(m.length===0)return;let g;try{g=JSON.parse(m.join(` +`))}catch{throw new Error(z("sandbox.invalidConversationResponse"))}if(h==="error"){const w=typeof g.message=="string"&&g.message?g.message:z("sandbox.conversationFailed");throw new OU(w,{code:typeof g.code=="string"?g.code:"",retryable:g.retryable===!0,publicMessage:w})}if(h==="progress"&&typeof g.text=="string"&&(s=g.text?{kind:"progress",text:g.text}:void 0,l()),["activity","delta","tool_output","tool_progress","plan","diff"].includes(h)&&(s=void 0),h==="activity"&&u(g),(h==="tool_output"||h==="tool_progress")&&typeof g.id=="string"){const w=i.get(g.id),O=w===void 0?void 0:n[w];if((O==null?void 0:O.kind)==="tool"&&w!==void 0&&typeof g.text=="string"){const S=oo(O.response)||{};n[w]=h==="tool_progress"?{...O,progressText:g.text}:{...O,response:{...S,output:(g.snapshot?"":String(S.output||""))+g.text}},l()}}if((h==="plan"||h==="diff")&&typeof g.id=="string"){const w=typeof g.text=="string"?g.text:"",O=Array.isArray(g.items)?g.items:Array.isArray(g.plan)?g.plan:[],S=h==="diff"?{kind:"diff",id:g.id,text:w,done:g.status==="done"}:{kind:"plan",id:g.id,title:z("developmentRuns.plan"),summary:w,done:g.status==="done",items:O.flatMap(C=>{const E=oo(C);if(!E||typeof(E.text??E.step)!="string")return[];const R=E.status==="inProgress"?"in_progress":E.status;return[{text:String(E.text??E.step),status:R==="completed"||R==="failed"||R==="in_progress"?R:"pending"}]})},k=i.get(g.id);k===void 0?(i.set(g.id,n.length),n.push(S)):n[k]=S,l()}if(h==="development.source_ready"||h==="development.succeeded"){const w=oo(g.payload),O=oo(w==null?void 0:w.delivery),S=h==="development.succeeded";if(O&&typeof O.sessionId=="string"&&typeof O.artifactSha256=="string"&&typeof O.validationReportSha256=="string"&&typeof O.agentName=="string"&&typeof O.entryPoint=="string"&&typeof O.fileCount=="number"&&typeof O.artifactSize=="number"&&typeof O.validatedAt=="string"&&O.deployable===!0&&O.verified===S&&typeof O.validationSummary=="string"&&Array.isArray(O.gateSummary)&&O.gateSummary.every(k=>typeof k=="string")){const k={kind:"delivery",value:{sessionId:O.sessionId,...typeof O.projectId=="string"&&typeof O.versionId=="string"?{projectId:O.projectId,versionId:O.versionId,...O.parentVersionId===null||typeof O.parentVersionId=="string"?{parentVersionId:O.parentVersionId}:{}}:{},artifactSha256:O.artifactSha256,validationReportSha256:O.validationReportSha256,agentName:O.agentName,entryPoint:O.entryPoint,fileCount:O.fileCount,artifactSize:O.artifactSize,validatedAt:O.validatedAt,gateSummary:O.gateSummary,deployable:O.deployable,verified:O.verified,validationSummary:O.validationSummary}},C=n.findIndex(E=>E.kind==="delivery"&&E.value.sessionId===O.sessionId&&E.value.artifactSha256===O.artifactSha256&&E.value.validationReportSha256===O.validationReportSha256);C===-1?n.push(k):n[C]=k,l()}}if(h==="approval"){const w=dZe(g);w&&((b=e.onApproval)==null||b.call(e,w))}if(h==="usage"){const w=uZe(g);w&&(o=w,(v=e.onUsage)==null||v.call(e,w))}if(h==="approval_resolved"&&typeof g.approvalId=="string"&&((y=e.onApprovalResolved)==null||y.call(e,g.approvalId)),h==="delta"&&typeof g.text=="string")if(typeof g.id=="string"&&g.id){const w=r.get(g.id),O=w===void 0?void 0:n[w],S=((x=oo(g))==null?void 0:x.snapshot)===!0;(O==null?void 0:O.kind)==="text"?n[w]={...O,phase:typeof g.phase=="string"&&g.phase?g.phase:O.phase,text:S?O.text.startsWith(g.text)?O.text:g.text:O.text+g.text}:(r.set(g.id,n.length),n.push({kind:"text",text:g.text,id:g.id,itemType:typeof g.itemType=="string"?g.itemType:void 0,phase:typeof g.phase=="string"?g.phase:void 0})),t=n.filter(k=>k.kind==="text").map(k=>k.text).join(""),l()}else c(g.text);if(h==="done"&&!t&&typeof g.text=="string"&&c(g.text),h==="done"){for(let w=0;w({text:t,blocks:n.map(f=>({...f})),...o?{usage:o}:{}})}}async function fZe(e,t={}){if(!e.body)throw new Error(z("sandbox.emptyConversationResponse"));const n=e.body.getReader(),i=new TextDecoder;let r="";const s=jCe(t);for(;;){const{done:l,value:c}=await n.read();r+=i.decode(c,{stream:!l});const u=r.split(/\r?\n\r?\n/);if(r=u.pop()??"",u.forEach(s.consumeFrame),l)break}r.trim()&&s.consumeFrame(r),s.consumeFrame(`event: done +data: {}`);const o=s.result();if(o.blocks.length===0)throw new Error(z("sandbox.emptyReply"));return o}async function Cc(e,t,n,{method:i="GET",body:r,options:s={},fallback:o}){if(!t)throw new Error(z("sandbox.missingSession"));const l=await gn(`${e}/${encodeURIComponent(t)}/${n}`,{method:i,headers:Yr(r===void 0?void 0:{"Content-Type":"application/json"}),...r===void 0?{}:{body:JSON.stringify(r)},signal:s.signal},wh);if(!l.ok)throw await Es(l,o);return l.json()}function NCe(e,t={}){return{async listSessions(n={}){const i=await gn(HX(e,n),{method:"GET",headers:Yr(),signal:n.signal},UX);if(!i.ok)throw await Es(i,z("sandbox.listCodexFailed"));const r=await i.json();if(!Array.isArray(r.sessions))throw new Error(z("sandbox.invalidSessionList"));if(r.snapshots!==void 0&&!Array.isArray(r.snapshots))throw new Error(z("sandbox.invalidSnapshotList"));return[...r.sessions.map(s=>Xg(s,"codex",t.intelligentDevelopment)),...(r.snapshots??[]).map(s=>VX(s))]},async startSession(n={}){var s,o;const i=((s=n.displayName)==null?void 0:s.trim())??"",r=await gn(e,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({displayName:t.textOnly&&n.projectId?Array.from(i).slice(0,B6).join(""):i,...(o=n.modelId)!=null&&o.trim()?{modelId:n.modelId.trim()}:{},...t.textOnly&&n.projectId?{projectId:n.projectId,...n.baseVersionId?{baseVersionId:n.baseVersionId}:{}}:{},...t.textOnly?{}:{persistent:n.persistent??!0},...n.diskGb!==void 0?{diskGb:n.diskGb}:{}}),signal:n.signal},AL);if(!r.ok)throw await Es(r,z("sandbox.startFailed"));return Xg(await r.json(),"codex",t.intelligentDevelopment)},async listAgentSessions(n,i={}){const r=await gn(HX(`/web/${n}/sessions`,i),{method:"GET",headers:Yr(),signal:i.signal},UX);if(!r.ok)throw await Es(r,z("sandbox.listAgentFailed",{kind:n}));const s=await r.json();if(!Array.isArray(s.sessions))throw new Error(z("sandbox.invalidKindSessionList",{kind:n}));if(s.snapshots!==void 0&&!Array.isArray(s.snapshots))throw new Error(z("sandbox.invalidKindSnapshotList",{kind:n}));return[...s.sessions.map(o=>Xg(o,n)),...(s.snapshots??[]).map(o=>VX(o,n))]},async startAgentSession(n,i={}){var s;const r=await gn(`/web/${n}/sessions`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=i.displayName)==null?void 0:s.trim())??"",persistent:i.persistent??!0,...i.diskGb!==void 0?{diskGb:i.diskGb}:{}}),signal:i.signal},AL);if(!r.ok)throw await Es(r,z("sandbox.createAgentFailed",{kind:n}));return Xg(await r.json(),n)},async openAgentSession(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSessionToOpen"));const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}/open`,{method:"POST",headers:Yr(),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.openAgentFailed",{kind:n}));const o=await s.json();if(typeof o.webuiUrl!="string"||!o.webuiUrl.startsWith("/"))throw new Error(z("sandbox.invalidAgentHomeUrl",{kind:n}));return{session:Xg(o,n),kind:n,webuiUrl:Zo(o.webuiUrl)}},async launchAgentTerminal(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSessionForTerminal"));const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}/terminal`,{method:"POST",headers:Yr(),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.openTerminalFailed",{kind:n}));const o=await s.json();return{url:RCe(o.url,`${n} Terminal`),...typeof o.shellSessionId=="string"?{shellSessionId:o.shellSessionId}:{}}},async deleteAgentSession(n,i,r={}){if(!i)return;const s=await gn(`/web/${n}/sessions/${encodeURIComponent(i)}`,{method:"DELETE",headers:Yr(),signal:r.signal},G1);if(!s.ok&&s.status!==404)throw await Es(s,z("sandbox.deleteAgentFailed",{kind:n}))},async resumeSnapshot(n,i,r={}){if(!i)throw new Error(z("sandbox.missingSnapshot"));const s=n==="codex"?"/web/sandbox":`/web/${n}`,o=await gn(`${s}/snapshots/${encodeURIComponent(i)}/resume`,{method:"POST",headers:Yr(),signal:r.signal},AL);if(!o.ok)throw await Es(o,z("sandbox.resumeSnapshotFailed"));return Xg(await o.json(),n)},async deleteSnapshot(n,i,r={}){if(!i)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,o=await gn(`${s}/snapshots/${encodeURIComponent(i)}`,{method:"DELETE",headers:Yr(),signal:r.signal},G1);if(!o.ok&&o.status!==404)throw await Es(o,z("sandbox.deleteSnapshotFailed"))},async connectSession(n,i={}){if(!n)throw new Error(z("sandbox.missingSessionToConnect"));const r=await gn(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),signal:i.signal},iZe);if(!r.ok)throw await Es(r,z("sandbox.connectCodexFailed"));const s=Xg(await r.json(),"codex",t.intelligentDevelopment);if(s.status.toLowerCase()!=="ready")throw new Error(z("sandbox.sessionNotReady",{status:s.status}));return s},async sendMessage(n,i={}){var s;if(!n.sessionId||!n.text.trim())throw new Error(z("sandbox.invalidMessage"));const r=await gn(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:Yr({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:n.text,...!t.textOnly&&((s=n.skillIds)!=null&&s.length)?{skillIds:n.skillIds}:{}}),signal:i.signal},t.messageTimeoutMs??rZe);if(!r.ok)throw await Es(r,z("sandbox.conversationFailed"));return fZe(r,i)},async interruptSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:Yr(),signal:i.signal},t.interruptTimeoutMs??G1);if(!r.ok&&![404,409].includes(r.status))throw await Es(r,z("sandbox.interruptFailed"))},async getStatus(n,i={}){const r=await Cc(e,n,"status",{options:i,fallback:z("sandbox.getStatusFailed")}),s=qX(r),o=oo(r),l=U6(o==null?void 0:o.threadTotal),c=o==null?void 0:o.modelContextWindow;return{...s,...l?{threadTotal:l}:{},...typeof c=="number"&&Number.isFinite(c)&&c>=0?{modelContextWindow:Math.trunc(c)}:{}}},async getEndpoint(n,i={}){const r=oo(await Cc(e,n,"endpoint",{options:i,fallback:z("sandbox.getEndpointFailed")}));if(typeof(r==null?void 0:r.endpoint)!="string"||!r.endpoint.trim())throw new Error(z("sandbox.invalidEndpoint"));return{endpoint:r.endpoint,sessionId:typeof r.sessionId=="string"?r.sessionId:n,...typeof r.expireAt=="string"?{expireAt:r.expireAt}:{}}},async createCodexProjectHandoffPairing(n={}){const i=await gn(`${BX}/pairings`,{method:"POST",headers:Yr({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:oZe}),signal:n.signal},QX);if(!i.ok)throw await Es(i,z("sandbox.createHandoffPairingFailed"));const r=oo(await zX(i,z("sandbox.createHandoffPairingFailed")));if(typeof(r==null?void 0:r.pairingCode)!="string"||!r.pairingCode.trim()||typeof r.expireAt!="string"||!r.expireAt.trim())throw new Error(z("sandbox.invalidHandoffPairing"));const s=typeof r.studioUrl=="string"&&r.studioUrl.trim()?r.studioUrl.trim():window.location.origin;return{pairingCode:r.pairingCode,expireAt:r.expireAt,studioUrl:s}},async getCodexProjectHandoffStatus(n,i={}){const r=await gn(`${BX}/pairings/${encodeURIComponent(n)}`,{headers:Yr({Accept:"application/json"}),signal:i.signal},QX);if(!r.ok)throw await Es(r,z("sandbox.getHandoffStatusFailed"));const s=oo(await zX(r,z("sandbox.getHandoffStatusFailed"))),o=new Set(["issued","creating","session-created","continuing","running","completed","failed"]);if(typeof(s==null?void 0:s.state)!="string"||!o.has(s.state)||typeof s.expireAt!="string"||!s.expireAt.trim())throw new Error(z("sandbox.invalidHandoffStatus"));return{state:s.state,expireAt:s.expireAt,...typeof s.projectName=="string"?{projectName:s.projectName}:{},...typeof s.agentName=="string"?{agentName:s.agentName}:{},...typeof s.sessionId=="string"?{sessionId:s.sessionId}:{},...typeof s.error=="string"?{error:s.error}:{},...s.failedStage==="creating-session"||s.failedStage==="uploading-project"||s.failedStage==="restoring-project"||s.failedStage==="continuing-task"?{failedStage:s.failedStage}:{}}},async listModels(n,i={}){const r=oo(await Cc(e,n,"models",{options:i,fallback:z("sandbox.listModelsFailed")}));if(!Array.isArray(r==null?void 0:r.models))throw new Error(z("sandbox.invalidModelList"));return r.models.flatMap(s=>{const o=lZe(s);return o?[o]:[]})},async setModel(n,i,r={}){const s=oo(await Cc(e,n,"model",{method:"PUT",body:{model:i},options:r,fallback:z("sandbox.setModelFailed")}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error(z("sandbox.invalidModel"));return s.model},async listSkills(n,i=!1,r={}){const o=oo(await Cc(e,n,`skills${i?"?force_reload=true":""}`,{options:r,fallback:z("sandbox.listSkillsFailed")}));if(!Array.isArray(o==null?void 0:o.skills))throw new Error(z("sandbox.invalidSkillList"));return o.skills.flatMap(l=>{const c=cZe(l);return c?[c]:[]})},async listThreads(n,i={},r={}){const s=new URLSearchParams;i.cursor&&s.set("cursor",i.cursor),i.search&&s.set("search",i.search),i.archived&&s.set("archived","true");const o=s.size?`?${s}`:"",l=oo(await Cc(e,n,`threads${o}`,{options:r,fallback:z("sandbox.listThreadsFailed")}));if(!Array.isArray(l==null?void 0:l.threads))throw new Error(z("sandbox.invalidThreadList"));return{threads:l.threads.flatMap(c=>{const u=_Ce(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,i={}){return gb(await Cc(e,n,"threads/new",{method:"POST",options:i,fallback:z("sandbox.createThreadFailed")}))},async readThread(n,i,r={}){if(!i)throw new Error(z("sandbox.missingThread"));return gb(await Cc(e,n,`threads/${encodeURIComponent(i)}`,{options:r,fallback:z("sandbox.readThreadFailed")}))},async resumeThread(n,i,r={}){return gb(await Cc(e,n,"threads/resume",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.resumeThreadFailed")}))},async forkThread(n,i={}){return gb(await Cc(e,n,"threads/fork",{method:"POST",options:i,fallback:z("sandbox.forkThreadFailed")}))},async archiveThread(n,i,r={}){const s=oo(await Cc(e,n,"threads/archive",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.archiveThreadFailed")}));if((s==null?void 0:s.archived)!==!0)throw new Error(z("sandbox.invalidArchiveResult"));return{archived:!0,...s.thread?{snapshot:gb(s)}:{}}},async deleteThread(n,i,r={}){const s=oo(await Cc(e,n,"threads/delete",{method:"POST",body:{threadId:i},options:r,fallback:z("sandbox.deleteThreadFailed")}));if((s==null?void 0:s.deleted)!==!0)throw new Error(z("sandbox.invalidDeleteResult"));return{deleted:!0,...s.thread?{snapshot:gb(s)}:{}}},async compactThread(n,i={}){await Cc(e,n,"threads/compact",{method:"POST",options:i,fallback:z("sandbox.compactThreadFailed")})},async getSettings(n,i={}){const r=await gn(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:Yr(),signal:i.signal},wh);if(!r.ok)throw await Es(r,z("sandbox.getSettingsFailed"));return qX(await r.json())},async updatePermissions(n,i,r={}){const s=await gn(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify(i),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.updatePermissionsFailed"));const o=await s.json();return LI(o.permissions)},async updateWorkspace(n,i,r={}){const s=await gn(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({cwd:i}),signal:r.signal},wh);if(!s.ok)throw await Es(s,z("sandbox.updateWorkspaceFailed"));const o=await s.json();if(typeof o.cwd!="string"||!o.cwd)throw new Error(z("sandbox.invalidWorkingDirectory"));return o.cwd},async listDirectories(n,i,r={}){const s=new URLSearchParams({path:i}),o=await gn(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:Yr(),signal:r.signal},wh);if(!o.ok)throw await Es(o,z("sandbox.listDirectoriesFailed"));const l=await o.json();if(typeof l.path!="string"||!Array.isArray(l.directories)||l.directories.some(c=>!c||typeof c.name!="string"||typeof c.path!="string"))throw new Error(z("sandbox.invalidDirectoryList"));return{path:l.path,...typeof l.parent=="string"?{parent:l.parent}:{},directories:l.directories}},async resolveApproval(n,i,r,s={}){const o=await gn(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(i)}`,{method:"POST",headers:Yr({"Content-Type":"application/json"}),body:JSON.stringify({decision:r}),signal:s.signal},wh);if(!o.ok)throw await Es(o,z("sandbox.resolveApprovalFailed"))},async launchTerminal(n,i={}){return WX(e,n,"terminal",i)},async launchBrowser(n,i={}){return WX(e,n,"browser",i)},async uploadFile(n,i,r={}){const s=new FormData;s.set("file",i,i.name);const o=await gn(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:Yr(),body:s,signal:r.signal},sZe);if(!o.ok)throw await Es(o,z("sandbox.uploadFileFailed"));const l=await o.json();if(typeof l.id!="string"||typeof l.path!="string"||typeof l.name!="string"||typeof l.mimeType!="string"||typeof l.sizeBytes!="number")throw new Error(z("sandbox.invalidUploadResult"));return l},async closeSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:Yr(),signal:i.signal},G1);if(!r.ok&&r.status!==404)throw await Es(r,z("sandbox.disconnectCodexFailed"))},async deleteSession(n,i={}){if(!n)return;const r=await gn(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:Yr(),signal:i.signal},G1);if(!r.ok&&r.status!==404)throw await Es(r,z("sandbox.deleteCodexFailed"))}}}const Sr=NCe(nZe),I0=NCe("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3,intelligentDevelopment:!0});async function WX(e,t,n,i){const r=await gn(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:Yr(),signal:i.signal},wh);if(!r.ok)throw await Es(r,z(n==="terminal"?"sandbox.openSandboxTerminalFailed":"sandbox.openSandboxBrowserFailed"));const s=await r.json();return{url:RCe(s.url,z("sandbox.toolLabel")),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function RCe(e,t){if(typeof e!="string")throw new Error(z("sandbox.invalidToolUrl",{label:t}));if(e.startsWith("/"))return Zo(e);let n;try{n=new URL(e)}catch{throw new Error(z("sandbox.invalidToolUrl",{label:t}))}const i=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!i)throw new Error(z("sandbox.unsafeToolUrl",{label:t}));return n.toString()}const Fc=e=>["succeeded","cancelled","failed"].includes(e.state),ICe="/web/intelligent-development";class Hx extends Error{constructor(t,n){super(t),this.status=n}}async function Yg(e,t="GET",n,i){const r=await gn(`${ICe}${e}`,{method:t,signal:i,headers:Yr(n===void 0?void 0:{"Content-Type":"application/json"}),...n===void 0?{}:{body:JSON.stringify(n)}},3e4);if(!r.ok){const s=await r.json().catch(()=>null),o=s==null?void 0:s.detail;throw new Hx(typeof o=="string"?o:(o==null?void 0:o.message)||z("developmentRuns.requestFailed"),r.status)}return r.json()}function P0(e){const t=e;if(!t||typeof t.runId!="string"||typeof t.sessionId!="string"||!["queued","running","recovering","waiting_user","stopping","succeeded","cancelled","failed"].includes(t.state))throw new Error(z("developmentRuns.invalidResponse"));return t}const pd={async active(e){const t=await Yg("/runs","GET",void 0,e);if(!Array.isArray(t.runs))throw new Error(z("developmentRuns.invalidResponse"));return t.runs.map(P0)},async get(e,t){return P0(await Yg(`/runs/${encodeURIComponent(e)}`,"GET",void 0,t))},async list(e,t){const n=await Yg(`/sessions/${encodeURIComponent(e)}/runs`,"GET",void 0,t);if(!Array.isArray(n.runs))throw new Error(z("developmentRuns.invalidResponse"));return n.runs.map(P0)},async create(e,t,n){return P0(await Yg(`/sessions/${encodeURIComponent(e)}/runs`,"POST",{message:t,requestId:n}))},async steer(e,t,n){await Yg(`/runs/${encodeURIComponent(e)}/inputs`,"POST",{message:t,clientId:n})},async stop(e){return P0(await Yg(`/runs/${encodeURIComponent(e)}/stop`,"POST"))},async resume(e){return P0(await Yg(`/runs/${encodeURIComponent(e)}/resume`,"POST"))}};class hZe{constructor(t){rn(this,"cursor",0);rn(this,"turns",[]);rn(this,"activeInput");rn(this,"itemTurns",new Map);rn(this,"nativeInputs",new Map);rn(this,"metrics",new Map);rn(this,"inputOrder",[]);rn(this,"projections",new Map);rn(this,"itemInputs",new Map);this.run=t,this.activeInput=t.requestId}projection(t){let n=this.projections.get(t);if(!n){const i={role:"assistant",blocks:[],meta:{localId:`${t}:assistant`}},r=this.turns.findIndex(s=>{var o;return((o=s.meta)==null?void 0:o.localId)===`${t}:user`});this.turns.splice(r<0?this.turns.length:r+1,0,i),n=jCe({onBlocks:s=>{i.blocks=s.map(o=>({...o,turnId:this.itemTurns.get(o.id||"")}))},onUsage:s=>{i.meta={...i.meta,sandboxUsage:s.usage}}}),this.projections.set(t,n)}return n}apply(t){if(t.payload.runId!==this.run.runId)throw new Error(z("developmentRuns.invalidResponse"));if(t.seq<=this.cursor)return;if(t.seq!==this.cursor+1)throw new Error(z("developmentRuns.eventGap"));for(const i of this.turns)i.blocks.some(r=>r.kind==="turn-summary")&&(i.blocks=i.blocks.filter(r=>r.kind!=="turn-summary"));const n=t.payload;if(t.type==="run.input"&&typeof n.clientId=="string"&&typeof n.message=="string")this.turns.push({role:"user",blocks:[{kind:"text",text:n.message}],meta:{localId:`${n.clientId}:user`},activity:{id:`${n.clientId}:delivery`,title:z(`developmentRuns.input.${String(n.status)}`)}}),this.inputOrder.push(n.clientId),this.projection(n.clientId),n.status==="delivered"&&this.inputOrder.indexOf(n.clientId)>=this.inputOrder.indexOf(this.activeInput)&&(this.activeInput=n.clientId);else if(t.type==="run.input_status"&&typeof n.clientId=="string"){const i=this.turns.find(r=>{var s;return((s=r.meta)==null?void 0:s.localId)===`${n.clientId}:user`});i&&(i.activity={id:`${n.clientId}:delivery`,title:z(`developmentRuns.input.${String(n.status)}`)}),n.status==="delivered"&&this.inputOrder.indexOf(n.clientId)>=this.inputOrder.indexOf(this.activeInput)&&(this.activeInput=n.clientId)}else if(t.type==="run.turn"&&typeof n.turnId=="string"){const r={...this.metrics.get(n.turnId),turnId:n.turnId,status:String(n.status||"inProgress"),toolCalls:0,toolDurationComplete:!1};for(const s of["startedAt","completedAt","durationMs"])typeof n[s]=="number"&&Number.isFinite(n[s])&&n[s]>=0&&(r[s]=n[s]);if(typeof n.model=="string"&&(r.model=n.model),n.usage&&typeof n.usage=="object"&&!Array.isArray(n.usage)){const s={};for(const o of["totalTokens","inputTokens","outputTokens","cachedInputTokens","cacheWriteInputTokens","reasoningOutputTokens"]){const l=n.usage[o];typeof l=="number"&&Number.isSafeInteger(l)&&l>=0&&(s[o]=l)}r.usage=s}n.usageIncomplete===!0&&(r.usageIncomplete=!0),this.metrics.set(n.turnId,r),this.nativeInputs.set(n.turnId,this.activeInput),this.projection(this.activeInput)}else if(t.type==="run.status"){if(this.run={...this.run,...n},Fc(this.run))for(const[i,r]of this.metrics)r.status==="inProgress"&&this.metrics.set(i,{...r,status:"unavailable",usageIncomplete:!0});if(Fc(this.run)||this.run.state==="waiting_user")for(const i of this.projections.values())i.consumeFrame(`event: done data: {}`)}else if(!t.type.startsWith("run.")){const i=typeof n.id=="string"&&n.id?n.id:["plan","diff"].includes(t.type)?t.type:"",r=i?`${String(n.turnId||"")}:${i}`:"",s=r&&this.itemInputs.get(r)||this.activeInput;r&&(this.itemInputs.set(r,s),typeof n.turnId=="string"&&this.itemTurns.set(r,n.turnId)),typeof n.turnId=="string"&&this.nativeInputs.set(n.turnId,this.activeInput);const o=t.type==="activity"&&n.kind==="commentary";this.projection(s).consumeFrame(`event: ${o?"delta":t.type} -data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type==="run.input"||t.type==="run.input_status")&&n.status==="delivered"&&typeof n.turnId=="string"&&typeof n.clientId=="string"&&this.nativeInputs.set(n.turnId,n.clientId),this.decorate(),this.cursor=t.seq}decorate(){const t=!Fc(this.run)&&this.run.state!=="waiting_user",n=[...this.turns].reverse().find(i=>i.role==="assistant");for(const i of this.turns)i.role==="assistant"&&(i.meta={...i.meta,streaming:t&&i===n});for(const i of this.metrics.values()){if(!["completed","failed","interrupted","cancelled","unavailable"].includes(i.status))continue;const r=new Map;for(const u of this.turns)for(const d of u.blocks)d.kind==="tool"&&d.turnId===i.turnId&&d.id&&r.set(d.id,d);const s=[...r.values()].filter(u=>typeof u.durationMs=="number"&&Number.isFinite(u.durationMs)&&u.durationMs>=0),o={...i,toolCalls:r.size,toolDurationComplete:s.length===r.size,toolDurationMs:s.length||!r.size?s.reduce((u,d)=>u+d.durationMs,0):void 0},l=this.nativeInputs.get(i.turnId),c=this.turns.find(u=>{var d;return((d=u.meta)==null?void 0:d.localId)===`${l}:assistant`});if(c){const u=c.blocks.reduce((d,f,h)=>f.turnId===i.turnId?h:d,-1);c.blocks.splice(u<0?c.blocks.length:u+1,0,{kind:"turn-summary",id:`${i.turnId}:summary`,turnId:i.turnId,value:o})}}}}function fZe(e,t){return new Promise((n,i)=>{if(t.aborted){i(new DOMException("Aborted","AbortError"));return}const r=()=>{clearTimeout(s),i(new DOMException("Aborted","AbortError"))},s=setTimeout(()=>{t.removeEventListener("abort",r),n()},e);t.addEventListener("abort",r,{once:!0})})}async function hZe(e,t,n){var c;const i=await gn(`${ICe}/runs/${encodeURIComponent(e.run.runId)}/events?after=${e.cursor}`,{signal:t,headers:Yr({Accept:"text/event-stream"})},0);if(!i.ok)throw new Hx(z("developmentRuns.requestFailed"),i.status);if(!i.body)throw new Error(z("developmentRuns.invalidResponse"));const r=i.body.getReader(),s=new TextDecoder;let o="",l=!1;try{for(;;){const{value:u,done:d}=await r.read();o+=s.decode(u,{stream:!d});const f=o.split(/\r?\n\r?\n/);o=f.pop()||"";for(const h of f){const m=h.split(/\r?\n/),g=(c=m.find(y=>y.startsWith("event:")))==null?void 0:c.slice(6).trim();if(g==="done"){l=!0;continue}const b=m.filter(y=>y.startsWith("data:")).map(y=>y.slice(5).trimStart()).join(` -`);if(!g||!b)continue;const v=JSON.parse(b);if(!Number.isSafeInteger(v.seq))throw new Error(z("developmentRuns.invalidResponse"));e.apply({seq:v.seq,type:g,payload:v})}if(n(),d)break}if(!l)throw new Error(z("developmentRuns.reconnecting"))}finally{await r.cancel().catch(()=>{}),r.releaseLock()}}async function pZe(e,t,n,i,r){const s=new Map;let o=0;const l=new Map;let c;r==null||r(h=>{t.aborted||h.sessionId!==e||(l.set(h.runId,h),c==null||c())});const u=h=>new Promise(m=>{const g=()=>{clearTimeout(b),t.removeEventListener("abort",g),c=void 0,m()},b=setTimeout(g,h);c=g,t.addEventListener("abort",g,{once:!0}),(t.aborted||l.size)&&g()}),d=new Map,f=()=>{var m;if(t.aborted)return;const h=[...s.values()];n(h.flatMap(g=>{let b=d.get(g);return(!b||b.cursor!==g.cursor)&&(b={cursor:g.cursor,turns:g.turns.map(v=>({...v}))},d.set(g,b)),b.turns}),((m=h[h.length-1])==null?void 0:m.run)||null)};for(;!t.aborted;)try{const h=l.size?[]:await pd.list(e,t),m=[...new Map([...h,...l.values()].map(g=>[g.runId,g])).values()];l.clear();for(const g of m){let b=s.get(g.runId);if(b||(b=new dZe(g),s.set(g.runId,b)),b.cursor>=g.lastSeq&&(b.run=g),b.cursor{o=0,i(""),f()})}catch(v){if(!(v instanceof Hx&&v.status===404&&Fc(g)))throw v}}o=0,i(""),f(),await u(1500)}catch(h){if(t.aborted)return;if(h instanceof Hx&&[401,403,404].includes(h.status))throw h;i(z("developmentRuns.reconnecting")),await fZe(Math.min(1e3*2**o++,15e3),t)}}function mZe({sessionId:e,ownerId:t,onTurns:n,onBusy:i}){const[r,s]=p.useState(null),[o,l]=p.useState(""),[c,u]=p.useState(""),[d,f]=p.useState(!1),[h,m]=p.useState(!1),g=p.useRef({onTurns:n,onBusy:i});g.current={onTurns:n,onBusy:i};const b=p.useRef(0),v=p.useRef([]),y=p.useRef([]),x=p.useRef(null),w=()=>{const T=new Set(v.current.map(N=>{var A;return(A=N.meta)==null?void 0:A.localId}));y.current=y.current.filter(N=>{var A;return!T.has((A=N.meta)==null?void 0:A.localId)}),g.current.onTurns([...v.current,...y.current])},O=p.useRef(!1),S=p.useRef(!1),k=p.useRef(null),C=p.useRef({sessionId:e,ownerId:t});C.current={sessionId:e,ownerId:t},p.useEffect(()=>{b.current+=1,s(null),u(""),l(""),v.current=[],x.current=null;const T=k.current;if(((T==null?void 0:T.session)!==e||T.owner!==t)&&(y.current=[],m(!1),S.current=!1,k.current=null,O.current=!1,f(!1)),e&&w(),!e||!t)return;const N=new AbortController,A=()=>!N.signal.aborted&&C.current.sessionId===e&&C.current.ownerId===t;return pZe(e,N.signal,(P,D)=>{A()&&(v.current=P,w(),s(D),g.current.onBusy(O.current||!!(D&&!Fc(D))),D&&Fc(D)&&(m(!1),S.current=!1))},P=>{A()&&l(P)},P=>{A()&&(x.current=P)}).catch(P=>{A()&&u(P instanceof Error?P.message:String(P))}),()=>N.abort()},[e,t]);function E(T,N=e){const A=C.current.ownerId;let P=k.current;return(!P||P.session!==N||P.owner!==A||P.text!==T)&&(P={session:N,owner:A,text:T,id:crypto.randomUUID()},k.current=P),y.current.some(D=>{var M;return((M=D.meta)==null?void 0:M.localId)===`${P.id}:user`})||y.current.push({role:"user",blocks:[{kind:"text",text:T}],meta:{localId:`${P.id}:user`}},{role:"assistant",blocks:[{kind:"progress",text:z(r&&!Fc(r)?"developmentRuns.processing":"developmentRuns.preparing")}],meta:{localId:`${P.id}:assistant`}}),[...y.current]}async function R(T,N=e){var L;if(!T.trim()||O.current||S.current)return!1;O.current=!0,f(!0),u("");const A=C.current.ownerId,P=()=>C.current.ownerId===A&&C.current.sessionId===N;E(T,N),w(),g.current.onBusy(!0);const D=k.current,M=(D==null?void 0:D.session)===N&&D.owner===A&&D.text===T?D:{session:N,owner:A,text:T,id:crypto.randomUUID(),runId:void 0,stopRequested:!1};k.current=M;try{const U=await pd.list(N),I=U[U.length-1];if(!P())return!1;!M.runId&&I&&!Fc(I)&&I.requestId!==M.id&&(M.runId=I.runId);let H;return M.runId?(await pd.steer(M.runId,T,M.id),H=await pd.get(M.runId)):H=await pd.create(N,T,M.id),(M.stopRequested||P()&&S.current)&&(H=await pd.stop(H.runId)),P()&&(s(H),(L=x.current)==null||L.call(x,H),g.current.onBusy(!Fc(H)),k.current=null),!0}catch(U){return P()&&(g.current.onBusy(!!(r&&!Fc(r))),u(U instanceof Error?U.message:String(U)),M.stopRequested&&(S.current=!1,m(!1))),!1}finally{P()&&(O.current=!1,f(!1))}}async function _(){S.current=!0,m(!0),u(""),k.current&&(k.current.stopRequested=!0);const T=b.current;try{const A=(await pd.list(e)).find(P=>!Fc(P));if(A){const P=await pd.stop(A.runId);T===b.current&&s(P)}else!O.current&&T===b.current&&(S.current=!1,m(!1))}catch(N){T===b.current&&(u(N instanceof Error?N.message:String(N)),m(!1),S.current=!1)}}async function j(){if(!r)return;const T=b.current;try{const N=await pd.resume(r.runId);T===b.current&&(s(N),u(""))}catch(N){T===b.current&&u(N instanceof Error?N.message:String(N))}}return{run:r,connection:o,error:c,submitting:d,stopPending:h,prepare:E,submit:R,stop:_,resume:j}}function KX(e){return e?["stopping","waiting_user","failed","cancelled"].includes(e.state)?e.statusMessage:e.phase==="reporting"?z("developmentRuns.reporting"):e.state==="recovering"?e.statusMessage:["outcome_read","delivery"].includes(e.phase)?z("developmentRuns.packaging"):e.phase==="version"?z("developmentRuns.savingVersion"):e.phase==="cycle_complete"?z("developmentRuns.finishing"):e.statusMessage:""}function PCe(e){if(e==null||!Number.isFinite(e)||e<0)return z("developmentRuns.notReported");const t=Math.round(e);if(t===0)return`<${z("developmentRuns.durationUnits.milliseconds",{value:"1"})}`;if(t<1e3)return z("developmentRuns.durationUnits.milliseconds",{value:t.toLocaleString(k6())});const n=Math.round(t/100);return[["hours",Math.floor(n/36e3)],["minutes",Math.floor(n%36e3/600)],["seconds",n%600/10]].filter(([,r])=>r>0).map(([r,s])=>z(`developmentRuns.durationUnits.${r}`,{value:s.toLocaleString(k6(),{maximumFractionDigits:1})})).join(" ")}const _L=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},GX=e=>typeof e=="string"?e.replace(/\s+/g," ").trim().slice(0,160):"";function DCe(e){var n;const t=_L(e.args);if(e.itemType==="dynamicToolCall"&&e.name==="submit_build_result")return z("developmentRuns.submitResult");if(e.itemType==="commandExecution"){const i=Array.isArray(t.commandActions)?t.commandActions.map(_L):[],r=new Set(i.map(c=>c.type));if(i.length&&r.size===1){if(r.has("read"))return z("developmentRuns.read",{target:"Read project files"});if(r.has("listFiles"))return z("developmentRuns.listFiles",{target:"List directory"});if(r.has("search"))return z("developmentRuns.search",{target:"Search project files"})}const s=typeof t.command=="string"?t.command:"",l=((n=[[/\b(?:pytest|vitest|jest)\b|\b(?:npm|pnpm|yarn) (?:run )?test\b/,"Run tests"],[/\b(?:npm|pnpm|yarn) (?:ci|install|add)\b|\b(?:pip|pip3|uv pip) install\b|\buv sync\b/,"Install dependencies"],[/\b(?:ruff|eslint|prettier|pyright|tsc)\b/,"Check code quality"],[/\b(?:npm|pnpm|yarn) (?:run )?build\b|\bpython[^;]* -m build\b/,"Build project"],[/\bgit (?:status|diff|log|show)\b/,"Inspect Git changes"],[/\bgit (?:add|commit)\b/,"Save Git changes"],[/\b(?:curl|wget)\b/,"Send HTTP request"],[/\bcompileall\b/,"Check Python syntax"]].find(([c])=>c.test(s)))==null?void 0:n[1])||"Run shell command";return z("developmentRuns.command",{target:l})}if(e.itemType==="fileChange"){const i=Array.isArray(t.changes)?t.changes.map(r=>GX(_L(r).path)).filter(Boolean):[];return z("developmentRuns.editFiles",{target:i.join(", ")})}return e.itemType==="webSearch"?z("developmentRuns.webSearch",{target:GX(t.query)}):e.name}const gZe=e=>["tool","thinking","plan","diff"].includes(e.kind);function bZe(e){const t=[];return e.forEach((n,i)=>{if(n.kind==="progress")return;const r=gZe(n),s=t[t.length-1];r&&(s!=null&&s.process)?s.blocks.push(n):t.push({id:n.id||`${n.kind}:${i}`,process:r,blocks:[n]})}),t}const XX="M 15 15 C 15 5, 25 5, 30 15 C 35 25, 45 25, 45 15 C 45 5, 35 5, 30 15 C 25 25, 15 25, 15 15";function MCe({variant:e="infinity",size:t=e==="ring"?40:48,label:n="加载中",decorative:i=!1,className:r="",style:s}){const o=EI();return a.jsxs("span",{className:`studio-loading studio-loading--${e} ${r}`.trim(),style:s,role:i?void 0:"status","aria-live":i?void 0:"polite","aria-hidden":i||void 0,children:[e==="infinity"?a.jsxs("svg",{className:"studio-loading__infinity",width:t,height:t/2,viewBox:"0 0 60 30",fill:"none","aria-hidden":"true",children:[a.jsx("path",{className:"studio-loading__track",d:XX,strokeWidth:"4",strokeLinecap:"round"}),a.jsx(dr.path,{className:"studio-loading__path",d:XX,strokeWidth:"4",strokeLinecap:"round",strokeDasharray:o?void 0:"100",initial:{strokeDashoffset:100},animate:{strokeDashoffset:o?0:[100,-100]},transition:{duration:o?0:2,repeat:o?0:1/0,ease:"linear"}})]}):a.jsx(dr.div,{className:"studio-loading__ring",style:{width:t,height:t,borderWidth:t*3/40},"aria-hidden":"true",animate:{rotate:o?0:360},transition:{duration:o?0:1,repeat:o?0:1/0,ease:"linear"}}),!i&&a.jsx("span",{className:"studio-loading__label",children:n})]})}function LCe({className:e="",type:t="button",variant:n="primary",size:i="default",startIcon:r,endIcon:s,iconOnly:o=!1,hoverEffect:l="background",loading:c=!1,disabled:u,children:d,...f}){return a.jsxs("button",{...f,type:t,disabled:u||c,"aria-busy":c||f["aria-busy"],"data-hover-effect":o?l:void 0,className:`studio-button studio-button--${n} studio-button--size-${i}${o?" studio-button--icon-only":""}${c?" studio-button--loading":""} ${e}`.trim(),children:[r&&a.jsx("span",{className:"studio-button__icon","aria-hidden":"true",children:r}),!o&&a.jsx("span",{className:"studio-button__label",children:d}),!o&&s&&a.jsx("span",{className:"studio-button__icon studio-button__end-icon","aria-hidden":"true",children:s}),c&&a.jsx("span",{className:"studio-button__loading","aria-hidden":"true",children:a.jsx(MCe,{variant:"ring",size:16,decorative:!0})})]})}function yZe({variant:e,...t}){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:e==="warning"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m10.3 4.5-7.6 13a2 2 0 0 0 1.7 3h15.2a2 2 0 0 0 1.7-3l-7.6-13a2 2 0 0 0-3.4 0Z"}),a.jsx("path",{d:"M12 9v4m0 3.5h.01"})]}):a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),e==="success"?a.jsx("path",{d:"m8 12 2.7 2.7L16 9.4"}):e==="error"?a.jsx("path",{d:"m9.2 9.2 5.6 5.6m0-5.6-5.6 5.6"}):a.jsx("path",{d:"M12 11v5m0-8h.01"})]})})}function vZe(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function xZe({variant:e="info",title:t,description:n,action:i,onDismiss:r,closeLabel:s="关闭通知",className:o="",role:l="status",...c}){return a.jsxs("div",{...c,role:l,className:`studio-toast ${o}`.trim(),"data-variant":e,children:[a.jsx(yZe,{variant:e,className:"studio-toast__status"}),a.jsxs("div",{className:"studio-toast__content",children:[t!=null&&a.jsx("div",{className:"studio-toast__title",children:t}),n!=null&&a.jsx("div",{className:"studio-toast__description",children:n}),i!=null&&a.jsx("div",{className:"studio-toast__action",children:i})]}),r&&a.jsx(LCe,{variant:"ghost",iconOnly:!0,startIcon:a.jsx(vZe,{}),"aria-label":s,onClick:r,className:"studio-toast__close"})]})}function kU(){}const wZe=Object.freeze([]),Cl=Object.freeze({});function $I(e){p.useEffect(e,wZe)}const YX={};function Ku(e,t){const n=p.useRef(YX);return n.current===YX&&(n.current=e(t)),n}const OZe=()=>{},Un=typeof document<"u"?p.useLayoutEffect:OZe;function kZe(e,t){return function(i,...r){const s=new URL(e);return s.searchParams.set("code",i.toString()),r.forEach(o=>s.searchParams.append("args[]",o)),`${t} error #${i}; visit ${s} for the full message.`}}const du=kZe("https://base-ui.com/production-error","Base UI"),$Ce=p.createContext(void 0);function SU(){const e=p.useContext($Ce);if(!e)throw new Error(du(73));return e}var FCe={exports:{}},BCe={};/** +data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type==="run.input"||t.type==="run.input_status")&&n.status==="delivered"&&typeof n.turnId=="string"&&typeof n.clientId=="string"&&this.nativeInputs.set(n.turnId,n.clientId),this.decorate(),this.cursor=t.seq}decorate(){const t=!Fc(this.run)&&this.run.state!=="waiting_user",n=[...this.turns].reverse().find(i=>i.role==="assistant");for(const i of this.turns)i.role==="assistant"&&(i.meta={...i.meta,streaming:t&&i===n});for(const i of this.metrics.values()){if(!["completed","failed","interrupted","cancelled","unavailable"].includes(i.status))continue;const r=new Map;for(const u of this.turns)for(const d of u.blocks)d.kind==="tool"&&d.turnId===i.turnId&&d.id&&r.set(d.id,d);const s=[...r.values()].filter(u=>typeof u.durationMs=="number"&&Number.isFinite(u.durationMs)&&u.durationMs>=0),o={...i,toolCalls:r.size,toolDurationComplete:s.length===r.size,toolDurationMs:s.length||!r.size?s.reduce((u,d)=>u+d.durationMs,0):void 0},l=this.nativeInputs.get(i.turnId),c=this.turns.find(u=>{var d;return((d=u.meta)==null?void 0:d.localId)===`${l}:assistant`});if(c){const u=c.blocks.reduce((d,f,h)=>f.turnId===i.turnId?h:d,-1);c.blocks.splice(u<0?c.blocks.length:u+1,0,{kind:"turn-summary",id:`${i.turnId}:summary`,turnId:i.turnId,value:o})}}}}function pZe(e,t){return new Promise((n,i)=>{if(t.aborted){i(new DOMException("Aborted","AbortError"));return}const r=()=>{clearTimeout(s),i(new DOMException("Aborted","AbortError"))},s=setTimeout(()=>{t.removeEventListener("abort",r),n()},e);t.addEventListener("abort",r,{once:!0})})}async function mZe(e,t,n){var c;const i=await gn(`${ICe}/runs/${encodeURIComponent(e.run.runId)}/events?after=${e.cursor}`,{signal:t,headers:Yr({Accept:"text/event-stream"})},0);if(!i.ok)throw new Hx(z("developmentRuns.requestFailed"),i.status);if(!i.body)throw new Error(z("developmentRuns.invalidResponse"));const r=i.body.getReader(),s=new TextDecoder;let o="",l=!1;try{for(;;){const{value:u,done:d}=await r.read();o+=s.decode(u,{stream:!d});const f=o.split(/\r?\n\r?\n/);o=f.pop()||"";for(const h of f){const m=h.split(/\r?\n/),g=(c=m.find(y=>y.startsWith("event:")))==null?void 0:c.slice(6).trim();if(g==="done"){l=!0;continue}const b=m.filter(y=>y.startsWith("data:")).map(y=>y.slice(5).trimStart()).join(` +`);if(!g||!b)continue;const v=JSON.parse(b);if(!Number.isSafeInteger(v.seq))throw new Error(z("developmentRuns.invalidResponse"));e.apply({seq:v.seq,type:g,payload:v})}if(n(),d)break}if(!l)throw new Error(z("developmentRuns.reconnecting"))}finally{await r.cancel().catch(()=>{}),r.releaseLock()}}async function gZe(e,t,n,i,r){const s=new Map;let o=0;const l=new Map;let c;r==null||r(h=>{t.aborted||h.sessionId!==e||(l.set(h.runId,h),c==null||c())});const u=h=>new Promise(m=>{const g=()=>{clearTimeout(b),t.removeEventListener("abort",g),c=void 0,m()},b=setTimeout(g,h);c=g,t.addEventListener("abort",g,{once:!0}),(t.aborted||l.size)&&g()}),d=new Map,f=()=>{var m;if(t.aborted)return;const h=[...s.values()];n(h.flatMap(g=>{let b=d.get(g);return(!b||b.cursor!==g.cursor)&&(b={cursor:g.cursor,turns:g.turns.map(v=>({...v}))},d.set(g,b)),b.turns}),((m=h[h.length-1])==null?void 0:m.run)||null)};for(;!t.aborted;)try{const h=l.size?[]:await pd.list(e,t),m=[...new Map([...h,...l.values()].map(g=>[g.runId,g])).values()];l.clear();for(const g of m){let b=s.get(g.runId);if(b||(b=new hZe(g),s.set(g.runId,b)),b.cursor>=g.lastSeq&&(b.run=g),b.cursor{o=0,i(""),f()})}catch(v){if(!(v instanceof Hx&&v.status===404&&Fc(g)))throw v}}o=0,i(""),f(),await u(1500)}catch(h){if(t.aborted)return;if(h instanceof Hx&&[401,403,404].includes(h.status))throw h;i(z("developmentRuns.reconnecting")),await pZe(Math.min(1e3*2**o++,15e3),t)}}function bZe({sessionId:e,ownerId:t,onTurns:n,onBusy:i}){const[r,s]=p.useState(null),[o,l]=p.useState(""),[c,u]=p.useState(""),[d,f]=p.useState(!1),[h,m]=p.useState(!1),g=p.useRef({onTurns:n,onBusy:i});g.current={onTurns:n,onBusy:i};const b=p.useRef(0),v=p.useRef([]),y=p.useRef([]),x=p.useRef(null),w=()=>{const T=new Set(v.current.map(N=>{var A;return(A=N.meta)==null?void 0:A.localId}));y.current=y.current.filter(N=>{var A;return!T.has((A=N.meta)==null?void 0:A.localId)}),g.current.onTurns([...v.current,...y.current])},O=p.useRef(!1),S=p.useRef(!1),k=p.useRef(null),C=p.useRef({sessionId:e,ownerId:t});C.current={sessionId:e,ownerId:t},p.useEffect(()=>{b.current+=1,s(null),u(""),l(""),v.current=[],x.current=null;const T=k.current;if(((T==null?void 0:T.session)!==e||T.owner!==t)&&(y.current=[],m(!1),S.current=!1,k.current=null,O.current=!1,f(!1)),e&&w(),!e||!t)return;const N=new AbortController,A=()=>!N.signal.aborted&&C.current.sessionId===e&&C.current.ownerId===t;return gZe(e,N.signal,(P,D)=>{A()&&(v.current=P,w(),s(D),g.current.onBusy(O.current||!!(D&&!Fc(D))),D&&Fc(D)&&(m(!1),S.current=!1))},P=>{A()&&l(P)},P=>{A()&&(x.current=P)}).catch(P=>{A()&&u(P instanceof Error?P.message:String(P))}),()=>N.abort()},[e,t]);function E(T,N=e){const A=C.current.ownerId;let P=k.current;return(!P||P.session!==N||P.owner!==A||P.text!==T)&&(P={session:N,owner:A,text:T,id:crypto.randomUUID()},k.current=P),y.current.some(D=>{var M;return((M=D.meta)==null?void 0:M.localId)===`${P.id}:user`})||y.current.push({role:"user",blocks:[{kind:"text",text:T}],meta:{localId:`${P.id}:user`}},{role:"assistant",blocks:[{kind:"progress",text:z(r&&!Fc(r)?"developmentRuns.processing":"developmentRuns.preparing")}],meta:{localId:`${P.id}:assistant`}}),[...y.current]}async function R(T,N=e){var L;if(!T.trim()||O.current||S.current)return!1;O.current=!0,f(!0),u("");const A=C.current.ownerId,P=()=>C.current.ownerId===A&&C.current.sessionId===N;E(T,N),w(),g.current.onBusy(!0);const D=k.current,M=(D==null?void 0:D.session)===N&&D.owner===A&&D.text===T?D:{session:N,owner:A,text:T,id:crypto.randomUUID(),runId:void 0,stopRequested:!1};k.current=M;try{const U=await pd.list(N),I=U[U.length-1];if(!P())return!1;!M.runId&&I&&!Fc(I)&&I.requestId!==M.id&&(M.runId=I.runId);let H;return M.runId?(await pd.steer(M.runId,T,M.id),H=await pd.get(M.runId)):H=await pd.create(N,T,M.id),(M.stopRequested||P()&&S.current)&&(H=await pd.stop(H.runId)),P()&&(s(H),(L=x.current)==null||L.call(x,H),g.current.onBusy(!Fc(H)),k.current=null),!0}catch(U){return P()&&(g.current.onBusy(!!(r&&!Fc(r))),u(U instanceof Error?U.message:String(U)),M.stopRequested&&(S.current=!1,m(!1))),!1}finally{P()&&(O.current=!1,f(!1))}}async function _(){S.current=!0,m(!0),u(""),k.current&&(k.current.stopRequested=!0);const T=b.current;try{const A=(await pd.list(e)).find(P=>!Fc(P));if(A){const P=await pd.stop(A.runId);T===b.current&&s(P)}else!O.current&&T===b.current&&(S.current=!1,m(!1))}catch(N){T===b.current&&(u(N instanceof Error?N.message:String(N)),m(!1),S.current=!1)}}async function j(){if(!r)return;const T=b.current;try{const N=await pd.resume(r.runId);T===b.current&&(s(N),u(""))}catch(N){T===b.current&&u(N instanceof Error?N.message:String(N))}}return{run:r,connection:o,error:c,submitting:d,stopPending:h,prepare:E,submit:R,stop:_,resume:j}}function KX(e){return e?["stopping","waiting_user","failed","cancelled"].includes(e.state)?e.statusMessage:e.phase==="reporting"?z("developmentRuns.reporting"):e.state==="recovering"?e.statusMessage:["outcome_read","delivery"].includes(e.phase)?z("developmentRuns.packaging"):e.phase==="version"?z("developmentRuns.savingVersion"):e.phase==="cycle_complete"?z("developmentRuns.finishing"):e.statusMessage:""}function PCe(e){if(e==null||!Number.isFinite(e)||e<0)return z("developmentRuns.notReported");const t=Math.round(e);if(t===0)return`<${z("developmentRuns.durationUnits.milliseconds",{value:"1"})}`;if(t<1e3)return z("developmentRuns.durationUnits.milliseconds",{value:t.toLocaleString(k6())});const n=Math.round(t/100);return[["hours",Math.floor(n/36e3)],["minutes",Math.floor(n%36e3/600)],["seconds",n%600/10]].filter(([,r])=>r>0).map(([r,s])=>z(`developmentRuns.durationUnits.${r}`,{value:s.toLocaleString(k6(),{maximumFractionDigits:1})})).join(" ")}const _L=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},GX=e=>typeof e=="string"?e.replace(/\s+/g," ").trim().slice(0,160):"";function DCe(e){var n;const t=_L(e.args);if(e.itemType==="dynamicToolCall"&&e.name==="submit_build_result")return z("developmentRuns.submitResult");if(e.itemType==="commandExecution"){const i=Array.isArray(t.commandActions)?t.commandActions.map(_L):[],r=new Set(i.map(c=>c.type));if(i.length&&r.size===1){if(r.has("read"))return z("developmentRuns.read",{target:"Read project files"});if(r.has("listFiles"))return z("developmentRuns.listFiles",{target:"List directory"});if(r.has("search"))return z("developmentRuns.search",{target:"Search project files"})}const s=typeof t.command=="string"?t.command:"",l=((n=[[/\b(?:pytest|vitest|jest)\b|\b(?:npm|pnpm|yarn) (?:run )?test\b/,"Run tests"],[/\b(?:npm|pnpm|yarn) (?:ci|install|add)\b|\b(?:pip|pip3|uv pip) install\b|\buv sync\b/,"Install dependencies"],[/\b(?:ruff|eslint|prettier|pyright|tsc)\b/,"Check code quality"],[/\b(?:npm|pnpm|yarn) (?:run )?build\b|\bpython[^;]* -m build\b/,"Build project"],[/\bgit (?:status|diff|log|show)\b/,"Inspect Git changes"],[/\bgit (?:add|commit)\b/,"Save Git changes"],[/\b(?:curl|wget)\b/,"Send HTTP request"],[/\bcompileall\b/,"Check Python syntax"]].find(([c])=>c.test(s)))==null?void 0:n[1])||"Run shell command";return z("developmentRuns.command",{target:l})}if(e.itemType==="fileChange"){const i=Array.isArray(t.changes)?t.changes.map(r=>GX(_L(r).path)).filter(Boolean):[];return z("developmentRuns.editFiles",{target:i.join(", ")})}return e.itemType==="webSearch"?z("developmentRuns.webSearch",{target:GX(t.query)}):e.name}const yZe=e=>["tool","thinking","plan","diff"].includes(e.kind);function vZe(e){const t=[];return e.forEach((n,i)=>{if(n.kind==="progress")return;const r=yZe(n),s=t[t.length-1];r&&(s!=null&&s.process)?s.blocks.push(n):t.push({id:n.id||`${n.kind}:${i}`,process:r,blocks:[n]})}),t}const XX="M 15 15 C 15 5, 25 5, 30 15 C 35 25, 45 25, 45 15 C 45 5, 35 5, 30 15 C 25 25, 15 25, 15 15";function MCe({variant:e="infinity",size:t=e==="ring"?40:48,label:n="加载中",decorative:i=!1,className:r="",style:s}){const o=EI();return a.jsxs("span",{className:`studio-loading studio-loading--${e} ${r}`.trim(),style:s,role:i?void 0:"status","aria-live":i?void 0:"polite","aria-hidden":i||void 0,children:[e==="infinity"?a.jsxs("svg",{className:"studio-loading__infinity",width:t,height:t/2,viewBox:"0 0 60 30",fill:"none","aria-hidden":"true",children:[a.jsx("path",{className:"studio-loading__track",d:XX,strokeWidth:"4",strokeLinecap:"round"}),a.jsx(dr.path,{className:"studio-loading__path",d:XX,strokeWidth:"4",strokeLinecap:"round",strokeDasharray:o?void 0:"100",initial:{strokeDashoffset:100},animate:{strokeDashoffset:o?0:[100,-100]},transition:{duration:o?0:2,repeat:o?0:1/0,ease:"linear"}})]}):a.jsx(dr.div,{className:"studio-loading__ring",style:{width:t,height:t,borderWidth:t*3/40},"aria-hidden":"true",animate:{rotate:o?0:360},transition:{duration:o?0:1,repeat:o?0:1/0,ease:"linear"}}),!i&&a.jsx("span",{className:"studio-loading__label",children:n})]})}function LCe({className:e="",type:t="button",variant:n="primary",size:i="default",startIcon:r,endIcon:s,iconOnly:o=!1,hoverEffect:l="background",loading:c=!1,disabled:u,children:d,...f}){return a.jsxs("button",{...f,type:t,disabled:u||c,"aria-busy":c||f["aria-busy"],"data-hover-effect":o?l:void 0,className:`studio-button studio-button--${n} studio-button--size-${i}${o?" studio-button--icon-only":""}${c?" studio-button--loading":""} ${e}`.trim(),children:[r&&a.jsx("span",{className:"studio-button__icon","aria-hidden":"true",children:r}),!o&&a.jsx("span",{className:"studio-button__label",children:d}),!o&&s&&a.jsx("span",{className:"studio-button__icon studio-button__end-icon","aria-hidden":"true",children:s}),c&&a.jsx("span",{className:"studio-button__loading","aria-hidden":"true",children:a.jsx(MCe,{variant:"ring",size:16,decorative:!0})})]})}function xZe({variant:e,...t}){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:e==="warning"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m10.3 4.5-7.6 13a2 2 0 0 0 1.7 3h15.2a2 2 0 0 0 1.7-3l-7.6-13a2 2 0 0 0-3.4 0Z"}),a.jsx("path",{d:"M12 9v4m0 3.5h.01"})]}):a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),e==="success"?a.jsx("path",{d:"m8 12 2.7 2.7L16 9.4"}):e==="error"?a.jsx("path",{d:"m9.2 9.2 5.6 5.6m0-5.6-5.6 5.6"}):a.jsx("path",{d:"M12 11v5m0-8h.01"})]})})}function wZe(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function OZe({variant:e="info",title:t,description:n,action:i,onDismiss:r,closeLabel:s="关闭通知",className:o="",role:l="status",...c}){return a.jsxs("div",{...c,role:l,className:`studio-toast ${o}`.trim(),"data-variant":e,children:[a.jsx(xZe,{variant:e,className:"studio-toast__status"}),a.jsxs("div",{className:"studio-toast__content",children:[t!=null&&a.jsx("div",{className:"studio-toast__title",children:t}),n!=null&&a.jsx("div",{className:"studio-toast__description",children:n}),i!=null&&a.jsx("div",{className:"studio-toast__action",children:i})]}),r&&a.jsx(LCe,{variant:"ghost",iconOnly:!0,startIcon:a.jsx(wZe,{}),"aria-label":s,onClick:r,className:"studio-toast__close"})]})}function kU(){}const kZe=Object.freeze([]),Cl=Object.freeze({});function $I(e){p.useEffect(e,kZe)}const YX={};function Ku(e,t){const n=p.useRef(YX);return n.current===YX&&(n.current=e(t)),n}const SZe=()=>{},Un=typeof document<"u"?p.useLayoutEffect:SZe;function EZe(e,t){return function(i,...r){const s=new URL(e);return s.searchParams.set("code",i.toString()),r.forEach(o=>s.searchParams.append("args[]",o)),`${t} error #${i}; visit ${s} for the full message.`}}const du=EZe("https://base-ui.com/production-error","Base UI"),$Ce=p.createContext(void 0);function SU(){const e=p.useContext($Ce);if(!e)throw new Error(du(73));return e}var FCe={exports:{}},BCe={};/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -128,27 +128,27 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var FI=p,SZe=JR;function EZe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var CZe=typeof Object.is=="function"?Object.is:EZe,TZe=SZe.useSyncExternalStore,AZe=FI.useRef,_Ze=FI.useEffect,jZe=FI.useMemo,NZe=FI.useDebugValue;BCe.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=AZe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=jZe(function(){function c(m){if(!u){if(u=!0,d=m,m=i(m),r!==void 0&&o.hasValue){var g=o.value;if(r(g,m))return f=g}return f=m}if(g=f,CZe(d,m))return g;var b=i(m);return r!==void 0&&r(g,b)?(d=m,g):(d=m,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,i,r]);var l=TZe(e,s[0],s[1]);return _Ze(function(){o.hasValue=!0,o.value=l},[l]),NZe(l),l};FCe.exports=BCe;var UCe=FCe.exports;const RZe=Ew(UCe),IZe=parseInt(p.version,10);function EU(e){return IZe>=e}const PZe=EU(19),DZe=PZe?LZe:$Ze;function QCe(e,t,n,i,r){return DZe(e,t,n,i,r)}function MZe(e,t,n,i,r){const s=p.useCallback(()=>t(e.getSnapshot(),n,i,r),[e,t,n,i,r]);return JR.useSyncExternalStore(e.subscribe,s,s)}function LZe(e,t,n,i,r){return MZe(e,t,n,i,r)}function $Ze(e,t,n,i,r){return UCe.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,i,r))}class FZe{constructor(t){rn(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));rn(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const i of this.listeners){if(n!==this.updateTick)return;i(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,i,r){return QCe(this,t,n,i,r)}}const CU={...Py},jL=CU.useInsertionEffect,BZe=jL&&jL!==CU.useLayoutEffect?jL:e=>e();function Wn(e){const t=Ku(UZe).current;return t.next=e,BZe(t.effect),t.trampoline}function UZe(){const e={next:void 0,callback:QZe,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function QZe(){}class BI extends FZe{constructor(t,n={},i){super(t),this.context=n,this.selectors=i}useSyncedValue(t,n){p.useDebugValue(t);const i=this;Un(()=>{i.state[t]!==n&&i.set(t,n)},[i,t,n])}useSyncedValueWithCleanup(t,n){const i=this;Un(()=>(i.state[t]!==n&&i.set(t,n),()=>{i.set(t,void 0)}),[i,t,n])}useSyncedValues(t){const n=this,i=Object.values(t);Un(()=>{n.update(t)},[n,...i])}useControlledProp(t,n){p.useDebugValue(t);const i=this,r=n!==void 0;Un(()=>{r&&!Object.is(i.state[t],n)&&i.setState({...i.state,[t]:n})},[i,t,n,r])}select(t,n,i,r){const s=this.selectors[t];return s(this.state,n,i,r)}useState(t,n,i,r){return p.useDebugValue(t),QCe(this,this.selectors[t],n,i,r)}useContextCallback(t,n){p.useDebugValue(t);const i=Wn(n??kU);this.context[t]=i}useStateSetter(t){const n=p.useRef(void 0);return n.current===void 0&&(n.current=i=>{this.set(t,i)}),n.current}observe(t,n){let i;typeof t=="function"?i=t:i=this.selectors[t];let r=i(this.state);return n(r,r,this),this.subscribe(s=>{const o=i(s);if(!Object.is(r,o)){const l=r;r=o,n(o,l,this)}})}}function UI(){return typeof window<"u"}function $a(e){return TU(e)?(e.nodeName||"").toLowerCase():"#document"}function Fs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Sp(e){var t;return(t=(TU(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function TU(e){return UI()?e instanceof Node||e instanceof Fs(e).Node:!1}function ur(e){return UI()?e instanceof Element||e instanceof Fs(e).Element:!1}function Ls(e){return UI()?e instanceof HTMLElement||e instanceof Fs(e).HTMLElement:!1}function qx(e){return!UI()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fs(e).ShadowRoot}function hC(e){const{overflow:t,overflowX:n,overflowY:i,display:r}=au(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&r!=="inline"&&r!=="contents"}function zZe(e){return/^(table|td|th)$/.test($a(e))}function QI(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const VZe=/transform|translate|scale|rotate|perspective|filter/,HZe=/paint|layout|strict|content/,Zg=e=>!!e&&e!=="none";let NL;function AU(e){const t=ur(e)?au(e):e;return Zg(t.transform)||Zg(t.translate)||Zg(t.scale)||Zg(t.rotate)||Zg(t.perspective)||!_U()&&(Zg(t.backdropFilter)||Zg(t.filter))||VZe.test(t.willChange||"")||HZe.test(t.contain||"")}function qZe(e){let t=tg(e);for(;Ls(t)&&!Bm(t);){if(AU(t))return t;if(QI(t))return null;t=tg(t)}return null}function _U(){return NL==null&&(NL=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),NL}function Bm(e){return/^(html|body|#document)$/.test($a(e))}function au(e){return Fs(e).getComputedStyle(e)}function zI(e){return ur(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tg(e){if($a(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qx(e)&&e.host||Sp(e);return qx(t)?t.host:t}function zCe(e){const t=tg(e);return Bm(t)?(e.ownerDocument||e).body:Ls(t)&&hC(t)?t:zCe(t)}function DS(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zCe(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),o=Fs(r);if(s){const l=Q6(o);return t.concat(o,o.visualViewport||[],hC(r)?r:[],l&&n?DS(l):[])}else return t.concat(r,DS(r,[],n))}function Q6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _f(...e){return()=>{for(let t=0;t{e.removeEventListener(t,n,i)}}const hA=null;let WZe=class{constructor(){rn(this,"callbacks",[]);rn(this,"callbacksCount",0);rn(this,"nextId",1);rn(this,"startId",1);rn(this,"isScheduled",!1);rn(this,"tick",t=>{var r;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let s=0;s=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}},pA=new WZe;class Yl{constructor(){rn(this,"currentId",hA);rn(this,"cancel",()=>{this.currentId!==hA&&(pA.cancel(this.currentId),this.currentId=hA)});rn(this,"disposeEffect",()=>this.cancel)}static create(){return new Yl}static request(t){return pA.request(t)}static cancel(t){return pA.cancel(t)}request(t){this.cancel(),this.currentId=pA.request(()=>{this.currentId=hA,t()})}}function jU(){const e=Ku(Yl.create).current;return $I(e.disposeEffect),e}const Y1=0;class lu{constructor(){rn(this,"currentId",Y1);rn(this,"clear",()=>{this.currentId!==Y1&&(clearTimeout(this.currentId),this.currentId=Y1)});rn(this,"disposeEffect",()=>this.clear)}static create(){return new lu}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Y1,n()},t)}isStarted(){return this.currentId!==Y1}}function fy(){const e=Ku(lu.create).current;return $I(e.disposeEffect),e}let ZX=0;function KZe(e){return ZX+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ZX}`}function RL(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}function GZe(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:XZe,platform:YZe,maxTouchPoints:ZZe}=GZe(),VI=XZe.toLowerCase(),MS=YZe.toLowerCase(),HI=/^i(os$|p)/.test(MS)||MS==="macintel"&&ZZe>1,JX="android",z6=MS===JX||VI.includes(JX),JZe=!HI&&MS.startsWith("mac");MS.startsWith("win");const eJe=JZe||HI;var Uae;const Bw=typeof CSS<"u"&&!!((Uae=CSS.supports)!=null&&Uae.call(CSS,"-webkit-backdrop-filter:none"));!Bw&&VI.includes("firefox");!Bw&&VI.includes("chrom");const tJe=eJe,VCe=/jsdom|happydom/.test(VI),V6="data-base-ui-focusable",HCe="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Gl(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function zn(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&qx(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Yo(e){return"composedPath"in e?e.composedPath()[0]:e.target}function qCe(e,t){if(!ur(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,i]of t.entries())if(zn(i,n))return!i.hasAttribute("data-trigger-disabled");return!1}function IL(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function nJe(e){return e.matches("html,body")}function NU(e){return Ls(e)&&e.matches(HCe)}function iJe(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${HCe}`))!=null}function eY(e){return e?e.getAttribute("role")==="combobox"&&NU(e):!1}function H6(e){if(!e||VCe)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function tY(e){return e?e.hasAttribute(V6)?e:e.querySelector(`[${V6}]`)||e:null}function ng(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>{var s;return[...!n||(s=r.context)!=null&&s.open?[r]:[],...ng(e,r.id,n)]})}function nY(e,t){var r;let n=[],i=(r=e.find(s=>s.id===t))==null?void 0:r.parentId;for(;i;){const s=e.find(o=>o.id===i);i=s==null?void 0:s.parentId,s&&(n=n.concat(s))}return n}function rJe(e){e.preventDefault(),e.stopPropagation()}function sJe(e){return"nativeEvent"in e}function oJe(e){return e.pointerType===""&&e.isTrusted?!0:z6&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function WCe(e){return VCe?!1:!z6&&e.width===0&&e.height===0||z6&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Jv(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function aJe(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const lJe=["top","right","bottom","left"],ig=Math.min,qh=Math.max,cN=Math.round,mA=Math.floor,Wh=e=>({x:e,y:e}),cJe={left:"right",right:"left",bottom:"top",top:"bottom"};function RU(e,t,n){return qh(e,ig(t,n))}function Pf(e,t){return typeof e=="function"?e(t):e}function Qu(e){return e.split("-")[0]}function Ep(e){return e.split("-")[1]}function IU(e){return e==="x"?"y":"x"}function qI(e){return e==="y"?"height":"width"}function Iu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function WI(e){return IU(Iu(e))}function uJe(e,t,n){n===void 0&&(n=!1);const i=Ep(e),r=WI(e),s=qI(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=uN(o)),[o,uN(o)]}function dJe(e){const t=uN(e);return[q6(e),t,q6(t)]}function q6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const iY=["left","right"],rY=["right","left"],fJe=["top","bottom"],hJe=["bottom","top"];function pJe(e,t,n){switch(e){case"top":case"bottom":return n?t?rY:iY:t?iY:rY;case"left":case"right":return t?fJe:hJe;default:return[]}}function mJe(e,t,n,i){const r=Ep(e);let s=pJe(Qu(e),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),t&&(s=s.concat(s.map(q6)))),s}function uN(e){const t=Qu(e);return cJe[t]+e.slice(t.length)}function gJe(e){var t,n,i,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(r=e.left)!=null?r:0}}function PU(e){return typeof e!="number"?gJe(e):{top:e,right:e,bottom:e,left:e}}function dN(e){const{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function bJe(e){return e.visibility==="hidden"||e.visibility==="collapse"}function KCe(e,t=e?au(e):null){return!e||!e.isConnected||!t||bJe(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const yJe='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function vJe(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return qx(n)?n.host:null}function W6(e){for(const t of Array.from(e.children))if($a(t)==="summary")return t;return null}function xJe(e,t){const n=W6(t);return!!n&&(e===n||zn(n,e))}function GCe(e){const t=e?$a(e):"";return e!=null&&e.matches(yJe)&&(t!=="summary"||e.parentElement!=null&&$a(e.parentElement)==="details"&&W6(e.parentElement)===e)&&(t!=="details"||W6(e)==null)&&(t!=="input"||e.type!=="hidden")}function XCe(e){if(!GCe(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=vJe(t)){const n=t!==e,i=$a(t)==="slot";if(t.hasAttribute("inert")||n&&$a(t)==="details"&&!t.open&&!xJe(e,t)||t.hasAttribute("hidden")||!i&&!wJe(t,n))return!1}return!0}function wJe(e,t){const n=au(e);return t?n.display!=="none":KCe(e,n)}function YCe(e){const t=e.tabIndex;if(t<0){const n=$a(e);if(n==="details"||n==="audio"||n==="video"||Ls(e)&&e.isContentEditable)return 0}return t}function PL(e){if($a(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function OJe(e,t){const n=PL(e);if(!n)return!0;const i=t.find(r=>{const s=PL(r);return(s==null?void 0:s.name)===n.name&&s.form===n.form&&s.checked});return i?i===n:t.find(r=>{const s=PL(r);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function ZCe(e){if(Ls(e)&&$a(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ls(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function JCe(e,t){ZCe(e).forEach(n=>{GCe(n)&&t.push(n),JCe(n,t)})}function eTe(e,t,n){ZCe(e).forEach(i=>{Ls(i)&&i.matches(t)&&n.push(i),eTe(i,t,n)})}function DU(e){return XCe(e)&&YCe(e)>=0}function tTe(e){const t=[];return JCe(e,t),t.filter(XCe)}function pC(e){const t=tTe(e);return t.filter(n=>YCe(n)>=0&&OJe(n,t))}function nTe(e,t){const n=pC(e),i=n.length;if(i===0)return;const r=Gl(lr(e)),s=n.indexOf(r),o=s===-1?t===1?0:i-1:s+t;return n[o]}function MU(e){return nTe(lr(e).body,1)||e}function iTe(e){return nTe(lr(e).body,-1)||e}function rTe(e,t){if(!e)return null;const n=pC(lr(e).body),i=n.length;if(i===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+i)%i;return n[s]}function kJe(e){return rTe(e,1)}function SJe(e){return rTe(e,-1)}function ex(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!zn(n,i)}function EJe(e){pC(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function sY(e){const t=[];eTe(e,"[data-tabindex]",t),t.forEach(n=>{const i=n.dataset.tabindex;delete n.dataset.tabindex,i?n.setAttribute("tabindex",i):n.removeAttribute("tabindex")})}function DL(e){const t=new Map;let n=0,i=0;return e.forEach((r,s)=>{const o=r.transitionStatus==="ending";t.set(r.id,{value:r,domIndex:s,visibleIndex:o?-1:n,offsetY:i}),i+=r.height||0,o||(n+=1)}),t}function ML(e,t){let n=0;return e.map(i=>{if(i.transitionStatus==="ending")return i;const r=n>=t;return n+=1,i.limited===r?i:{...i,limited:r}})}const Yd={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>{var n;return(n=e.toastMetadata.get(t))==null?void 0:n.value},toastIndex:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.domIndex)??-1},toastOffsetY:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.offsetY)??0},toastVisibleIndex:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.visibleIndex)??-1},focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement};class CJe extends BI{constructor(n){super({...n,toastMetadata:DL(n.toasts)},{},Yd);rn(this,"timers",new Map);rn(this,"areTimersPaused",!1);rn(this,"setViewport",n=>{this.set("viewport",n)});rn(this,"disposeEffect",()=>()=>{this.timers.forEach(n=>{var i;(i=n.timeout)==null||i.clear()}),this.timers.clear()});rn(this,"addToast",n=>{const{timeout:i,limit:r}=this.state,s=n.id||KZe("toast");if(n.id){const u=Yd.toast(this.state,n.id);if(u)if(u.transitionStatus==="ending")this.removeToast(n.id,!0);else{const{id:d,transitionStatus:f,...h}=n;return this.updateToastInternal(n.id,h,!0,!0),n.id}}const o={...n,id:s,updateKey:0,transitionStatus:"starting"},l=[o,...this.state.toasts];this.setToasts(ML(l,r));const c=o.timeout??i;return o.type!=="loading"&&c>0&&this.scheduleTimer(s,c,()=>this.closeToast(s)),Yd.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s});rn(this,"updateToast",(n,i)=>{this.updateToastInternal(n,i,!1,!0)});rn(this,"updateToastInternal",(n,i,r=!1,s=!1)=>{const{timeout:o,toasts:l}=this.state,c=Yd.toast(this.state,n);if(!c||c.transitionStatus==="ending")return;const u={...c,...i,...s&&{updateKey:c.updateKey+1}};this.setToasts(l.map(y=>y.id===n?u:y));const d=u.timeout??o,f=c.timeout??o,h=Object.hasOwn(i,"timeout"),m=u.transitionStatus!=="ending"&&u.type!=="loading"&&d>0,g=this.timers.has(n),b=f!==d,v=c.type==="loading";if(!m&&g){this.clearTimer(n);return}m&&(!g||b||h||v||r)&&(this.clearTimer(n),this.scheduleTimer(n,d,()=>this.closeToast(n)),Yd.expandedOrOutOfFocus(this.state)&&this.pauseTimers())});rn(this,"closeToast",n=>{const i=n===void 0,{limit:r,toasts:s}=this.state;let o;if(i)o=s,this.clearTimers();else{const u=Yd.toast(this.state,n);if(!u)return;o=[u],this.clearTimer(n)}const l=s.map(u=>i||u.id===n?{...u,transitionStatus:"ending",height:0}:u),c=ML(l,r);this.setToasts(c,!c.some(u=>u.transitionStatus!=="ending")),o.forEach(u=>{var d;u.transitionStatus!=="ending"&&((d=u.onClose)==null||d.call(u))}),this.handleFocusManagement(n)});rn(this,"promiseToast",(n,i)=>{const r=RL(i.loading),s=this.addToast({...r,type:"loading"}),o=n.then(l=>{const c=RL(i.success,l);return this.updateToast(s,{...c,type:"success",timeout:c.timeout}),l}).catch(l=>{const c=RL(i.error,l);return this.updateToast(s,{...c,type:"error",timeout:c.timeout}),Promise.reject(l)});return{}.hasOwnProperty.call(i,"setPromise")&&i.setPromise(o),o});rn(this,"handleDocumentPointerDown",n=>{if(n.pointerType!=="touch")return;const i=Yo(n);zn(this.state.viewport,i)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}syncProviderProps(n,i){const r=this.state.limit!==i;if(this.state.timeout===n&&!r)return;const s={timeout:n,limit:i};if(r){const o=ML(this.state.toasts,i);s.toasts=o,s.toastMetadata=DL(o)}this.update(s)}removeToast(n,i=!1){var l;const r=Yd.toastIndex(this.state,n);if(r===-1)return;const s=this.state.toasts[r];i||(l=s==null?void 0:s.onRemove)==null||l.call(s);const o=[...this.state.toasts];o.splice(r,1),this.setToasts(o)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(n=>{n.timeout&&(n.timeout.clear(),n.remaining=Math.max(n.remaining-(Date.now()-n.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((n,i)=>{n.remaining=n.remaining>0?n.remaining:n.delay,n.timeout??(n.timeout=lu.create()),n.timeout.start(n.remaining,()=>{this.handleTimerFired(i),n.callback()}),n.start=Date.now()}))}restoreFocusToPrevElement(){var n;(n=this.state.prevFocusElement)==null||n.focus({preventScroll:!0})}scheduleTimer(n,i,r){const s=Date.now(),l=!Yd.expandedOrOutOfFocus(this.state)?lu.create():void 0;l==null||l.start(i,()=>{this.handleTimerFired(n),r()}),this.timers.set(n,{timeout:l,start:s,delay:i,remaining:i,callback:r})}clearTimers(){this.timers.forEach(n=>{var i;(i=n.timeout)==null||i.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(n){var r;const i=this.timers.get(n);(r=i==null?void 0:i.timeout)==null||r.clear(),this.timers.delete(n),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(n){this.timers.delete(n),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(n,i=n.length===0){const r={toasts:n,toastMetadata:DL(n)};i&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(n){var c,u;const i=Gl(lr(this.state.viewport));if(!this.state.viewport||!zn(this.state.viewport,i)||!H6(i))return;if(n===void 0){this.restoreFocusToPrevElement();return}const r=Yd.toasts(this.state),s=Yd.toastIndex(this.state,n),o=(d,f)=>{for(let h=d;h>=0&&hnew CJe({timeout:i,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return $I(o.disposeEffect),p.useEffect(function(){return s?s[" subscribe"](({action:u,options:d})=>{const f=d.id;u==="promise"&&d.promise?o.promiseToast(d.promise,d):u==="update"&&f?o.updateToast(f,d):u==="close"?o.closeToast(f):o.addToast(d)}):void 0},[o,s]),a.jsxs($Ce.Provider,{value:o,children:[a.jsx(AJe,{store:o,timeout:i,limit:r}),n]})};function AJe(e){const{store:t,timeout:n,limit:i}=e;return Un(()=>{t.syncProviderProps(n,i)},[t,n,i]),null}const _Je={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},sTe={..._Je,position:"fixed",top:0,left:0},hy=p.forwardRef(function(t,n){const[i,r]=p.useState();Un(()=>{tJe&&Bw&&r("button")},[]);const s={tabIndex:0,role:i};return a.jsx("span",{...t,ref:n,style:sTe,"aria-hidden":i?void 0:!0,...s,"data-base-ui-focus-guard":""})});function Wx(e,t,n,i){const r=Ku(oTe).current;return NJe(r,e,t,n,i)&&aTe(r,[e,t,n,i]),r.callback}function jJe(e){const t=Ku(oTe).current;return RJe(t,e)&&aTe(t,e),t.callback}function oTe(){return{callback:null,cleanup:null,refs:[]}}function NJe(e,t,n,i,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==i||e.refs[3]!==r}function RJe(e,t){return e.refs.length!==t.length||e.refs.some((n,i)=>n!==t[i])}function aTe(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const i=Array(t.length).fill(null);for(let r=0;r{for(let r=0;r=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function FU(e){return typeof e=="function"}function uTe(e,t){return FU(e)?e(t):e??LU}function $Je(e,t){return t?e?(...n)=>{const i=n[0];if(hTe(i)){const s=i;hN(s);const o=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),o}const r=t(...n);return e==null||e(...n),r}:dTe(t):e}function dTe(e){return e&&((...t)=>{const n=t[0];return hTe(n)&&hN(n),e(...t)})}function hN(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function fTe(e,t){return t?e?t+" "+e:t:e}function hTe(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Do(e,t,n={}){const i=t.render,r=FJe(t,n);if(n.enabled===!1)return null;const s=n.state??Cl;return QJe(e,i,r,s)}function FJe(e,t={}){const{className:n,style:i,render:r}=e,{state:s=Cl,ref:o,props:l,stateAttributesMapping:c,enabled:u=!0}=t,d=u?PJe(n,s):void 0,f=u?lTe(i,s):void 0,h=u?IJe(s,c):Cl,m=u&&l?BJe(l):void 0,g=u?K6(h,m)??{}:Cl;return typeof document<"u"&&(u?Array.isArray(o)?g.ref=jJe([g.ref,oY(r),...o]):g.ref=Wx(g.ref,oY(r),o):Wx(null,null)),u?(d!==void 0&&(g.className=fTe(g.className,d)),f!==void 0&&(g.style=K6(g.style,f)),g):Cl}function BJe(e){return Array.isArray(e)?DJe(e):$U(void 0,e)}const UJe=Symbol.for("react.lazy");function QJe(e,t,n,i){if(t){if(typeof t=="function")return t(n,i);const r=$U(n,t.props);r.ref=n.ref;let s=t;return(s==null?void 0:s.$$typeof)===UJe&&(s=p.Children.toArray(t)[0]),p.cloneElement(s,r)}if(e&&typeof e=="string")return zJe(e,n);throw new Error(du(8))}function zJe(e,t){return e==="button"?p.createElement("button",{type:"button",...t,key:t.key}):e==="img"?p.createElement("img",{alt:"",...t,key:t.key}):p.createElement(e,t)}const VJe=p.forwardRef(function(t,n){var U;const{render:i,className:r,style:s,children:o,...l}=t,c=SU(),u=fy(),d=p.useRef(!1),f=p.useRef(!1),h=p.useRef(!1),m=c.useState("isEmpty"),g=c.useState("toasts"),b=c.useState("focused"),v=c.useState("expanded"),y=c.useState("prevFocusElement"),x=(U=g[0])==null?void 0:U.height,w=g.some(I=>I.transitionStatus==="ending"),O=g.filter(I=>I.priority==="high");p.useEffect(()=>{const I=c.state.viewport;if(!I||m)return;const H=Fs(I),K=lr(I);function F(X){X.key==="F6"&&Yo(X)!==I&&(X.preventDefault(),c.set("prevFocusElement",Gl(K)),I==null||I.focus({preventScroll:!0}),c.pauseTimers(),c.set("focused",!0))}function W(X){Yo(X)===H&&(c.set("isWindowFocused",!1),c.pauseTimers())}function V(X){if(X.relatedTarget)return;const ie=Yo(X),Q=Gl(lr(I));(ie===H||!zn(I,ie)||!H6(Q))&&c.resumeTimers(),u.start(0,()=>c.set("isWindowFocused",!0))}return _f(mi(H,"keydown",F),mi(H,"blur",W,!0),mi(H,"focus",V,!0),mi(K,"pointerdown",c.handleDocumentPointerDown,!0))},[c,u,m]);function S(I){var K,F;d.current=!0;const H=I.relatedTarget===c.state.viewport?g.find(W=>W.transitionStatus!=="ending"&&!W.limited):void 0;H?(F=(K=H.ref)==null?void 0:K.current)==null||F.focus():c.restoreFocusToPrevElement()}function k(I){I.key==="Tab"&&I.shiftKey&&Yo(I.nativeEvent)===c.state.viewport&&(I.preventDefault(),c.restoreFocusToPrevElement())}function C(){c.state.toasts.some(H=>H.transitionStatus==="ending")||h.current||!f.current||(c.state.isWindowFocused&&c.resumeTimers(),c.set("hovering",!1),f.current=!1)}p.useEffect(C,[w,c]);function E(){c.pauseTimers(),c.set("hovering",!0),f.current=!1}function R(){c.state.isWindowFocused&&c.resumeTimers()}function _(){f.current=!0,C()}function j(I){I.pointerType==="touch"&&(h.current=!0)}function T(I){I.pointerType==="touch"&&(h.current=!1,C())}function N(){if(d.current){d.current=!1;return}b||H6(Gl(lr(c.state.viewport)))&&(c.set("focused",!0),c.pauseTimers())}function A(I){!b||zn(c.state.viewport,I.relatedTarget)||(c.set("focused",!1),R())}const P={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:E,onMouseMove:E,onMouseLeave:_,onFocus:N,onBlur:A,onKeyDown:k,onClick:N,onPointerDown:j,onPointerUp:T,onPointerCancel:T,style:{"--toast-frontmost-height":x?`${x}px`:void 0}},D={expanded:v},M=!m&&y&&a.jsx(hy,{onFocus:S}),L=Do("div",t,{ref:[n,c.setViewport],state:D,props:[P,l,{children:a.jsxs(p.Fragment,{children:[M,o,M]})}]});return a.jsxs(p.Fragment,{children:[M,L,!b&&O.length>0&&a.jsx("div",{style:sTe,children:O.map(I=>a.jsxs("div",{role:"alert","aria-atomic":!0,children:[a.jsx("div",{children:I.title}),a.jsx("div",{children:I.description})]},I.id))})]})});function BU(e){return EU(19)?e:e?"true":void 0}const pTe=p.createContext(void 0);function HJe(){const e=p.useContext(pTe);if(!e)throw new Error(du(66));return e}let pN=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const qJe={"data-starting-style":""},WJe={"data-ending-style":""},KI={transitionStatus(e){return e==="starting"?qJe:e==="ending"?WJe:null}};function mh(e){return e==null?e:"current"in e?e.current:e}function UU(e,t=!1){const n=jU();return Wn((i,r=null)=>{n.cancel();const s=mh(e);if(s==null)return;const o=s,l=()=>{ri.flushSync(i)};if(typeof o.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function c(){Promise.all(o.getAnimations().map(u=>u.finished)).then(()=>{r!=null&&r.aborted||l()},()=>{if(r!=null&&r.aborted)return;if(o.getAnimations().some(d=>d.pending||d.playState!=="finished")){c();return}l()})}if(t){const u="data-starting-style";if(!o.hasAttribute(u)){n.request(c);return}const d=new MutationObserver(()=>{o.hasAttribute(u)||(d.disconnect(),c())});d.observe(o,{attributes:!0,attributeFilter:[u]}),r==null||r.addEventListener("abort",()=>d.disconnect(),{once:!0});return}n.request(c)})}function mC(e){const{enabled:t=!0,open:n,ref:i,onComplete:r}=e,s=Wn(r),o=UU(i,n);p.useEffect(()=>{if(!t)return;const l=new AbortController;return o(s,l.signal),()=>{l.abort()}},[t,n,s,o])}const KJe=500,GJe={style:{transition:"none"}},mTe="data-base-ui-click-trigger",XJe="data-base-ui-swipe-ignore",YJe="data-swipe-ignore",ZJe=`[${XJe}]`,JJe=`[${YJe}]`,eet={fallbackAxisSide:"end"},tet={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function LL(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function net(e){const n=Fs(e).getComputedStyle(e).transform;let i=0,r=0,s=1;if(n&&n!=="none"){const o=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const l=o[1].split(", ").map(parseFloat);l.length===6?(i=l[4],r=l[5],s=Math.sqrt(l[0]*l[0]+l[1]*l[1])):l.length===16&&(i=l[12],r=l[13],s=l[0])}}return{x:i,y:r,scale:s}}const iet={...KI,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},aY=40,ret=10,lY=.5,set=1,oet=`${ZJe},${JJe}`,aet=p.forwardRef(function(t,n){var Ve;const{toast:i,render:r,className:s,swipeDirection:o=["down","right"],style:l,...c}=t,u=((Ve=i.positionerProps)==null?void 0:Ve.anchor)!==void 0;let d=[];u||(d=Array.isArray(o)?o:[o]);const f=d.length>0,h=SU(),[m,g]=p.useState(void 0),[b,v]=p.useState(!1),[y,x]=p.useState(!1),[w,O]=p.useState({x:0,y:0}),[S,k]=p.useState({x:0,y:0,scale:1}),[C,E]=p.useState(),[R,_]=p.useState(),[j,T]=p.useState(null),N=p.useRef(null),A=p.useRef(void 0),P=p.useRef({x:0,y:0}),D=p.useRef({x:0,y:0,scale:1}),M=p.useRef(void 0),L=p.useRef(0),U=p.useRef(!1),I=p.useRef({x:0,y:0}),H=p.useRef(!1),K=p.useRef({x:0,y:0}),F=p.useRef(null),W=p.useRef(null),V=h.useState("toastIndex",i.id),X=h.useState("toastVisibleIndex",i.id),ie=h.useState("toastOffsetY",i.id),Q=h.useState("focused"),Z=h.useState("expanded");mC({open:i.transitionStatus!=="ending",ref:N,onComplete(){i.transitionStatus==="ending"&&h.removeToast(i.id)}});const ce=Wn((ve=!1)=>{const Re=N.current;if(!Re)return;const ne=Re.style.height;Re.style.height="auto";const ge=Re.offsetHeight;Re.style.height=ne;function Ce(){h.updateToastInternal(i.id,{ref:N,height:ge,transitionStatus:void 0})}ve?ri.flushSync(Ce):Ce()});Un(()=>{const ve=A.current;i.transitionStatus!=="starting"&&ve===i.id||(ve!==void 0&&(g(void 0),k({x:0,y:0,scale:1}),Ee({x:0,y:0})),A.current=i.id,ce())},[ce,i.id,i.transitionStatus]);function Ee(ve){K.current=ve,O(ve)}Un(()=>()=>{var ve;(ve=W.current)==null||ve.abort()},[]);function Y(ve,Re){const ne=ke=>ke>0?ke**lY:-(Math.abs(ke)**lY),ge=ve>0&&!d.includes("right")||ve<0&&!d.includes("left"),Ce=Re>0&&!d.includes("down")||Re<0&&!d.includes("up");return{x:ge?ne(ve):ve,y:Ce?ne(Re):Re}}const G=Wn(ve=>{var Ke;if(ve.pointerId!==F.current)return;F.current=null,(Ke=W.current)==null||Ke.abort(),W.current=null,v(!1),x(!1),T(null);const Re=D.current;if(ve.type==="pointercancel"||U.current){Ee({x:Re.x,y:Re.y}),g(void 0);return}const ne=K.current,ge=ne.x-Re.x,Ce=ne.y-Re.y;let ke;for(const it of d)if(LL(it,ge,Ce)>aY){ke=it;break}ke?(g(ke),h.closeToast(i.id)):(Ee({x:Re.x,y:Re.y}),g(void 0))});function te(ve){var it,ue;if(ve.button!==0)return;ve.pointerType==="touch"&&h.pauseTimers();const Re=Yo(ve.nativeEvent);if(Re==null?void 0:Re.closest(`button,a,input,textarea,[role="button"],${oet}`))return;U.current=!1,M.current=void 0,L.current=0,F.current=ve.pointerId,P.current={x:ve.clientX,y:ve.clientY},I.current=P.current;const ge=ve.currentTarget,Ce=net(ge);D.current=Ce,k(Ce),Ee({x:Ce.x,y:Ce.y}),h.set("hovering",!0),v(!0),x(!1),T(null),H.current=!0,(it=W.current)==null||it.abort();const ke=new AbortController;W.current=ke;const Ke=lr(ge);Ke.addEventListener("pointerup",G,{signal:ke.signal}),Ke.addEventListener("pointercancel",G,{signal:ke.signal}),(ue=ge.setPointerCapture)==null||ue.call(ge,ve.pointerId)}function ye(ve){if(ve.pointerId!==F.current)return;ve.preventDefault(),H.current&&(P.current={x:ve.clientX,y:ve.clientY},H.current=!1);const{clientY:Re,clientX:ne,movementX:ge,movementY:Ce}=ve;(Ce<0&&Re>I.current.y||Ce>0&&ReI.current.x||ge>0&&ne=set){x(!0);const Ct=d.includes("left")||d.includes("right"),dt=d.includes("up")||d.includes("down");if(Ct&&dt){const yt=Math.abs(ke),Ie=Math.abs(Ke);xe=yt>Ie?"horizontal":"vertical",T(xe)}}let Te;if(!M.current)xe==="vertical"?Ke>0?Te="down":Ke<0&&(Te="up"):xe==="horizontal"?ke>0?Te="right":ke<0&&(Te="left"):Math.abs(ke)>=Math.abs(Ke)?Te=ke>0?"right":"left":Te=Ke>0?"down":"up",Te&&d.includes(Te)&&(M.current=Te,L.current=LL(Te,ke,Ke),g(Te));else{const Ot=M.current,Ct=LL(Ot,ue,it);Ct>aY?(U.current=!1,g(Ot)):!(d.includes("left")&&d.includes("right"))&&!(d.includes("up")&&d.includes("down"))&&L.current-Ct>=ret&&(U.current=!0)}const qe=Y(ke,Ke);let De=D.current.x,At=D.current.y;const It=d.includes("left")||d.includes("right"),lt=d.includes("up")||d.includes("down");xe!=="vertical"&&It&&(De+=qe.x),xe!=="horizontal"&<&&(At+=qe.y),Ee({x:De,y:At})}function Ne(ve){if(ve.key==="Escape"){if(!N.current||!zn(N.current,Gl(lr(N.current))))return;h.closeToast(i.id)}}p.useEffect(()=>{const ve=N.current;if(!f||!ve)return;function Re(ne){F.current===null||!zn(ve,Yo(ne))||ne.preventDefault()}return mi(ve,"touchmove",Re,{passive:!1})},[f]);function pe(){const ve=w.x-S.x,Re=w.y-S.y;return{transition:b?"none":void 0,transform:b?`translateX(${w.x}px) translateY(${w.y}px) scale(${S.scale})`:void 0,"--toast-swipe-movement-x":`${ve}px`,"--toast-swipe-movement-y":`${Re}px`}}const me=i.priority==="high",se={role:me?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":R,"aria-hidden":me&&!Q?!0:void 0,onPointerDown:f?te:void 0,onPointerMove:f?ye:void 0,onPointerUp:f?G:void 0,onPointerCancel:f?G:void 0,onKeyDown:Ne,inert:BU(i.limited),style:{...pe(),"--toast-index":i.transitionStatus==="ending"?V:X,"--toast-offset-y":`${ie}px`,"--toast-height":i.height?`${i.height}px`:void 0}},Se=p.useMemo(()=>({toast:i,setTitleId:E,setDescriptionId:_,recalculateHeight:ce,visibleIndex:X,expanded:Z}),[i,E,_,ce,X,Z]),Le={transitionStatus:i.transitionStatus,expanded:Z,limited:i.limited||!1,type:i.type,swiping:b,swipeDirection:m},be=Do("div",t,{ref:[n,N],state:Le,stateAttributesMapping:iet,props:[se,c]});return a.jsx(pTe.Provider,{value:Se,children:be})});let cY=0;function cet(e,t="mui"){const[n,i]=p.useState(e),r=e||n;return p.useEffect(()=>{n==null&&(cY+=1,i(`${t}-${cY}`))},[n,t]),r}const uY=CU.useId;function gC(e,t){if(uY!==void 0){const n=uY();return e??(t?`${t}-${n}`:n)}return cet(e,t)}function gTe(e){return e==null||typeof e=="boolean"||e===""?!1:Array.isArray(e)?e.some(gTe):!0}function uet(e){return p.isValidElement(e)&&gTe(e.props.children)}function bTe(e,t,n){const{toast:i,setTitleId:r,setDescriptionId:s}=HJe(),o=n==="title"?r:s,l=t??(n==="title"?i.title:i.description);return{id:gC(e),children:l,type:i.type,setId:o}}function yTe(e,t,n){const i=uet(e);return Un(()=>{if(i)return n(t),()=>{n(r=>r===t?void 0:r)}},[i,t,n]),i?e:null}const det=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,children:l,...c}=t,{id:u,children:d,type:f,setId:h}=bTe(o,l,"description"),g=Do("p",t,{ref:n,state:{type:f},props:{...c,id:u,children:d}});return yTe(g,u,h)}),fet=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,children:l,...c}=t,{id:u,children:d,type:f,setId:h}=bTe(o,l,"title"),g=Do("h2",t,{ref:n,state:{type:f},props:{...c,id:u,children:d}});return yTe(g,u,h)}),het=p.createContext(void 0);function pet(e=!1){const t=p.useContext(het);if(t===void 0&&!e)throw new Error(du(16));return t}function met(e){const{focusableWhenDisabled:t,disabled:n,composite:i=!1,tabIndex:r=0,isNativeButton:s}=e,o=i&&t!==!1,l=i&&t===!1;return{props:p.useMemo(()=>{const u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return i||(u.tabIndex=r,!s&&n&&(u.tabIndex=t?r:-1)),(s&&(t||o)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||l)&&(u.disabled=n),u},[i,n,t,o,l,s,r])}}function $L(e,t,{detail:n=0}={}){e.dispatchEvent(new(Fs(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function QU(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:i=0,native:r=!0,composite:s}=e,o=p.useRef(null),l=pet(!0),c=s??l!==void 0,{props:u}=met({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:i,isNativeButton:r}),d=p.useCallback(()=>{const m=o.current;FL(m)&&c&&t&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,u.disabled,c]);Un(d,[d]);const f=p.useCallback((m={})=>{const{onClick:g,onMouseDown:b,onKeyUp:v,onKeyDown:y,onPointerDown:x,...w}=m;return $U({onClick(O){if(t){O.preventDefault();return}g==null||g(O)},onMouseDown(O){t||b==null||b(O)},onKeyDown(O){if(t||(hN(O),y==null||y(O),O.baseUIHandlerPrevented))return;const S=O.target===O.currentTarget,k=O.currentTarget,C=FL(k),E=!r&&get(k),R=S&&(r?C:!E),_=O.key==="Enter",j=O.key===" ",T=k.getAttribute("role"),N=(T==null?void 0:T.startsWith("menuitem"))||T==="option"||T==="gridcell";if(S&&c&&j){if(O.defaultPrevented&&N)return;O.preventDefault(),(!r||C)&&(O.preventBaseUIHandler(),$L(k,O));return}if(!R||r||!j&&!_){S&&E&&j&&O.preventDefault();return}O.defaultPrevented||(O.preventDefault(),_&&(O.preventBaseUIHandler(),$L(k,O)))},onKeyUp(O){if(!t){if(hN(O),v==null||v(O),O.target===O.currentTarget&&r&&c&&FL(O.currentTarget)&&O.key===" "){O.preventDefault();return}O.baseUIHandlerPrevented||O.target===O.currentTarget&&!r&&!c&&!O.defaultPrevented&&O.key===" "&&(O.preventBaseUIHandler(),$L(O.currentTarget,O))}},onPointerDown(O){if(t){O.preventDefault();return}x==null||x(O)}},r?{type:"button"}:{role:"button"},u,w)},[t,u,c,r]),h=Wn(m=>{o.current=m,d()});return{getButtonProps:f,buttonRef:h}}function FL(e){return Ls(e)&&e.tagName==="BUTTON"}function get(e){return Ls(e)&&e.tagName==="A"&&!!e.href}const vTe="none",Kx="trigger-press",Bc="trigger-hover",xTe="outside-press",wTe="close-press",LS="focus-out",OTe="escape-key",kTe="imperative-action";function Gs(e,t,n,i){let r=!1,s=!1;const o=Cl;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...o}}function mN(e){return`data-base-ui-${e}`}const STe=p.createContext(null),ETe=()=>p.useContext(STe),bet=mN("portal");function CTe(e={}){const{ref:t,container:n,componentProps:i=Cl,elementProps:r}=e,s=gC(),o=ETe(),l=o==null?void 0:o.portalNode,[c,u]=p.useState(null),[d,f]=p.useState(null),h=Wn(v=>{v!==null&&f(v)}),m=p.useRef(null);Un(()=>{if(n===null){m.current&&(m.current=null,f(null),u(null));return}const v=(n&&(TU(n)?n:n.current))??l??document.body;if(v==null){m.current&&(m.current=null,f(null),u(null));return}m.current!==v&&(m.current=v,f(null),u(v))},[n,l]);const g=Do("div",i,{ref:[t,h],props:[{id:s,[bet]:""},r]}),b=c&&g?ri.createPortal(g,c):null;return{node:d,nodeId:p.isValidElement(g)?g.props.id:void 0,subtree:b}}const TTe=p.forwardRef(function(t,n){const{render:i,className:r,style:s,children:o,container:l,...c}=t,{node:u,nodeId:d,subtree:f}=CTe({container:l,ref:n,componentProps:t,elementProps:c}),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=p.useRef(null),[v,y]=p.useState(null),x=p.useRef(!1),w=v==null?void 0:v.modal,O=v==null?void 0:v.open,S=!!v&&!v.modal&&v.open&&!!u;p.useEffect(()=>{if(!u||w)return;function C(E){u&&E.relatedTarget&&ex(E)&&(E.type==="focusin"?x.current&&(sY(u),x.current=!1):(EJe(u),x.current=!0))}return _f(mi(u,"focusin",C,!0),mi(u,"focusout",C,!0))},[u,w]),Un(()=>{!u||O!==!0||!x.current||(sY(u),x.current=!1)},[O,u]);const k=p.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:m,beforeInsideRef:g,afterInsideRef:b,portalNode:u,setFocusManagerState:y}),[u]);return a.jsxs(p.Fragment,{children:[f,a.jsxs(STe.Provider,{value:k,children:[S&&u&&a.jsx(hy,{"data-type":"outside",ref:h,onFocus:C=>{var E;if(ex(C,u))(E=g.current)==null||E.focus();else{const R=v?v.domReference:null,_=iTe(R);_==null||_.focus()}}}),S&&u&&a.jsx("span",{"aria-owns":d,style:tet}),u&&ri.createPortal(o,u),S&&u&&a.jsx(hy,{"data-type":"outside",ref:m,onFocus:C=>{var E;if(ex(C,u))(E=b.current)==null||E.focus();else{const R=v?v.domReference:null,_=MU(R);_==null||_.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,Gs(LS,C.nativeEvent)))}}})]})]})}),yet=p.forwardRef(function(t,n){const{children:i,container:r,className:s,render:o,style:l,...c}=t,{node:u,subtree:d}=CTe({container:r,ref:n,componentProps:t,elementProps:c});return!d&&!u?null:a.jsxs(p.Fragment,{children:[d,u&&ri.createPortal(i,u)]})}),vet=p.forwardRef(function(t,n){return a.jsx(yet,{ref:n,...t})});function Ol(e){const t=Ku(xet,e).current;return t.next=e,Un(t.effect),t}function xet(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function wet(e,t){return t!=null&&!Jv(t)?0:typeof e=="function"?e():e}function G6(e,t,n){const i=wet(e,n);return typeof i=="number"?i:i==null?void 0:i[t]}function dY(e){return typeof e=="function"?e():e}function ATe(e,t){return t||e==="click"||e==="mousedown"}function Oet(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}let gA=0;function BL(e,t={}){const{preventScroll:n=!1,sync:i=!1,shouldFocus:r}=t;cancelAnimationFrame(gA);function s(){r&&!r()||e==null||e.focus({preventScroll:n})}if(i)return s(),kU;const o=requestAnimationFrame(s);return gA=o,()=>{gA===o&&(cancelAnimationFrame(o),gA=0)}}const UL={inert:new WeakMap,"aria-hidden":new WeakMap},fY="data-base-ui-inert",X6={inert:new WeakSet,"aria-hidden":new WeakSet};let Z1=new WeakMap,QL=0;function ket(e){return X6[e]}function _Te(e){return e?qx(e)?e.host:_Te(e.parentNode):null}const hY=(e,t)=>t.map(n=>{if(e.contains(n))return n;const i=_Te(n);return e.contains(i)?i:null}).filter(n=>n!=null),pY=e=>{const t=new Set;return e.forEach(n=>{let i=n;for(;i&&!t.has(i);)t.add(i),i=i.parentNode}),t},mY=(e,t,n)=>{const i=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(o=>{$a(o)!=="script"&&(t.has(o)?r(o):i.push(o))})};return r(e),i};function Eet(e,t,n,i,{mark:r=!0}){let s=null;i?s="inert":n&&(s="aria-hidden");let o=null,l=null;const c=hY(t,e),u=r?mY(t,pY(c),new Set(c)):[],d=[],f=[];if(s){const h=UL[s],m=ket(s);l=m,o=h;const g=hY(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(g);mY(t,pY(b),new Set(b)).forEach(y=>{const x=y.getAttribute(s),w=x!==null&&x!=="false",O=(h.get(y)||0)+1;h.set(y,O),d.push(y),O===1&&w&&m.add(y),w||y.setAttribute(s,s==="inert"?"":"true")})}return r&&u.forEach(h=>{const m=(Z1.get(h)||0)+1;Z1.set(h,m),f.push(h),m===1&&h.setAttribute(fY,"")}),QL+=1,()=>{o&&d.forEach(h=>{const g=(o.get(h)||0)-1;o.set(h,g),g||(!(l!=null&&l.has(h))&&s&&h.removeAttribute(s),l==null||l.delete(h))}),r&&f.forEach(h=>{const m=(Z1.get(h)||0)-1;Z1.set(h,m),m||h.removeAttribute(fY)}),QL-=1,QL||(UL.inert=new WeakMap,UL["aria-hidden"]=new WeakMap,X6.inert=new WeakSet,X6["aria-hidden"]=new WeakSet,Z1=new WeakMap)}}function gY(e,t={}){const{ariaHidden:n=!1,inert:i=!1,mark:r=!0}=t,s=lr(e[0]).body;return Eet(e,s,n,i,{mark:r})}function jTe(){const e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}class Cet{constructor(){rn(this,"nodesRef",{current:[]});rn(this,"events",jTe())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(i=>i===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const NTe=p.createContext(null),RTe=p.createContext(null),GI=()=>{var e;return((e=p.useContext(NTe))==null?void 0:e.id)||null},Uw=e=>{const t=p.useContext(RTe);return e??t};function Tet(e){const t=gC(),n=Uw(e),i=GI();return Un(()=>{if(!t)return;const r={id:t,parentId:i};return n==null||n.addNode(r),()=>{n==null||n.removeNode(r)}},[n,t,i]),t}function Aet(e){const{children:t,id:n}=e,i=GI();return a.jsx(NTe.Provider,{value:p.useMemo(()=>({id:n,parentId:i}),[n,i]),children:t})}function _et(e){const{children:t,externalTree:n}=e,i=Ku(()=>n??new Cet).current;return a.jsx(RTe.Provider,{value:i,children:t})}function jet(e,t){const n=Fs(Yo(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const bY=20;let Sm=[];function zU(){Sm=Sm.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function yY(e){zU(),e&&$a(e)!=="body"&&(Sm.push(new WeakRef(e)),Sm.length>bY&&(Sm=Sm.slice(-bY)))}function vY(){var e;return zU(),(e=Sm[Sm.length-1])==null?void 0:e.deref()}function Net(e){return e?DU(e)?e:pC(e)[0]||e:null}function xY(e){var r;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((r=e.getAttribute("role"))!=null&&r.includes("dialog")))return;const n=tTe(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return DU(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),i=e.getAttribute("tabindex");n.length===0?i!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ITe(e){const{context:t,children:n,disabled:i=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:o=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:h,externalTree:m,getInsideElements:g}=e,b="rootStore"in t?t.rootStore:t,v=b.useState("open"),y=b.useState("domReferenceElement"),x=b.useState("floatingElement"),{events:w,dataRef:O}=b.context,S=Wn(()=>{var Y;return(Y=O.current.floatingContext)==null?void 0:Y.nodeId}),k=r===!1,C=eY(y)&&k,E=Ol(r),R=Ol(s),_=Ol(u),j=Ol(v),T=Uw(m),N=ETe(),A=p.useRef(!1),P=p.useRef(!1),D=p.useRef(!1),M=p.useRef(null),L=p.useRef(""),U=p.useRef(""),I=p.useRef(null),H=p.useRef(null),K=Wx(I,h,N==null?void 0:N.beforeInsideRef),F=Wx(H,N==null?void 0:N.afterInsideRef),W=fy(),V=fy(),X=jU(),ie=N!=null,Q=tY(x),Z=Wn((Y=Q)=>Y?pC(Y):[]),ce=Wn(()=>(g==null?void 0:g().filter(Y=>Y!=null))??[]);p.useEffect(()=>{if(i||!l)return;function Y(te){te.key==="Tab"&&zn(Q,Gl(lr(Q)))&&Z().length===0&&!C&&rJe(te)}const G=lr(Q);return mi(G,"keydown",Y)},[i,Q,l,C,Z]),p.useEffect(()=>{if(i||!v)return;const Y=lr(Q);function G(){D.current=!1}function te(Ne){const pe=Yo(Ne),me=ce(),se=zn(x,pe)||zn(y,pe)||zn(N==null?void 0:N.portalNode,pe)||me.some(Se=>Se===pe||zn(Se,pe));D.current=!se,U.current=Ne.pointerType||"keyboard",pe!=null&&pe.closest(`[${mTe}]`)&&(P.current=!0,V.start(0,()=>{P.current=!1}))}function ye(){U.current="keyboard"}return _f(mi(Y,"pointerdown",te,!0),mi(Y,"pointerup",G,!0),mi(Y,"pointercancel",G,!0),mi(Y,"keydown",ye,!0),G)},[i,x,y,Q,v,N,V,ce]),p.useEffect(()=>{if(i||!c)return;const Y=lr(Q);function G(){P.current=!0,V.start(0,()=>{P.current=!1})}function te(me){const se=Yo(me);DU(se)&&(M.current=se)}function ye(me){const se=me.relatedTarget,Se=me.currentTarget,Le=Yo(me);l&&se==null&&Le!=null&&zn(x,Le)&&yY(Le),queueMicrotask(()=>{const be=S(),Ve=b.context.triggerElements,ve=ce(),Re=(se==null?void 0:se.hasAttribute(mN("focus-guard")))&&[I.current,H.current,N==null?void 0:N.beforeInsideRef.current,N==null?void 0:N.afterInsideRef.current,N==null?void 0:N.beforeOutsideRef.current,N==null?void 0:N.afterOutsideRef.current,mh(f),mh(d)].includes(se),ne=!(zn(y,se)||zn(x,se)||zn(se,x)||zn(N==null?void 0:N.portalNode,se)||ve.some(ge=>ge===se||zn(ge,se))||Ve.hasMatchingElement(ge=>zn(ge,se))||Re||T&&(ng(T.nodesRef.current,be).find(ge=>{var Ce,ke;return zn((Ce=ge.context)==null?void 0:Ce.elements.floating,se)||zn((ke=ge.context)==null?void 0:ke.elements.domReference,se)})||nY(T.nodesRef.current,be).find(ge=>{var Ce,ke,Ke;return[(Ce=ge.context)==null?void 0:Ce.elements.floating,tY((ke=ge.context)==null?void 0:ke.elements.floating)].includes(se)||((Ke=ge.context)==null?void 0:Ke.elements.domReference)===se})));if(Se===y&&Q&&xY(Q),o&&Se!==y&&!KCe(Le)&&Gl(Y)===Y.body){if(Ls(Q)&&(Q.focus(),o==="popup")){X.request(()=>{Q.focus()});return}const ge=Z(),Ce=M.current,ke=(Ce&&ge.includes(Ce)?Ce:null)||ge[ge.length-1]||Q;Ls(ke)&&ke.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(C||!l)&&se&&ne&&!P.current&&(C||se!==vY())&&(A.current=!0,b.setOpen(!1,Gs(LS,me)))})}function Ne(){D.current||(O.current.insideReactTree=!0,W.start(0,()=>{O.current.insideReactTree=!1}))}const pe=Ls(y)?y:null;if(!(!x&&!pe))return _f(pe&&mi(pe,"focusout",ye),pe&&mi(pe,"pointerdown",G),x&&mi(x,"focusin",te),x&&mi(x,"focusout",ye),x&&N&&mi(x,"focusout",Ne,!0))},[i,y,x,Q,l,T,N,b,c,o,Z,C,S,O,W,V,X,d,f,ce]),p.useEffect(()=>{var Se,Le,be;if(i||!x||!v)return;const Y=Array.from(((Se=N==null?void 0:N.portalNode)==null?void 0:Se.querySelectorAll(`[${mN("portal")}]`))||[]),te=(be=(Le=(T?nY(T.nodesRef.current,S()):[]).find(Ve=>{var ve;return eY(((ve=Ve.context)==null?void 0:ve.elements.domReference)||null)}))==null?void 0:Le.context)==null?void 0:be.elements.domReference,Ne=[...[x,...Y,I.current,H.current,N==null?void 0:N.beforeOutsideRef.current,N==null?void 0:N.afterOutsideRef.current,...ce()],te,mh(f),mh(d),C?y:null].filter(Ve=>Ve!=null),pe=gY(Ne,{ariaHidden:l||C,mark:!1}),me=[x,...Y].filter(Ve=>Ve!=null),se=gY(me);return()=>{se(),pe()}},[v,i,y,x,l,N,C,T,S,d,f,ce]),Un(()=>{if(!v||i||!Ls(Q))return;L.current="",U.current="";const Y=lr(Q),G=Gl(Y);queueMicrotask(()=>{const te=E.current,ye=typeof te=="function"?te(_.current||""):te;if(ye===void 0||ye===!1||zn(Q,G))return;let pe=null;const me=()=>(pe==null&&(pe=Z(Q)),pe[0]||Q);let se;ye===!0||ye===null?se=me():se=mh(ye),se=se||me();const Se=zn(Q,Gl(Y));BL(se,{preventScroll:se===Q,shouldFocus(){if(!j.current)return!1;if(Se)return!0;const Le=Gl(Y);return!(Le!==se&&zn(Q,Le))}})})},[i,v,Q,Z,E,_,j]),Un(()=>{if(i||!Q)return;const Y=lr(Q),G=Gl(Y),te=_.current==null;yY(G);function ye(pe){if(pe.open||(L.current=jet(pe.nativeEvent,U.current)),pe.reason===Bc&&pe.nativeEvent.type==="mouseleave"&&(A.current=!0),pe.reason===xTe)if(pe.nested)A.current=!1;else if(oJe(pe.nativeEvent)||WCe(pe.nativeEvent))A.current=!1;else{let me=!1;lr(Q).createElement("div").focus({get preventScroll(){return me=!0,!1}}),me?A.current=!1:A.current=!0}}w.on("openchange",ye);function Ne(pe){const me=R.current;let se=typeof me=="function"?me(pe):me;if(se===void 0||se===!1)return null;se===null&&(se=!0);const Se=y!=null&&y.isConnected?y:null,Le=G!=null&&G.isConnected&&$a(G)!=="body"?G:null;let be=te?Le||Se:Se||Le;return be||(be=vY()||null),typeof se=="boolean"?be:mh(se)||be||null}return()=>{w.off("openchange",ye);const pe=Gl(Y),me=ce(),se=zn(x,pe)||me.some(Ve=>Ve===pe||zn(Ve,pe))||T&&ng(T.nodesRef.current,S(),!1).some(Ve=>{var ve;return zn((ve=Ve.context)==null?void 0:ve.elements.floating,pe)}),Se=R.current,Le=L.current,be=Ne(Le);queueMicrotask(()=>{const Ve=Net(be),ve=typeof Se!="boolean";if(Se&&!A.current&&Ls(Ve)&&(!(!ve&&Ve!==pe&&pe!==Y.body)||se)){const Re={preventScroll:!0};Le==="keyboard"&&(Re.focusVisible=!0),Ve.focus(Re)}A.current=!1})}},[i,x,Q,R,_,w,T,y,S,ce]),Un(()=>{if(!Bw||v||!x)return;const Y=Gl(lr(x));!Ls(Y)||!NU(Y)||zn(x,Y)&&Y.blur()},[v,x]),Un(()=>{if(!(i||!N))return N.setFocusManagerState({modal:l,closeOnFocusOut:c,open:v,onOpenChange:b.setOpen,domReference:y}),()=>{N.setFocusManagerState(null)}},[i,N,l,v,b,c,y]),Un(()=>{if(!(i||!Q))return xY(Q),()=>{queueMicrotask(zU)}},[i,Q]);const Ee=!i&&(l?!C:!0)&&(ie||l);return a.jsxs(p.Fragment,{children:[Ee&&a.jsx(hy,{"data-type":"inside",ref:K,onFocus:Y=>{var G;if(l){const te=Z();BL(te[te.length-1])}else if(N!=null&&N.portalNode)if(A.current=!1,ex(Y,N.portalNode)){const te=MU(y);te==null||te.focus()}else(G=mh(f??N.beforeOutsideRef))==null||G.focus()}}),n,Ee&&a.jsx(hy,{"data-type":"inside",ref:F,onFocus:Y=>{var G;if(l)BL(Z()[0]);else if(N!=null&&N.portalNode)if(c&&(A.current=!0),ex(Y,N.portalNode)){const te=iTe(y);te==null||te.focus()}else(G=mh(d??N.afterOutsideRef))==null||G.focus()}})]})}function Ret(e,t={}){const{enabled:n=!0,event:i="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:o=!0,touchOpenDelay:l=0,reason:c=Kx}=t,u="rootStore"in e?e.rootStore:e,d=u.context.dataRef,f=p.useRef(void 0),h=jU(),m=fy(),g=p.useMemo(()=>{function b(y,x,w,O){const S=Gs(c,x,w);y&&O==="touch"&&l>0?m.start(l,()=>{u.setOpen(!0,S)}):u.setOpen(y,S)}function v(y,x,w){const O=d.current.openEvent,S=u.select("domReferenceElement")!==x;return y&&S||!y||!r?!0:O&&o?!w(O.type):!1}return{onPointerDown(y){f.current=Jv(y.pointerType,!0)&&WCe(y.nativeEvent)?"virtual":y.pointerType},onMouseDown(y){const x=f.current,w=y.nativeEvent,O=u.select("open");if(y.button!==0||i==="click"||Jv(x,!0)&&s)return;const S=v(O,y.currentTarget,E=>E==="click"||E==="mousedown"),k=Yo(w);if(NU(k)){b(S,w,k,x);return}const C=y.currentTarget;h.request(()=>{b(S,w,C,x)})},onClick(y){if(i==="mousedown-only")return;const x=f.current;if(i==="mousedown"&&x){f.current=void 0;return}if(Jv(x,!0)&&s)return;const w=u.select("open"),O=v(w,y.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");b(O,y.nativeEvent,y.currentTarget,x)},onKeyDown(){f.current=void 0}}},[d,i,s,c,u,o,r,h,m,l]);return p.useMemo(()=>n?{reference:g}:Cl,[n,g])}function Iet(){return!1}function Pet(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function PTe(e,t={}){const{enabled:n=!0,escapeKey:i=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:o=Iet,bubbles:l,externalTree:c}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),f=u.useState("floatingElement"),{dataRef:h}=u.context,m=Uw(c),g=Wn(typeof r=="function"?r:()=>!1),b=typeof r=="function"?g:r,v=b!==!1,y=Wn(()=>s),{escapeKey:x,outsidePress:w}=Pet(l),O=p.useRef(!1),S=p.useRef(!1),k=p.useRef(!1),C=p.useRef(!1),E=p.useRef(""),R=p.useRef(null),_=fy(),j=fy(),T=Wn(()=>{j.clear(),h.current.insideReactTree=!1}),N=Wn(K=>{var V;const F=(V=h.current.floatingContext)==null?void 0:V.nodeId;return(m?ng(m.nodesRef.current,F):[]).some(X=>{var ie;return((ie=X.context)==null?void 0:ie.open)&&!X.context.dataRef.current[K]})}),A=Wn(K=>IL(K,u.select("floatingElement"))||IL(K,u.select("domReferenceElement"))),P=Wn(K=>{o()&&u.setOpen(!1,Gs(Kx,K.nativeEvent))}),D=Wn(K=>{if(!d||!n||!i||K.key!=="Escape"||C.current||!x&&N("__escapeKeyBubbles"))return;const F=sJe(K)?K.nativeEvent:K,W=Gs(OTe,F);u.setOpen(!1,W),W.isCanceled||K.preventDefault(),!x&&!W.isPropagationAllowed&&K.stopPropagation()}),M=Wn(()=>{h.current.insideReactTree=!0,j.start(0,T)}),L=Wn(K=>{if(!d||!n||K.button!==0)return;const F=Yo(K.nativeEvent);zn(u.select("floatingElement"),F)&&(O.current||(O.current=!0,S.current=!1))}),U=Wn(K=>{!d||!n||(K.defaultPrevented||K.nativeEvent.defaultPrevented)&&O.current&&(S.current=!0)});p.useEffect(()=>{if(!d||!n)return T;h.current.__escapeKeyBubbles=x,h.current.__outsidePressBubbles=w;const K=new lu,F=new lu;function W(){K.clear(),C.current=!0}function V(){K.start(Bw?5:0,()=>{C.current=!1})}function X(){k.current=!0,F.start(0,()=>{k.current=!1})}function ie(){O.current=!1,S.current=!1}function Q(){const ve=E.current,Re=ve==="pen"||!ve?"mouse":ve,ne=y(),ge=typeof ne=="function"?ne():ne;return typeof ge=="string"?ge:ge[Re]}function Z(ve){const Re=Q();return Re==="intentional"&&ve.type!=="click"||Re==="sloppy"&&ve.type==="click"}function ce(ve){var ge;const Re=(ge=h.current.floatingContext)==null?void 0:ge.nodeId,ne=m&&ng(m.nodesRef.current,Re).some(Ce=>{var ke;return IL(ve,(ke=Ce.context)==null?void 0:ke.elements.floating)});return A(ve)||ne}function Ee(ve){if(Z(ve)){ve.type!=="click"&&!A(ve)&&(F.clear(),k.current=!1),T();return}if(h.current.insideReactTree){T();return}const Re=Yo(ve),ne=`[${mN("inert")}]`,ge=ur(Re)?Re.getRootNode():null,Ce=Array.from((qx(ge)?ge:lr(u.select("floatingElement"))).querySelectorAll(ne)),ke=u.context.triggerElements;if(Re&&(ke.hasElement(Re)||ke.hasMatchingElement(it=>zn(it,Re))))return;let Ke=ur(Re)?Re:null;for(;Ke&&!Bm(Ke);){const it=tg(Ke);if(Bm(it)||!ur(it))break;Ke=it}if(!(Ce.length&&ur(Re)&&!nJe(Re)&&!zn(Re,u.select("floatingElement"))&&Ce.every(it=>!zn(Ke,it)))){if(Ls(Re)&&!("touches"in ve)){const it=Bm(Re),ue=au(Re),xe=/auto|scroll/,Te=it||xe.test(ue.overflowX),qe=it||xe.test(ue.overflowY),De=Te&&Re.clientWidth>0&&Re.scrollWidth>Re.clientWidth,At=qe&&Re.clientHeight>0&&Re.scrollHeight>Re.clientHeight,It=ue.direction==="rtl",lt=At&&(It?ve.offsetX<=Re.offsetWidth-Re.clientWidth:ve.offsetX>Re.clientWidth),Ot=De&&ve.offsetY>Re.clientHeight;if(lt||Ot)return}if(!ce(ve)){if(Q()==="intentional"&&k.current){F.clear(),k.current=!1;return}typeof b=="function"&&!b(ve)||N("__outsidePressBubbles")||(u.setOpen(!1,Gs(xTe,ve)),T())}}}function Y(ve){Q()!=="sloppy"||ve.pointerType==="touch"||!u.select("open")||!n||A(ve)||Ee(ve)}function G(ve){if(Q()!=="sloppy"||!u.select("open")||!n||A(ve))return;const Re=ve.touches[0];Re&&(R.current={startTime:Date.now(),startX:Re.clientX,startY:Re.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},_.start(1e3,()=>{R.current&&(R.current.dismissOnTouchEnd=!1,R.current.dismissOnMouseDown=!1)}))}function te(ve,Re){const ne=Yo(ve);if(!ne)return;const ge=mi(ne,ve.type,()=>{Re(ve),ge()})}function ye(ve){E.current="touch",te(ve,G)}function Ne(ve){_.clear(),ve.type==="pointerdown"&&(E.current=ve.pointerType),!(ve.type==="mousedown"&&R.current&&!R.current.dismissOnMouseDown)&&te(ve,Re=>{Re.type==="pointerdown"?Y(Re):Ee(Re)})}function pe(ve){if(!O.current)return;const Re=S.current;if(ie(),Q()==="intentional"){if(ve.type==="pointercancel"){Re&&X();return}if(!ce(ve)){if(Re){X();return}typeof b=="function"&&!b(ve)||(F.clear(),k.current=!0,T())}}}function me(ve){if(Q()!=="sloppy"||!R.current||A(ve))return;const Re=ve.touches[0];if(!Re)return;const ne=Math.abs(Re.clientX-R.current.startX),ge=Math.abs(Re.clientY-R.current.startY),Ce=Math.sqrt(ne*ne+ge*ge);Ce>5&&(R.current.dismissOnTouchEnd=!0),Ce>10&&(Ee(ve),_.clear(),R.current=null)}function se(ve){te(ve,me)}function Se(ve){Q()!=="sloppy"||!R.current||A(ve)||(R.current.dismissOnTouchEnd&&Ee(ve),_.clear(),R.current=null)}function Le(ve){te(ve,Se)}const be=lr(f),Ve=_f(i&&_f(mi(be,"keydown",D),mi(be,"compositionstart",W),mi(be,"compositionend",V)),v&&_f(mi(be,"click",Ne,!0),mi(be,"pointerdown",Ne,!0),mi(be,"pointerup",pe,!0),mi(be,"pointercancel",pe,!0),mi(be,"mousedown",Ne,!0),mi(be,"mouseup",pe,!0),mi(be,"touchstart",ye,!0),mi(be,"touchmove",se,!0),mi(be,"touchend",Le,!0)));return()=>{Ve(),K.clear(),F.clear(),ie(),k.current=!1,T()}},[h,f,i,v,b,d,n,x,w,D,T,y,N,A,m,u,_]);const I=p.useMemo(()=>({onKeyDown:D,onPointerDown:P,onClick:P}),[D,P]),H=p.useMemo(()=>({onKeyDown:D,onPointerDown:U,onMouseDown:U,onClickCapture:M,onMouseDownCapture(K){M(),L(K)},onPointerDownCapture(K){M(),L(K)},onMouseUpCapture:M,onTouchEndCapture:M,onTouchMoveCapture:M}),[D,M,L,U]);return p.useMemo(()=>n?{reference:I,floating:H,trigger:I}:{},[n,I,H])}function wY(e,t,n){let{reference:i,floating:r}=e;const s=Iu(t),o=WI(t),l=qI(o),c=Qu(t),u=s==="y",d=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,h=i[l]/2-r[l]/2;let m;switch(c){case"top":m={x:d,y:i.y-r.height};break;case"bottom":m={x:d,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:f};break;case"left":m={x:i.x-r.width,y:f};break;default:m={x:i.x,y:i.y}}const g=Ep(t);return g&&(m[o]+=h*(g==="end"?1:-1)*(n&&u?-1:1)),m}async function Det(e,t){var n;t===void 0&&(t={});const{x:i,y:r,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Pf(t,e),g=PU(m),v=l[h?f==="floating"?"reference":"floating":f],y=dN(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=f==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),O=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},S=dN(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(y.top-S.top+g.top)/O.y,bottom:(S.bottom-y.bottom+g.bottom)/O.y,left:(y.left-S.left+g.left)/O.x,right:(S.right-y.right+g.right)/O.x}}const Met=50,Let=async(e,t,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Det},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=wY(u,i,c),h=i,m=0;const g={};for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:r,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Pf(e,t)||{};if(u==null)return{};const f=PU(d),h={x:n,y:i},m=WI(r),g=qI(m),b=await o.getDimensions(u),v=m==="y",y=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",O=s.reference[g]+s.reference[m]-h[m]-s.floating[g],S=h[m]-s.reference[m],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=k?k[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(k)))&&(C=l.floating[w]||s.floating[g]);const E=O/2-S/2,R=C/2-b[g]/2-1,_=ig(f[y],R),j=ig(f[x],R),T=C-b[g]-j,N=C/2-b[g]/2+E,A=RU(_,N,T),P=!c.arrow&&Ep(r)!=null&&N!==A&&s.reference[g]/2-(N<_?_:j)-b[g]/2<0,D=P?N<_?N-_:N-T:0;return{[m]:h[m]+D,data:{[m]:A,centerOffset:N-A-D,...P&&{alignmentOffset:D}},reset:P}}}),Fet=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Pf(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Qu(r),x=Iu(l),w=Qu(l)===l,O=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(w||!b?[uN(l)]:dJe(l)),k=g!=="none";!h&&k&&S.push(...mJe(l,b,g,O));const C=[l,...S],E=await c.detectOverflow(t,v),R=[];let _=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&R.push(E[y]),f){const A=uJe(r,o,O);R.push(E[A[0]],E[A[1]])}if(_=[..._,{placement:r,overflows:R}],!R.every(A=>A<=0)){var j,T;const A=(((j=s.flip)==null?void 0:j.index)||0)+1,P=C[A];if(P&&(!(f==="alignment"?x!==Iu(P):!1)||_.every(L=>Iu(L.placement)===x?L.overflows[0]>0:!0)))return{data:{index:A,overflows:_},reset:{placement:P}};let D=(T=_.filter(M=>M.overflows[0]<=0).sort((M,L)=>M.overflows[1]-L.overflows[1])[0])==null?void 0:T.placement;if(!D)switch(m){case"bestFit":{var N;const M=(N=_.filter(L=>{if(k){const U=Iu(L.placement);return U===x||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,I)=>U+I,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:N[0];M&&(D=M);break}case"initialPlacement":D=l;break}if(r!==D)return{reset:{placement:D}}}return{}}}};function OY(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kY(e){return lJe.some(t=>e[t]>=0)}const Bet=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:i}=t,{strategy:r="referenceHidden",...s}=Pf(e,t);switch(r){case"referenceHidden":{const o=await i.detectOverflow(t,{...s,elementContext:"reference"}),l=OY(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:kY(l)}}}case"escaped":{const o=await i.detectOverflow(t,{...s,altBoundary:!0}),l=OY(o,n.floating);return{data:{escapedOffsets:l,escaped:kY(l)}}}default:return{}}}}},DTe=new Set(["left","top"]);async function Uet(e,t){const{placement:n,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Qu(n),l=Ep(n),c=Iu(n)==="y",u=DTe.has(o)?-1:1,d=s&&c?-1:1,f=Pf(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Qet=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:r,y:s,placement:o,middlewareData:l}=t,c=await Uet(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:o}}}}},zet=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:r,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:w,y:O}=x;return{x:w,y:O}}},...u}=Pf(e,t),d={x:n,y:i},f=await s.detectOverflow(t,u),h=Iu(r),m=IU(h);let g=d[m],b=d[h];const v=(x,w)=>RU(w+f[x==="y"?"top":"left"],w,w-f[x==="y"?"bottom":"right"]);o&&(g=v(m,g)),l&&(b=v(h,b));const y=c.fn({...t,[m]:g,[h]:b});return{...y,data:{x:y.x-n,y:y.y-i,enabled:{[m]:o,[h]:l}}}}}},Vet=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,i;const{x:r,y:s,placement:o,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Pf(e,t),h={x:r,y:s},m=Iu(o),g=IU(m);let b=h[g],v=h[m];const y=Pf(u,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(i=y.crossAxis)!=null?i:0};if(d){const S=g==="y"?"height":"width",k=l.reference[g]-l.floating[S]+x.mainAxis,C=l.reference[g]+l.reference[S]-x.mainAxis;bC&&(b=C)}if(f){var w,O;const S=g==="y"?"width":"height",k=DTe.has(Qu(o)),C=l.reference[m]-l.floating[S]+(k&&((w=c.offset)==null?void 0:w[m])||0)+(k?0:x.crossAxis),E=l.reference[m]+l.reference[S]+(k?0:((O=c.offset)==null?void 0:O[m])||0)-(k?x.crossAxis:0);vE&&(v=E)}return{[g]:b,[m]:v}}}},Het=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:i,platform:r,elements:s}=t,{apply:o=()=>{},...l}=Pf(e,t),c=await r.detectOverflow(t,l),u=Qu(n),d=Ep(n),f=Iu(n)==="y",{width:h,height:m}=i.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const v=m-c.top-c.bottom,y=h-c.left-c.right,x=ig(m-c[g],v),w=ig(h-c[b],y),O=t.middlewareData.shift,S=!O;let k=x,C=w;O!=null&&O.enabled.x&&(C=y),O!=null&&O.enabled.y&&(k=v),S&&!d&&(f?C=h-2*qh(c.left,c.right):k=m-2*qh(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:k});const E=await r.getDimensions(s.floating);return h!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function MTe(e){const t=au(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=Ls(e),s=r?e.offsetWidth:n,o=r?e.offsetHeight:i,l=cN(n)!==s||cN(i)!==o;return l&&(n=s,i=o),{width:n,height:i,$:l}}function VU(e){return ur(e)?e:e.contextElement}function tx(e){const t=VU(e);if(!Ls(t))return Wh(1);const n=t.getBoundingClientRect(),{width:i,height:r,$:s}=MTe(t);let o=(s?cN(n.width):n.width)/i,l=(s?cN(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const qet=Wh(0);function LTe(e){const t=Fs(e);return!_U()||!t.visualViewport?qet:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wet(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Fs(e)}function py(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=VU(e);let o=Wh(1);t&&(i?ur(i)&&(o=tx(i)):o=tx(e));const l=Wet(s,n,i)?LTe(s):Wh(0);let c=(r.left+l.x)/o.x,u=(r.top+l.y)/o.y,d=r.width/o.x,f=r.height/o.y;if(s&&i){const h=Fs(s),m=ur(i)?Fs(i):i;let g=h,b=Q6(g);for(;b&&m!==g;){const v=tx(b),y=b.getBoundingClientRect(),x=au(b),w=y.left+(b.clientLeft+parseFloat(x.paddingLeft))*v.x,O=y.top+(b.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=w,u+=O,g=Fs(b),b=Q6(g)}}return dN({width:d,height:f,x:c,y:u})}function XI(e,t){const n=zI(e).scrollLeft;return t?t.left+n:py(Sp(e)).left+n}function $Te(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-XI(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function Ket(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e;const s=r==="fixed",o=Sp(i),l=t?QI(t.floating):!1;if(i===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Wh(1);const d=Wh(0),f=Ls(i);if((f||!s)&&(($a(i)!=="body"||hC(o))&&(c=zI(i)),f)){const m=py(i);u=tx(i),d.x=m.x+i.clientLeft,d.y=m.y+i.clientTop}const h=o&&!f&&!s?$Te(o,c):Wh(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function Get(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Xet(e){const t=zI(e),n=e.ownerDocument.body,i=qh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=qh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+XI(e);const o=-t.scrollTop;return au(n).direction==="rtl"&&(s+=qh(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:o}}const Yet=25;function Zet(e,t,n){n===void 0&&(n="viewport");const i=n==="layoutViewport",r=Fs(e),s=Sp(e),o=r.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(o){const h=!_U()||t==="fixed";i?h||(u=-o.offsetLeft,d=-o.offsetTop):(l=o.width,c=o.height,h&&(u=o.offsetLeft,d=o.offsetTop))}if(XI(s)<=0){const h=s.ownerDocument,m=h.body,g=getComputedStyle(m),b=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(s.clientWidth-m.clientWidth-b),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?v/2:v;y<=Yet&&(l-=y)}return{width:l,height:c,x:u,y:d}}function Jet(e,t){const n=py(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=tx(e),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=r*s.x,u=i*s.y;return{width:o,height:l,x:c,y:u}}function SY(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=Zet(e,n,t);else if(t==="document")i=Xet(Sp(e));else if(ur(t))i=Jet(t,n);else{const r=LTe(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return dN(i)}function ett(e,t){const n=t.get(e);if(n)return n;let i=DS(e,[],!1).filter(l=>ur(l)&&$a(l)!=="body"),r=null;const s=au(e).position==="fixed";let o=s?tg(e):e;for(;ur(o)&&!Bm(o);){const l=au(o),c=AU(o),u=r?r.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?i=i.filter(f=>f!==o):r=l,o=tg(o)}return t.set(e,i),i}function ttt(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e;const o=[...n==="clippingAncestors"?QI(t)?[]:ett(t,this._c):[].concat(n),i],l=SY(t,o[0],r);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h{l(!1,1e-7)},1e3)}C=!1}try{i=new IntersectionObserver(E,{...k,root:s.ownerDocument})}catch{i=new IntersectionObserver(E,k)}i.observe(e)}const c=Fs(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),o()}}function Y6(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,u=VU(e),d=r||s?[...u?DS(u):[],...t?DS(t):[]]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const f=u&&l?att(u,n,s):null;let h=-1,m=null;o&&(m=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,b=c?py(e):null;c&&v();function v(){const y=py(e);b&&!BTe(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(x=>{r&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const ltt=Qet,ctt=zet,utt=Fet,dtt=Het,ftt=Bet,CY=$et,htt=Vet,ptt=(e,t,n)=>{const i=new Map,r=n??{},s={...ott,...r.platform,_c:i};return Let(e,t,{...r,platform:s})};var mtt=typeof document<"u",gtt=function(){},__=mtt?p.useLayoutEffect:gtt;function gN(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!gN(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!gN(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UTe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function TY(e,t){const n=UTe(e);return Math.round(t*n)/n}function VL(e){const t=p.useRef(e);return __(()=>{t.current=e}),t}function QTe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(i);gN(h,i)||m(i);const[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useCallback(L=>{L!==k.current&&(k.current=L,b(L))},[]),w=p.useCallback(L=>{L!==C.current&&(C.current=L,y(L))},[]),O=s||g,S=o||v,k=p.useRef(null),C=p.useRef(null),E=p.useRef(d),R=c!=null,_=VL(c),j=VL(r),T=VL(u),N=p.useCallback(()=>{if(!k.current||!C.current)return;const L={placement:t,strategy:n,middleware:h};j.current&&(L.platform=j.current),ptt(k.current,C.current,L).then(U=>{const I={...U,isPositioned:T.current!==!1};A.current&&!gN(E.current,I)&&(E.current=I,ri.flushSync(()=>{f(I)}))})},[h,t,n,j,T]);__(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[u]);const A=p.useRef(!1);__(()=>(A.current=!0,()=>{A.current=!1}),[]),__(()=>{if(O&&(k.current=O),S&&(C.current=S),O&&S){if(_.current)return _.current(O,S,N);N()}},[O,S,N,_,R]);const P=p.useMemo(()=>({reference:k,floating:C,setReference:x,setFloating:w}),[x,w]),D=p.useMemo(()=>({reference:O,floating:S}),[O,S]),M=p.useMemo(()=>{const L={position:n,left:0,top:0};if(!D.floating)return L;const U=TY(D.floating,d.x),I=TY(D.floating,d.y);return l?{...L,transform:"translate("+U+"px, "+I+"px)",...UTe(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:I}},[n,l,D.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:N,refs:P,elements:D,floatingStyles:M}),[d,N,P,D,M])}const btt=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&t(i)?i.current!=null?CY({element:i.current,padding:r}).fn(n):{}:i?CY({element:i,padding:r}).fn(n):{}}}},zTe=(e,t)=>{const n=ltt(e);return{name:n.name,fn:n.fn,options:[e,t]}},VTe=(e,t)=>{const n=ctt(e);return{name:n.name,fn:n.fn,options:[e,t]}},HTe=(e,t)=>({fn:htt(e).fn,options:[e,t]}),qTe=(e,t)=>{const n=utt(e);return{name:n.name,fn:n.fn,options:[e,t]}},WTe=(e,t)=>{const n=dtt(e);return{name:n.name,fn:n.fn,options:[e,t]}},ytt=(e,t)=>{const n=ftt(e);return{name:n.name,fn:n.fn,options:[e,t]}},vtt=(e,t)=>{const n=btt(e);return{name:n.name,fn:n.fn,options:[e,t]}},xtt={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class HU extends BI{constructor(n){const{syncOnly:i,nested:r,onOpenChange:s,triggerElements:o,...l}=n;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:jTe(),nested:r,triggerElements:o},xtt);rn(this,"syncOpenEvent",(n,i)=>{(!n||!this.state.open||i!=null&&aJe(i))&&(this.context.dataRef.current.openEvent=n?i:void 0)});rn(this,"dispatchOpenChange",(n,i)=>{this.syncOpenEvent(n,i.event);const r={open:n,reason:i.reason,nativeEvent:i.event,nested:this.context.nested,triggerElement:i.trigger};this.context.events.emit("openchange",r)});rn(this,"setOpen",(n,i)=>{var r,s,o,l;if(this.syncOnly){(s=(r=this.context).onOpenChange)==null||s.call(r,n,i);return}this.dispatchOpenChange(n,i),(l=(o=this.context).onOpenChange)==null||l.call(o,n,i)});this.syncOnly=i}}function wtt(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:i,floatingId:r,nested:s,onOpenChange:o}=e,l=t.useState("open"),c=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),d=t.context.triggerElements,f=o,h=p.useRef(null);i===void 0&&h.current===null&&(h.current=new HU({open:l,transitionStatus:void 0,referenceElement:c,floatingElement:u,triggerElements:d,onOpenChange:f,floatingId:r,syncOnly:!0,nested:s}));const m=i??h.current;return t.useSyncedValue("floatingId",r),Un(()=>{const g={open:l,floatingId:r,referenceElement:c,floatingElement:u};ur(c)&&(g.domReferenceElement=c),m.state.positionReference===m.state.referenceElement&&(g.positionReference=c),m.update(g)},[l,r,c,u,m]),m.context.onOpenChange=f,m.context.nested=s,m}function KTe(e,t=!1,n=!1){const[i,r]=p.useState(e&&t?"idle":void 0),[s,o]=p.useState(e);return e&&!s&&(o(!0),r("starting")),!e&&s&&i!=="ending"&&!n&&r("ending"),!e&&!s&&i==="ending"&&r(void 0),Un(()=>{if(!e&&s&&i!=="ending"&&n){const l=Yl.request(()=>{r("ending")});return()=>{Yl.cancel(l)}}},[e,s,i,n]),Un(()=>{if(!e||t)return;const l=Yl.request(()=>{r(void 0)});return()=>{Yl.cancel(l)}},[t,e]),Un(()=>{if(!e||!t)return;e&&s&&i!=="idle"&&r("starting");const l=Yl.request(()=>{r("idle")});return()=>{Yl.cancel(l)}},[t,e,s,i]),{mounted:s,setMounted:o,transitionStatus:i}}const GTe={tabIndex:-1,[V6]:""};function XTe(e){return t=>t==="touch"?e.current:!0}function YTe(e,t=!1){const n=gC(),i=GI()!=null,r=Ku(()=>e(n,i)).current;return wtt({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:i,onOpenChange:r.setOpen}),r}function ZTe({handle:e,store:t}){return Un(()=>e.attachStore(t),[e,t]),null}function Ott(e,t){const n=p.useRef(null),i=p.useRef(null);return p.useCallback(r=>{if(e===void 0)return;let s=!1;if(n.current!==null){const o=n.current,l=i.current,c=t.context.triggerElements.getById(o);l&&c===l&&(t.context.triggerElements.delete(o),s=!0),n.current=null,i.current=null}if(r!==null&&(n.current=e,i.current=r,t.context.triggerElements.add(e,r),s=!0),s){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function JTe(e,t,n,i=!1){t?e.preventUnmountingOnClose=!1:i&&(e.preventUnmountingOnClose=!0);const r=(n==null?void 0:n.id)??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function ktt(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Stt(e,t,n,i){const r=n.useState("isMountedByTrigger",e),s=Ott(e,n),o=Wn(c=>{const u=n.select("open"),d=n.select("activeTriggerId");if(d===e){n.update({activeTriggerElement:c,...u?i:null});return}d==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:c,...i})}),l=p.useCallback(c=>{s(c),c&&o(c)},[s,o]);return Un(()=>{r&&n.update({activeTriggerElement:t.current,...i})},[r,n,t,...Object.values(i)]),{registerTrigger:l,isMountedByThisTrigger:r}}function eAe(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,i=p.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),o=e.useState("activeTriggerId"),l=e.useState("activeTriggerElement");Un(()=>{if(!r){i.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const d=e.select("activeTriggerId");let f=null;if(d){const h=e.context.triggerElements.getById(d);if(h)i.current=d,h!==e.state.activeTriggerElement&&(u.activeTriggerElement=h);else{for(const[m,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){u.activeTriggerId=m,u.activeTriggerElement=g,i.current=m;break}u.activeTriggerId===void 0&&(i.current===d?f=d:i.current=null)}}else i.current=null;if(!f&&!d&&c===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[m,g]=h.value;u.activeTriggerId=m,u.activeTriggerElement=g,i.current=m}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){const h=Gs(vTe);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,o,l,n])}function tAe(e,t,n){const{mounted:i,setMounted:r,transitionStatus:s}=KTe(e),o=t.useState("preventUnmountingOnClose"),l=e?!1:o;t.useSyncedValues({mounted:i,transitionStatus:s,preventUnmountingOnClose:l});const c=Wn(()=>{var u,d;r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(d=(u=t.context).onOpenChangeComplete)==null||d.call(u,!1)});return mC({enabled:i&&!e&&!l,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}function nAe(e,t){e.useSyncedValues(t),Un(()=>()=>{e.update({activeTriggerProps:Cl,inactiveTriggerProps:Cl,popupProps:Cl})},[e])}function iAe(e,t){Un(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Un(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class qU{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Ett(){return new HU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new qU,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function rAe(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ett(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Cl,inactiveTriggerProps:Cl,popupProps:Cl}}function sAe(e,t,n=!1){return new HU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const Mk=e=>e.triggerIdProp??e.activeTriggerId,WU=e=>e.openProp??e.open,AY=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function oAe(e,t){return t!==void 0&&WU(e)&&Mk(e)===t}function Ctt(e,t){return oAe(e,t)?!0:t!==void 0&&WU(e)&&Mk(e)==null&&e.triggerCount===1}const aAe={open:WU,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Mk,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:AY,isTriggerActive:(e,t)=>t!==void 0&&Mk(e)===t,isOpenedByTrigger:(e,t)=>oAe(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Mk(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Ctt(e,t)?AY(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Ttt(e){const t=p.useCallback(i=>e===void 0?kU:e.subscribeStore(i),[e]),n=p.useCallback(()=>e===void 0?void 0:e.store,[e]);return JR.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}function Att(e){return _tt(e,e.rootContext)}function _tt(e,t){const{nodeId:n,externalTree:i}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),o=t.useState("domReferenceElement"),l=t.useState("open"),c=t.useState("floatingId"),[u,d]=p.useState(null),[f,h]=p.useState(void 0),[m,g]=p.useState(void 0),b=p.useRef(null),v=Uw(i),y=p.useMemo(()=>({reference:r,floating:s,domReference:o}),[r,s,o]),x=QTe({...e,elements:{...y,...u&&{reference:u}}}),w=ur(f)?f:null,O=m===void 0?t.state.floatingElement:m;t.useSyncedValue("referenceElement",f??null),t.useSyncedValue("domReferenceElement",f===void 0?o:w),t.useSyncedValue("floatingElement",O);const S=p.useCallback(j=>{const T=ur(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(T),x.refs.setReference(T)},[x.refs]),k=p.useCallback(j=>{(ur(j)||j===null)&&(b.current=j,h(j)),(ur(x.refs.reference.current)||x.refs.reference.current===null||j!==null&&!ur(j))&&x.refs.setReference(j)},[x.refs,h]),C=p.useCallback(j=>{g(j),x.refs.setFloating(j)},[x.refs]),E=p.useMemo(()=>({...x.refs,setReference:k,setFloating:C,setPositionReference:S,domReference:b}),[x.refs,k,C,S]),R=p.useMemo(()=>({...x.elements,domReference:o}),[x.elements,o]),_=p.useMemo(()=>({...x,dataRef:t.context.dataRef,open:l,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:E,elements:R,nodeId:n,rootStore:t}),[x,E,R,n,t,l,c]);return Un(()=>{o&&(b.current=o)},[o]),Un(()=>{t.context.dataRef.current.floatingContext=_;const j=v==null?void 0:v.nodesRef.current.find(T=>T.id===n);j&&(j.context=_)}),p.useMemo(()=>({...x,context:_,refs:E,elements:R,rootStore:t}),[x,E,R,_,t])}class KU{constructor(){rn(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});rn(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new lu,this.restTimeout=new lu,this.handleCloseOptions=void 0}static create(){return new KU}}const bN=new WeakMap;function yN(e){var n,i,r;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&bN.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(i=e.pointerEventsReferenceElement)==null||i.style.removeProperty("pointer-events"),(r=e.pointerEventsFloatingElement)==null||r.style.removeProperty("pointer-events"),bN.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function lAe(e,t){const{scopeElement:n,referenceElement:i,floatingElement:r}=t,s=bN.get(n);s&&s!==e&&yN(s),yN(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=i,e.pointerEventsFloatingElement=r,bN.set(n,e),n.style.pointerEvents="none",i.style.pointerEvents="auto",r.style.pointerEvents="auto"}function cAe(e){const t=e.context.dataRef.current,n=Ku(()=>t.hoverInteractionState??KU.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),$I(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function jtt(e,t={}){const{enabled:n=!0,closeDelay:i=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,o=s.useState("open"),l=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:u}=s.context,d=Uw(),f=GI(),h=cAe(s),m=fy(),g=Wn(()=>{var y;return ATe((y=u.current.openEvent)==null?void 0:y.type,h.interactedInside)}),b=Wn(()=>{var y;return Oet((y=u.current.openEvent)==null?void 0:y.type)}),v=Wn(()=>{yN(h)});Un(()=>{o||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,v())},[o,h,v]),p.useEffect(()=>v,[v]),Un(()=>{var y,x,w,O,S;if(n&&o&&(y=h.handleCloseOptions)!=null&&y.blockPointerEvents&&b()&&ur(c)&&l){const k=c,C=l,E=lr(l),R=(w=(x=d==null?void 0:d.nodesRef.current.find(N=>N.id===f))==null?void 0:x.context)==null?void 0:w.elements.floating;R&&(R.style.pointerEvents="");const _=h.pointerEventsScopeElement!==C?h.pointerEventsScopeElement:null,j=R!==C?R:null,T=((S=(O=h.handleCloseOptions)==null?void 0:O.getScope)==null?void 0:S.call(O))??_??j??k.closest("[data-rootownerid]")??E.body;return lAe(h,{scopeElement:T,referenceElement:k,floatingElement:C}),()=>{v()}}},[n,o,c,l,h,b,d,f,v]),p.useEffect(()=>{if(!n)return;function y(){return!!(d&&f&&ng(d.nodesRef.current,f).length>0)}function x(E){const R=G6(i,"close",h.pointerType),_=()=>{s.setOpen(!1,Gs(Bc,E)),d==null||d.events.emit("floating.closed",E)};R?h.openChangeTimeout.start(R,_):(h.openChangeTimeout.clear(),_())}function w(E){const R=Yo(E);if(!iJe(R)){h.interactedInside=!1;return}h.interactedInside=(R==null?void 0:R.closest("[aria-haspopup]"))!=null}function O(){h.openChangeTimeout.clear(),m.clear(),d==null||d.events.off("floating.closed",k),v()}function S(E){var T;if(y()&&d){d.events.on("floating.closed",k);return}if(qCe(E.relatedTarget,s.context.triggerElements))return;const R=((T=u.current.floatingContext)==null?void 0:T.nodeId)??r,_=E.relatedTarget;if(!(d&&R&&ur(_)&&ng(d.nodesRef.current,R,!1).some(N=>{var A;return zn((A=N.context)==null?void 0:A.elements.floating,_)}))){if(h.handler){h.handler(E);return}v(),b()&&!g()&&x(E)}}function k(E){!d||!f||y()||m.start(0,()=>{d.events.off("floating.closed",k),s.setOpen(!1,Gs(Bc,E)),d.events.emit("floating.closed",E)})}const C=l;return _f(C&&mi(C,"mouseenter",O),C&&mi(C,"mouseleave",S),C&&mi(C,"pointerdown",w,!0),()=>{d==null||d.events.off("floating.closed",k)})},[n,l,s,u,i,r,b,g,v,h,d,f,m])}const Ntt={current:null};function Rtt(e,t={}){var D;const{enabled:n=!0,delay:i=0,handleClose:r=null,mouseOnly:s=!1,restMs:o=0,move:l=!0,triggerElementRef:c=Ntt,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:f,isClosing:h,shouldOpen:m,guardStaleOpen:g=!1}=t,b="rootStore"in e?e.rootStore:e,{dataRef:v,events:y}=b.context,x=Uw(u),w=cAe(b),O=p.useRef(!1),S=Ol(r),k=Ol(i),C=Ol(o),E=Ol(n),R=Ol(m),_=Ol(h),j=Wn(()=>{var M;return ATe((M=v.current.openEvent)==null?void 0:M.type,w.interactedInside)}),T=Wn(()=>{var M;return((M=R.current)==null?void 0:M.call(R))!==!1}),N=Wn((M,L,U)=>{const I=b.context.triggerElements;if(I.hasElement(L))return!M||!zn(M,L);if(!ur(U))return!1;const H=U;return I.hasMatchingElement(K=>zn(K,H))&&(!M||!zn(M,H))}),A=Wn(()=>{if(!w.handler)return;lr(b.select("domReferenceElement")).removeEventListener("mousemove",w.handler),w.handler=void 0}),P=Wn(()=>{yN(w)});return d&&(w.handleCloseOptions=(D=S.current)==null?void 0:D.__options),p.useEffect(()=>A,[A]),p.useEffect(()=>{if(!n)return;function M(L){L.open?O.current=!1:(O.current=L.reason===Bc,A(),w.openChangeTimeout.clear(),w.restTimeout.clear(),w.blockMouseMove=!0,w.restTimeoutPending=!1)}return y.on("openchange",M),()=>{y.off("openchange",M)}},[n,y,w,A]),p.useEffect(()=>{if(!n)return;function M(F,W=!0){const V=G6(k.current,"close",w.pointerType);V?w.openChangeTimeout.start(V,()=>{b.setOpen(!1,Gs(Bc,F)),x==null||x.events.emit("floating.closed",F)}):W&&(w.openChangeTimeout.clear(),b.setOpen(!1,Gs(Bc,F)),x==null||x.events.emit("floating.closed",F))}const L=c.current??(d?b.select("domReferenceElement"):null);if(!ur(L))return;function U(F){var me;if(w.openChangeTimeout.clear(),w.blockMouseMove=!1,s&&!Jv(w.pointerType))return;const W=dY(C.current),V=G6(k.current,"open",w.pointerType),X=Yo(F),ie=F.currentTarget??null,Q=b.select("domReferenceElement");let Z=ie;if(ur(X)&&!b.context.triggerElements.hasElement(X)){for(const se of b.context.triggerElements.elements())if(zn(se,X)){Z=se;break}}ur(ie)&&ur(Q)&&!b.context.triggerElements.hasElement(ie)&&zn(ie,Q)&&(Z=Q);const ce=Z==null?!1:N(Q,Z,X),Ee=b.select("open"),Y=((me=_.current)==null?void 0:me.call(_))??b.select("transitionStatus")==="ending",G=!Ee&&Y&&O.current,te=!ce&&ur(Z)&&ur(Q)&&zn(Q,Z)&&G,ye=W>0&&!V,Ne=ce&&(Ee||G)||te,pe=!Ee||ce;if(Ne){T()&&b.setOpen(!0,Gs(Bc,F,Z));return}ye||(V?w.openChangeTimeout.start(V,()=>{pe&&T()&&b.setOpen(!0,Gs(Bc,F,Z))}):pe&&T()&&b.setOpen(!0,Gs(Bc,F,Z)))}function I(F){if(j()){P();return}A();const W=b.select("domReferenceElement"),V=lr(W);w.restTimeout.clear(),w.restTimeoutPending=!1;const X=v.current.floatingContext??(f==null?void 0:f());if(qCe(F.relatedTarget,b.context.triggerElements))return;if(S.current&&X){b.select("open")||w.openChangeTimeout.clear();const Q=c.current;w.handler=S.current({...X,tree:x,x:F.clientX,y:F.clientY,onClose(){P(),A(),E.current&&!j()&&Q===b.select("domReferenceElement")&&M(F,!0)}}),V.addEventListener("mousemove",w.handler),w.handler(F);return}(w.pointerType==="touch"?!zn(b.select("floatingElement"),F.relatedTarget):!0)&&M(F)}function H(F){zn(L,F.relatedTarget)||(w.openChangeTimeout.clear(),w.restTimeout.clear(),w.restTimeoutPending=!1)}const K=g?mi(L,"mouseout",H):void 0;return l?_f(mi(L,"mousemove",U,{once:!0}),mi(L,"mouseenter",U),mi(L,"mouseleave",I),K):_f(mi(L,"mouseenter",U),mi(L,"mouseleave",I),K)},[A,P,v,k,b,n,S,w,d,N,j,s,l,C,c,x,E,f,_,T,g]),p.useMemo(()=>{if(!n)return;function M(L){w.pointerType=L.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(L){var X,ie,Q;const{nativeEvent:U}=L,I=L.currentTarget,H=b.select("domReferenceElement"),K=b.select("open"),F=N(H,I,L.target);if(s&&!Jv(w.pointerType))return;if(K&&F&&((X=w.handleCloseOptions)!=null&&X.blockPointerEvents)){const Z=b.select("floatingElement");if(Z){const ce=((Q=(ie=w.handleCloseOptions)==null?void 0:ie.getScope)==null?void 0:Q.call(ie))??I.ownerDocument.body;lAe(w,{scopeElement:ce,referenceElement:I,floatingElement:Z})}}const W=dY(C.current);if(K&&!F||W===0||!F&&w.restTimeoutPending&&L.movementX**2+L.movementY**2<2)return;w.restTimeout.clear();function V(){if(w.restTimeoutPending=!1,j())return;const Z=b.select("open");!w.blockMouseMove&&(!Z||F)&&T()&&b.setOpen(!0,Gs(Bc,U,I))}w.pointerType==="touch"?ri.flushSync(()=>{V()}):F&&K?V():(w.restTimeoutPending=!0,w.restTimeout.start(W,V))}}},[n,w,j,N,s,b,C,T])}const _Y=.1,Itt=_Y*_Y,jr=.5;function bA(e,t,n,i,r,s){return i>=t!=s>=t&&e<=(r-n)*(t-i)/(s-i)+n}function yA(e,t,n,i,r,s,o,l,c,u){let d=!1;return bA(e,t,n,i,r,s)&&(d=!d),bA(e,t,r,s,o,l)&&(d=!d),bA(e,t,o,l,c,u)&&(d=!d),bA(e,t,c,u,n,i)&&(d=!d),d}function Ptt(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function vA(e,t,n,i,r,s){const o=Math.min(n,r),l=Math.max(n,r),c=Math.min(i,s),u=Math.max(i,s);return e>=o&&e<=l&&t>=c&&t<=u}function Dtt(e={}){const{blockPointerEvents:t=!1}=e,n=new lu,i=({x:r,y:s,placement:o,elements:l,onClose:c,nodeId:u,tree:d})=>{const f=o==null?void 0:o.split("-")[0];let h=!1,m=null,g=null,b=typeof performance<"u"?performance.now():0;function v(x,w){const O=performance.now(),S=O-b;if(m===null||g===null||S===0)return m=x,g=w,b=O,!1;const k=x-m,C=w-g,E=k*k+C*C,R=S*S*Itt;return m=x,g=w,b=O,E0)}function N(){T()||y()}if(T())return;const A=O.getBoundingClientRect(),P=S.getBoundingClientRect(),D=r>P.right-P.width/2,M=s>P.bottom-P.height/2,L=P.width>A.width,U=P.height>A.height,I=(L?A:P).left,H=(L?A:P).right,K=(U?A:P).top,F=(U?A:P).bottom;if(f==="top"&&s>=A.bottom-1||f==="bottom"&&s<=A.top+1||f==="left"&&r>=A.right-1||f==="right"&&r<=A.left+1){N();return}let W=!1;switch(f){case"top":W=vA(k,C,I,A.top+1,H,P.bottom-1);break;case"bottom":W=vA(k,C,I,P.top+1,H,A.bottom-1);break;case"left":W=vA(k,C,P.right-1,F,A.left+1,K);break;case"right":W=vA(k,C,A.right-1,F,P.left+1,K);break}if(W)return;if(h&&!Ptt(k,C,A)){N();return}if(!R&&v(k,C)){N();return}let V=!1;switch(f){case"top":{const X=L?jr/2:jr*4,ie=L||D?r+X:r-X,Q=L?r-X:D?r+X:r-X,Z=s+jr+1,ce=D||L?P.bottom-jr:P.top,Ee=D?L?P.bottom-jr:P.top:P.bottom-jr;V=yA(k,C,ie,Z,Q,Z,P.left,ce,P.right,Ee);break}case"bottom":{const X=L?jr/2:jr*4,ie=L||D?r+X:r-X,Q=L?r-X:D?r+X:r-X,Z=s-jr,ce=D||L?P.top+jr:P.bottom,Ee=D?L?P.top+jr:P.bottom:P.top+jr;V=yA(k,C,ie,Z,Q,Z,P.left,ce,P.right,Ee);break}case"left":{const X=U?jr/2:jr*4,ie=U||M?s+X:s-X,Q=U?s-X:M?s+X:s-X,Z=r+jr+1,ce=M||U?P.right-jr:P.left,Ee=M?U?P.right-jr:P.left:P.right-jr;V=yA(k,C,ce,P.top,Ee,P.bottom,Z,ie,Z,Q);break}case"right":{const X=U?jr/2:jr*4,ie=U||M?s+X:s-X,Q=U?s-X:M?s+X:s-X,Z=r-jr,ce=M||U?P.left+jr:P.right,Ee=M?U?P.left+jr:P.right:P.left+jr;V=yA(k,C,Z,ie,Z,Q,ce,P.top,Ee,P.bottom);break}}V?h||n.start(40,N):N()}};return i.__options={...e,blockPointerEvents:t},i}const Mtt=p.createContext(void 0);function Ltt(){const e=p.useContext(Mtt);return(e==null?void 0:e.direction)??"ltr"}const $tt=e=>({name:"arrow",options:e,async fn(t){var U,I;const{x:n,y:i,placement:r,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0,offsetParent:f="real"}=Pf(e,t)||{};if(u==null)return{};const h=PU(d),m={x:n,y:i},g=WI(r),b=qI(g),v=await o.getDimensions(u),y=g==="y",x=y?"top":"left",w=y?"bottom":"right",O=y?"clientHeight":"clientWidth",S=s.reference[b]+s.reference[g]-m[g]-s.floating[b],k=m[g]-s.reference[g],C=f==="real"?await((U=o.getOffsetParent)==null?void 0:U.call(o,u)):l.floating;let E=l.floating[O]||s.floating[b];(!E||!await((I=o.isElement)==null?void 0:I.call(o,C)))&&(E=l.floating[O]||s.floating[b]);const R=S/2-k/2,_=E/2-v[b]/2-1,j=Math.min(h[x],_),T=Math.min(h[w],_),N=j,A=E-v[b]-T,P=E/2-v[b]/2+R,D=RU(N,P,A),M=!c.arrow&&Ep(r)!=null&&P!==D&&s.reference[b]/2-(P({...$tt(e),options:[e,t]}),Btt={name:"hide",async fn(e){const{width:t,height:n,x:i,y:r}=e.rects.reference,s=t===0&&n===0&&i===0&&r===0,o=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||s}}}},Utt={sideX:"left",sideY:"top"},jY="--available-width",NY="--available-height";function uAe(e,t,n){const i=e==="inline-start"||e==="inline-end";return{top:"top",right:i?n?"inline-start":"inline-end":"right",bottom:"bottom",left:i?n?"inline-end":"inline-start":"left"}[t]}function RY(e,t,n){const{rects:i,placement:r}=e;return{side:uAe(t,Qu(r),n),align:Ep(r)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function Qtt(e){return ztt(e,Att)}function ztt(e,t){var dt,yt;const{anchor:n,positionMethod:i="absolute",side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,collisionBoundary:c,collisionPadding:u=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,inline:m,keepMounted:g=!1,floatingRootContext:b,mounted:v,collisionAvoidance:y,shift:x,nodeId:w,adaptiveOrigin:O,lazyFlip:S=!1,externalTree:k}=e,[C,E]=p.useState(null);!v&&C!==null&&E(null);const R=y.side||"flip",_=y.align||"flip",j=y.fallbackAxisSide||"end",T=(x==null?void 0:x.crossAxis)??!1,N=x==null?void 0:x.rootBoundary,A=typeof n=="function"?n:void 0,P=Wn(A),D=A?P:n,M=Ol(n),L=Ol(v),I=Ltt()==="rtl",H=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[r],K=o==="center"?H:`${H}-${o}`;let F=u;typeof F=="number"?F={top:F,right:F,bottom:F,left:F}:F&&(F={top:F.top||0,right:F.right||0,bottom:F.bottom||0,left:F.left||0});const W=1,V=r==="bottom"?W:0,X=r==="top"?W:0,ie=r==="right"?W:0,Q=r==="left"?W:0,Z={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:F},ce=p.useRef(null),Ee=Ol(s),Y=Ol(l),G=typeof s!="function"?s:0,te=typeof l!="function"?l:0,ye=[];m&&ye.push(m),ye.push(zTe(Ie=>{const vt=RY(Ie,r,I),jt=typeof Ee.current=="function"?Ee.current(vt):Ee.current,Nt=typeof Y.current=="function"?Y.current(vt):Y.current;return{mainAxis:jt,crossAxis:Nt,alignmentAxis:Nt}},[G,te,I,r]));const Ne=_==="none"&&R!=="shift",pe=!Ne&&(d||T||R==="shift"),me=R==="none"?null:qTe({...Z,padding:{top:F.top+W+V,right:F.right+W+Q,bottom:F.bottom+W+X,left:F.left+W+ie},mainAxis:!T&&R==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:j}),se=Ne?null:VTe({...Z,rootBoundary:N,mainAxis:_!=="none",crossAxis:pe,limiter:d||T?void 0:HTe(Ie=>{if(!ce.current)return{};const{width:vt,height:jt}=ce.current.getBoundingClientRect(),Nt=Iu(Qu(Ie.placement)),ln=Nt==="y"?vt:jt,He=Nt==="y"?F.left+F.right:F.top+F.bottom;return{offset:ln/2+He/2}})},[Z,d,T,N,F,_]);R==="shift"||_==="shift"||o==="center"?ye.push(se,me):ye.push(me,se),ye.push(WTe({...Z,apply({elements:{floating:Ie},availableWidth:vt,availableHeight:jt,rects:Nt}){if(!L.current)return;const ln=Ie.style;ln.setProperty(jY,`${vt}px`),ln.setProperty(NY,`${jt}px`);const He=Fs(Ie).devicePixelRatio||1,{x:Me,y:We,width:gt,height:st}=Nt.reference,xt=(Math.round((Me+gt)*He)-Math.round(Me*He))/He,ft=(Math.round((We+st)*He)-Math.round(We*He))/He;ln.setProperty("--anchor-width",`${xt}px`),ln.setProperty("--anchor-height",`${ft}px`)}}),Ftt(Ie=>({element:ce.current||lr(Ie.elements.floating).createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Ie){var ot,vn,Ye;const{elements:vt,middlewareData:jt,placement:Nt,rects:ln,y:He}=Ie,Me=Qu(Nt),We=Iu(Me),gt=ce.current,st=((ot=jt.arrow)==null?void 0:ot.x)||0,xt=((vn=jt.arrow)==null?void 0:vn.y)||0,ft=(gt==null?void 0:gt.clientWidth)||0,Ht=(gt==null?void 0:gt.clientHeight)||0,cn=st+ft/2,hn=xt+Ht/2,Ge=Math.abs(((Ye=jt.shift)==null?void 0:Ye.y)||0),bt=ln.reference.height/2,St=typeof s=="function"?s(RY(Ie,r,I)):s,dn=Ge>St,Rt={top:`${cn}px calc(100% + ${St}px)`,bottom:`${cn}px ${-St}px`,left:`calc(100% + ${St}px) ${hn}px`,right:`${-St}px ${hn}px`}[Me],$e=`${cn}px ${ln.reference.y+bt-He}px`;return vt.floating.style.setProperty("--transform-origin",pe&&We==="y"&&dn?$e:Rt),{}}},Btt,O),Un(()=>{!v&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[v,b]);const Se=p.useMemo(()=>({elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:Le,elements:be,x:Ve,y:ve,middlewareData:Re,update:ne,placement:ge,context:Ce,isPositioned:ke,floatingStyles:Ke}=t({rootContext:b,open:g?v:void 0,placement:K,middleware:ye,strategy:i,whileElementsMounted:g?void 0:(...Ie)=>Y6(...Ie,Se),nodeId:w,externalTree:k}),{sideX:it,sideY:ue}=Re.adaptiveOrigin||Utt,xe=ke?i:"fixed",Te=p.useMemo(()=>{let Ie;return ke?O?Ie={position:xe,[it]:Ve,[ue]:ve}:Ie={...Ke,position:xe}:Ie={position:xe,top:0,left:0},Ie[jY]="100vw",Ie[NY]="100vh",ke||(Ie.opacity=0),Ie},[O,xe,it,Ve,ue,ve,Ke,ke]),qe=p.useRef(null);Un(()=>{if(!v)return;const Ie=M.current,vt=typeof Ie=="function"?Ie():Ie,Nt=(IY(vt)?vt.current:vt)||null||null;Nt!==qe.current&&(Le.setPositionReference(Nt),qe.current=Nt)},[v,Le,D,M]),p.useEffect(()=>{if(!v)return;const Ie=M.current;typeof Ie!="function"&&IY(Ie)&&Ie.current!==qe.current&&(Le.setPositionReference(Ie.current),qe.current=Ie.current)},[v,Le,D,M]),p.useEffect(()=>{if(g&&v&&be.reference&&be.floating)return Y6(be.reference,be.floating,ne,Se)},[g,v,be,ne,Se]);const De=Qu(ge),At=uAe(r,De,I),It=Ep(ge)||"center",lt=!!((dt=Re.hide)!=null&&dt.referenceHidden);Un(()=>{S&&v&&ke&&De!==H&&E(De)},[S,v,ke,De,H]);const Ot=p.useMemo(()=>{var Ie,vt;return{position:"absolute",top:(Ie=Re.arrow)==null?void 0:Ie.y,left:(vt=Re.arrow)==null?void 0:vt.x}},[Re.arrow]),Ct=((yt=Re.arrow)==null?void 0:yt.centerOffset)!==0;return p.useMemo(()=>({positionerStyles:Te,arrowStyles:Ot,arrowRef:ce,arrowUncentered:Ct,side:At,align:It,physicalSide:De,anchorHidden:lt,refs:Le,context:Ce,isPositioned:ke,update:ne}),[Te,Ot,ce,Ct,At,It,De,lt,Le,Ce,ke,ne])}function IY(e){return e!=null&&"current"in e}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=pN.startingStyle]="startingStyle",e[e.endingStyle=pN.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const Vtt={"data-popup-open":""},Htt={"data-popup-open":"","data-pressed":""},qtt={"data-open":""},Wtt={"data-closed":""},Ktt={"data-anchor-hidden":""},Gtt={open(e){return e?Vtt:null}},Xtt={open(e){return e?Htt:null}},GU={open(e){return e?qtt:Wtt},anchorHidden(e){return e?Ktt:null}},dAe={...GU,...KI};function fAe(e){return e==="starting"?GJe:Cl}function Ytt(e,t,{styles:n,transitionStatus:i,props:r,refs:s,hidden:o,inert:l=!1}){const c={...n};return l&&(c.pointerEvents="none"),Do("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:o,style:c},fAe(i),r],stateAttributesMapping:GU})}function hAe(){const e=SU(),t=e.useState("toasts");return p.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function Ztt({orientation:e="vertical",maxHeight:t,hideScrollbar:n=!1,fadeEdges:i=!1,contentClassName:r="",className:s="",style:o,children:l,hasMore:c=!1,onLoadMore:u,threshold:d=24,onScroll:f,ref:h,...m}){const[g,b]=p.useState(!1),[v,y]=p.useState(!1),[x,w]=p.useState({top:!1,bottom:!1}),O=p.useRef(null),S=p.useRef(null),k=i&&e!=="horizontal",C=!!u&&e!=="horizontal";p.useImperativeHandle(h,()=>O.current,[]),p.useEffect(()=>()=>{var _;(_=S.current)==null||_.abort()},[]);const E=p.useCallback(()=>{const _=O.current;if(!k||!_)return;const j=_.scrollHeight-_.clientHeight,T=j>1&&_.scrollTop>1,N=j>1&&j-_.scrollTop>1;w(A=>A.top===T&&A.bottom===N?A:{top:T,bottom:N})},[k]);p.useEffect(()=>{const _=O.current;if(!k||!_)return;const j=new ResizeObserver(E);j.observe(_);for(const T of _.children)j.observe(T);return E(),()=>j.disconnect()},[k,C,E]);async function R(){if(!u||!c||S.current)return;const _=new AbortController;S.current=_,b(!0),y(!1);try{await u(_.signal)}catch{_.signal.aborted||y(!0)}finally{_.signal.aborted||b(!1),S.current===_&&(S.current=null)}}return a.jsxs("div",{...m,ref:O,className:`studio-scroll-area ${s}`.trim(),"data-orientation":e,"data-hide-scrollbar":n||void 0,"data-fade-edges":k&&(x.top||x.bottom)||void 0,"data-fade-top":k&&x.top||void 0,"data-fade-bottom":k&&x.bottom||void 0,style:{maxHeight:t,...o},onScroll:_=>{f==null||f(_),E();const j=_.currentTarget;!_.defaultPrevented&&e!=="horizontal"&&!v&&j.scrollTop>0&&j.scrollHeight-j.clientHeight-j.scrollTop<=Math.max(0,d)&&R()},children:[a.jsx("div",{className:`studio-scroll-area__content ${r}`.trim(),"aria-busy":u?g:void 0,children:l}),u&&e!=="horizontal"&&a.jsx(a.Fragment,{children:a.jsxs("div",{className:"studio-scroll-area__footer",children:[g?a.jsx(MCe,{size:24}):a.jsx("span",{role:"status","aria-live":"polite",children:v?"加载失败":c?"向下滚动加载更多":"已加载全部"}),!g&&c&&a.jsx("button",{type:"button",onClick:()=>void R(),children:v?"重试":"加载更多"})]})})]})}function Jtt(){const{add:e,close:t}=hAe();return{add:p.useCallback(({id:i,title:r,description:s,variant:o="info",duration:l,action:c,closeLabel:u,onClose:d})=>e({id:i,title:r,description:s,timeout:l,priority:"low",onClose:d,data:{variant:o,action:c,closeLabel:u}}),[e]),dismiss:t}}function ent({position:e,label:t}){const{toasts:n,close:i}=hAe();return a.jsx(vet,{children:a.jsx(VJe,{className:"studio-toast-viewport","data-position":e,"data-empty":n.length===0||void 0,"aria-label":t,render:a.jsx(Ztt,{contentClassName:"studio-toast-viewport__stack"}),children:n.map(r=>{var s,o,l;return a.jsx(aet,{toast:r,className:"studio-toast-root",swipeDirection:[],children:a.jsx(xZe,{role:"presentation",variant:(s=r.data)==null?void 0:s.variant,title:r.title!=null?a.jsx(fet,{render:a.jsx("div",{}),children:r.title}):void 0,description:r.description!=null?a.jsx(det,{render:a.jsx("div",{}),children:r.description}):void 0,action:(o=r.data)==null?void 0:o.action,closeLabel:(l=r.data)==null?void 0:l.closeLabel,onDismiss:()=>i(r.id)})},r.id)})})})}function tnt({children:e,duration:t=4e3,position:n="top-center",label:i="通知"}){return a.jsxs(TJe,{timeout:t,limit:3,children:[e,a.jsx(ent,{position:n,label:i})]})}function nnt({ownerId:e,sessionId:t,onOpen:n,hideNotices:i,refreshKey:r,onUpdate:s}){const{t:o}=Ae("sandbox"),l=Jtt(),c=p.useRef(new Map),u=p.useRef(new Map),d=p.useRef(null),f=p.useRef({sessionId:t,onOpen:n,toast:l,t:o,hideNotices:i,onUpdate:s});return f.current={sessionId:t,onOpen:n,toast:l,t:o,hideNotices:i,onUpdate:s},p.useEffect(()=>{if(i){f.current.toast.dismiss(),u.current.clear();return}for(const h of c.current.values())h.sessionId===t&&(f.current.toast.dismiss(h.runId),u.current.delete(h.runId))},[t,i]),p.useEffect(()=>{var h;(h=d.current)==null||h.call(d)},[r]),p.useEffect(()=>{if(!e)return;const h=new AbortController,m=c.current,g=u.current,b=new Set;let v,y=!1,x=[],w="";const O=(C,E=w)=>{var R,_;w=E,h.signal.aborted||(_=(R=f.current).onUpdate)==null||_.call(R,{ownerId:e,runs:x,loading:C,error:E})},S=C=>{const{toast:E,t:R,sessionId:_,onOpen:j}=f.current;if(!h.signal.aborted){if(f.current.hideNotices||C.sessionId===_){E.dismiss(C.runId),g.delete(C.runId);return}b.has(C.runId)||g.get(C.runId)===C.state||(g.set(C.runId,C.state),E.add({id:C.runId,duration:0,title:R(`taskNotice.${C.state}`),description:C.message.slice(0,80),variant:C.state==="succeeded"?"success":C.state==="failed"?"error":"info",closeLabel:R("taskNotice.hide"),onClose:()=>b.add(C.runId),action:a.jsx(LCe,{variant:"secondary",onClick:()=>{j(C.sessionId,h.signal).catch(T=>{h.signal.aborted||E.add({id:"task-open-error",variant:"error",description:T instanceof Error?T.message:String(T)})})},children:R("taskNotice.open")})}))}},k=async(C=!1)=>{if(!(y||h.signal.aborted)){clearTimeout(v),y=!0,C&&O(!0);try{const E=await pd.active(h.signal);if(h.signal.aborted)return;x=E,O(!1,"");const R=new Set(E.map(_=>_.runId));for(const _ of m.values())if(!R.has(_.runId)&&!Fc(_)){let j;try{j=await pd.get(_.runId,h.signal)}catch(T){if(T instanceof Hx&&T.status===404){m.delete(_.runId),g.delete(_.runId),f.current.toast.dismiss(_.runId);continue}throw T}if(h.signal.aborted)return;m.set(j.runId,j),S(j)}for(const _ of E)m.set(_.runId,_),S(_);f.current.toast.dismiss("task-connection")}catch(E){if(h.signal.aborted)return;E instanceof Hx&&[401,403].includes(E.status)&&(x=[],m.clear(),g.clear(),f.current.toast.dismiss()),O(!1,E instanceof Error?E.message:f.current.t("taskNotice.reconnecting")),!h.signal.aborted&&m.size&&!f.current.hideNotices&&f.current.toast.add({id:"task-connection",duration:0,description:f.current.t("taskNotice.reconnecting")})}finally{y=!1,h.signal.aborted||(v=setTimeout(k,3e3))}}};return d.current=()=>{k(!0)},O(!0),k(),()=>{h.abort(),clearTimeout(v),d.current=null,f.current.toast.dismiss()}},[e]),null}function int(e){const{t}=Ae("sandbox");return a.jsx(tnt,{position:"bottom-right",label:t("taskNotice.label"),children:a.jsx(nnt,{...e},e.ownerId)})}const $S=["super_admin","admin","developer","user"];class FS extends Error{constructor(t,n){super(t),this.code=t,this.status=n}}async function pAe(e){let t;try{t=await e.json()}catch{throw new FS("invalid_response",e.status)}if(!e.ok){const n=t&&typeof t=="object"&&"code"in t&&typeof t.code=="string"?t.code:"request_failed";throw new FS(n,e.status)}return t}function mAe(e){return!e||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"email"in e&&typeof e.email=="string"&&"role"in e&&$S.some(t=>t===e.role)&&"status"in e&&typeof e.status=="string"&&"lastLogin"in e&&typeof e.lastLogin=="string"&&"protected"in e&&typeof e.protected=="boolean"&&"currentUser"in e&&typeof e.currentUser=="boolean"&&"roleConflict"in e&&typeof e.roleConflict=="boolean"}async function rnt(e){const t=new URLSearchParams({page:String(e.page),pageSize:"20",query:e.query});e.role&&t.set("role",e.role);const n=await pAe(await gn(`/web/users?${t}`,{signal:e.signal,cache:"no-store"}));if(!n||typeof n!="object"||!("items"in n)||!Array.isArray(n.items)||!n.items.every(mAe)||!("total"in n)||typeof n.total!="number"||!("poolTotal"in n)||typeof n.poolTotal!="number"||!("page"in n)||typeof n.page!="number"||!("pageSize"in n)||typeof n.pageSize!="number"||!("userPoolId"in n)||typeof n.userPoolId!="string"||!("clientId"in n)||typeof n.clientId!="string"||!("provider"in n)||!["volcengine","byteplus"].includes(String(n.provider)))throw new FS("invalid_response",502);return n}async function snt(e,t,n){const i=await pAe(await gn(`/web/users/${encodeURIComponent(e.id)}/role`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t,expectedRole:e.role}),signal:n}));if(!i||typeof i!="object"||!("user"in i)||!mAe(i.user))throw new FS("invalid_response",502);return i.user}function ont(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 9.5 5 5 5-5"})})}function ant(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m6.5 12.5 3.5 3.5 7.5-8"})})}function Ag({ariaLabel:e,value:t,valueLabel:n,placeholder:i,options:r,disabled:s=!1,searchValue:o,searchPlaceholder:l,loading:c=!1,hasMore:u=!1,emptyMessage:d,onSearchChange:f,onLoadMore:h,onChange:m}){const{t:g}=Ae("ui"),b=l??g("deploymentSelect.searchPlaceholder"),v=d??g("deploymentSelect.emptyMessage"),y=p.useId(),x=p.useRef(null),w=p.useRef(null),O=p.useRef(null),S=p.useRef(null),k=p.useRef([]),[C,E]=p.useState(!1),[R,_]=p.useState(0),j=r.find(L=>L.value===t),T=(j==null?void 0:j.label)??(t?n:void 0),N=o!==void 0&&!!f,A=()=>{E(!1),N&&o&&(f==null||f(""))};p.useEffect(()=>{if(!C)return;const L=U=>{U.target instanceof Node&&x.current&&!x.current.contains(U.target)&&A()};return window.addEventListener("pointerdown",L),()=>window.removeEventListener("pointerdown",L)},[C,f,o,N]),p.useEffect(()=>{var L,U;if(C){if(N){(L=O.current)==null||L.focus();return}(U=k.current[R])==null||U.focus()}},[C,N]),p.useEffect(()=>{var L;!C||N&&document.activeElement===O.current||(L=k.current[R])==null||L.focus()},[R,C,N]),p.useEffect(()=>{_(L=>Math.min(L,Math.max(0,r.length-1)))},[r.length]),p.useEffect(()=>{if(!C||!u||c||!h)return;const L=window.requestAnimationFrame(()=>{const U=S.current;U&&U.scrollHeight<=U.clientHeight+1&&h()});return()=>window.cancelAnimationFrame(L)},[u,c,h,C,r.length]);const P=(L=1)=>{const U=r.findIndex(H=>H.value===t),I=U>=0?U:L===1?0:Math.max(0,r.length-1);_(I),E(!0)},D=L=>{r.length!==0&&_((L+r.length)%r.length)},M=L=>{var U;m(L.value),A(),(U=w.current)==null||U.focus()};return a.jsxs("div",{className:"pp-deployment-select",ref:x,onKeyDown:L=>{var I,H;const U=L.target===O.current;if(L.key==="Escape"&&C){L.preventDefault(),A(),(I=w.current)==null||I.focus();return}if(L.key==="Tab"){A();return}if(U){L.key==="ArrowDown"&&r.length>0&&(L.preventDefault(),_(0),(H=k.current[0])==null||H.focus());return}L.key==="ArrowDown"?(L.preventDefault(),C?D(R+1):P(1)):L.key==="ArrowUp"?(L.preventDefault(),C?D(R-1):P(-1)):C&&L.key==="Home"?(L.preventDefault(),_(0)):C&&L.key==="End"&&(L.preventDefault(),_(Math.max(0,r.length-1)))},children:[a.jsxs("button",{ref:w,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":C,"aria-controls":C?y:void 0,disabled:s,onClick:()=>{C?A():P()},children:[a.jsx("span",{className:T?void 0:"is-placeholder",children:T??i}),a.jsx(ont,{className:`pp-deployment-select-chevron${C?" is-open":""}`})]}),C&&a.jsxs("div",{className:"pp-deployment-select-menu",children:[N&&a.jsx("div",{className:"pp-deployment-select-search",children:a.jsx("input",{ref:O,type:"search",value:o,"aria-label":g("deploymentSelect.searchAriaLabel",{label:e}),placeholder:b,autoComplete:"off",onChange:L=>f==null?void 0:f(L.currentTarget.value)})}),a.jsx("div",{id:y,ref:S,className:"pp-deployment-select-options",role:"listbox","aria-label":e,"aria-busy":c||void 0,onScroll:L=>{if(!u||c||!h)return;const U=L.currentTarget;U.scrollHeight-U.scrollTop-U.clientHeight<=24&&h()},children:r.map((L,U)=>{const I=L.value===t;return a.jsxs("button",{ref:H=>{k.current[U]=H},type:"button",role:"option","aria-selected":I,tabIndex:U===R?0:-1,className:`pp-deployment-select-option${I?" is-selected":""}`,title:L.description,onFocus:()=>_(U),onClick:()=>M(L),children:[a.jsxs("span",{className:"pp-deployment-select-copy",children:[a.jsxs("span",{className:"pp-deployment-select-name",children:[L.label,L.badge&&a.jsx("span",{className:"pp-deployment-select-badge",children:L.badge})]}),L.description&&a.jsx("small",{children:L.description})]}),I&&a.jsx(ant,{})]},L.value)})}),c&&a.jsx("div",{className:"pp-deployment-select-state","aria-live":"polite",children:g("deploymentSelect.loadingMore")}),!c&&r.length===0&&a.jsx("div",{className:"pp-deployment-select-state",children:v})]})]})}function YI({label:e,onClick:t}){return a.jsx("button",{type:"button",className:"page-back-button","aria-label":e,title:e,onClick:t,children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m14.5 6-6 6 6 6"})})})}function yn({as:e="span",className:t="",duration:n=4,spread:i=20,children:r,style:s,...o}){const l=Math.min(Math.max(i,5),45);return a.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...s,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...o,children:r})}function lnt(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M16 7a6.5 6.5 0 1 0 .2 5M16 3.5V7h-3.5"})})}function gAe(e){return e instanceof FS?e.code:"request_failed"}function cnt({user:e,onClose:t,onSaved:n}){const{t:i,i18n:r}=Ae("users"),s=p.useRef(null),o=p.useRef(null),l=p.useId(),c=p.useId(),[u,d]=p.useState(e.role),[f,h]=p.useState(!1),[m,g]=p.useState("");p.useEffect(()=>{const v=s.current,y=document.activeElement;return v==null||v.showModal(),()=>{var x;(x=o.current)==null||x.abort(),v==null||v.close(),y instanceof HTMLElement&&y.isConnected&&y.focus()}},[]);const b=async()=>{if(f||u===e.role&&!e.roleConflict)return;const v=new AbortController;o.current=v,h(!0),g("");try{const y=await snt(e,u,v.signal);v.signal.aborted||n(y)}catch(y){v.signal.aborted||g(i(`errors.${gAe(y)}`,{defaultValue:i("errors.request_failed")}))}finally{v.signal.aborted||h(!1)}};return a.jsxs("dialog",{ref:s,className:"user-role-dialog","aria-labelledby":l,"aria-describedby":c,"aria-busy":f,onCancel:v=>{v.preventDefault(),f||t()},children:[a.jsxs("header",{children:[a.jsx("h2",{id:l,children:i("changeRole")}),a.jsx("button",{type:"button",className:"users-close",onClick:t,disabled:f,"aria-label":i("close"),children:a.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:a.jsx("path",{d:"m5 5 10 10M15 5 5 15"})})})]}),a.jsxs("div",{className:"user-role-dialog-body",children:[a.jsxs("div",{className:"users-account",children:[a.jsx("strong",{children:e.name}),a.jsx("span",{children:e.email||e.id})]}),a.jsx("label",{className:"users-field-label",children:i("role")}),a.jsx(Ag,{ariaLabel:i("role"),placeholder:i("role"),value:u,disabled:f,options:$S.map(v=>({value:v,label:i(`roles.${v}`),description:i(`descriptions.${v}`)})),onChange:v=>{const y=$S.find(x=>x===v);y&&d(y)}},r.resolvedLanguage),a.jsx("p",{id:c,className:"users-help",children:i("effectiveAfterRefresh")}),m?a.jsx("p",{className:"users-error",role:"alert",children:m}):null]}),a.jsxs("footer",{children:[a.jsx("button",{className:"users-button",type:"button",disabled:f,onClick:t,children:i("cancel")}),a.jsx("button",{className:"users-button is-primary",type:"button",disabled:f||u===e.role&&!e.roleConflict,onClick:()=>void b(),children:i(f?"saving":"save")})]})]})}function unt({onBack:e}){const{t,i18n:n}=Ae("users"),[i,r]=p.useState(null),[s,o]=p.useState(!0),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(""),[m,g]=p.useState(""),[b,v]=p.useState(1),[y,x]=p.useState(0),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(null);p.useEffect(()=>{const T=new AbortController;return o(!0),c(""),rnt({page:b,query:f,role:m,signal:T.signal}).then(N=>{if(!T.signal.aborted){if(N.total>0&&N.items.length===0&&b>1){v(1);return}r(N),E(new Date)}}).catch(N=>{T.signal.aborted||c(gAe(N))}).finally(()=>{T.signal.aborted||o(!1)}),()=>T.abort()},[b,f,m,y]);const R=T=>{T.preventDefault(),h(u.trim()),v(1),x(N=>N+1)},_=T=>{if(!T)return t("neverLoggedIn");const N=Number(T),A=new Date(Number.isFinite(N)&&N>0?N<1e12?N*1e3:N:T);return Number.isNaN(A.getTime())?t("unknown"):A.toLocaleString(n.resolvedLanguage,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})},j=Math.max(1,Math.ceil(((i==null?void 0:i.total)??0)/20));return a.jsxs("section",{className:"users-page","aria-labelledby":"users-title",children:[a.jsxs("header",{className:"users-page-header",children:[a.jsx(YI,{label:t("back"),onClick:e}),a.jsx("h1",{id:"users-title",children:t("title")}),i?a.jsx("span",{className:"users-count",children:t("memberCount",{count:i.poolTotal})}):null]}),a.jsxs("div",{className:"users-content",children:[i?a.jsxs("div",{className:"users-pool",children:[a.jsx("span",{children:i.provider==="byteplus"?"BytePlus Identity":t("volcengineIdentity")}),a.jsxs("span",{className:"users-pool-id",title:i.userPoolId,children:[t("pool")," ",i.userPoolId]})]}):null,a.jsxs("div",{className:"users-toolbar",children:[a.jsxs("form",{className:"users-search",onSubmit:R,children:[a.jsx("input",{value:u,onChange:T=>d(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.keyCode===229)&&T.preventDefault()},"aria-label":t("searchPlaceholder"),placeholder:t("searchPlaceholder"),maxLength:200}),a.jsx("button",{type:"submit",className:"users-button",disabled:s,children:t("search")})]}),a.jsx("div",{className:"users-role-filter",children:a.jsx(Ag,{ariaLabel:t("filterRole"),placeholder:t("allRoles"),value:m,options:[{value:"",label:t("allRoles")},...$S.map(T=>({value:T,label:t(`roles.${T}`)}))],onChange:T=>{const N=$S.find(A=>A===T);g(N??""),v(1)}})}),a.jsxs("button",{type:"button",className:"users-button users-refresh",disabled:s,onClick:()=>{k(null),x(T=>T+1)},children:[a.jsx(lnt,{}),a.jsx("span",{children:t("refresh")})]})]}),a.jsx("div",{className:"users-feedback","aria-live":"polite",children:s?a.jsx(yn,{children:t("loading")}):S?a.jsx("span",{children:t("saved",{name:S.name,role:t(`roles.${S.role}`)})}):C?a.jsx("span",{children:t("updatedAt",{time:C.toLocaleTimeString(n.resolvedLanguage,{hour:"2-digit",minute:"2-digit",hour12:!1})})}):null}),l?a.jsxs("div",{className:"users-error users-error-banner",role:"alert",children:[a.jsx("span",{children:t(`errors.${l}`,{defaultValue:t("errors.request_failed")})}),a.jsx("button",{type:"button",className:"users-button",onClick:()=>x(T=>T+1),children:t("retry")})]}):null,a.jsxs("div",{className:"users-table-wrap","aria-busy":s,children:[a.jsxs("table",{className:"users-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:t("user")}),a.jsx("th",{scope:"col",children:t("role")}),a.jsx("th",{scope:"col",children:t("status")}),a.jsx("th",{scope:"col",children:t("lastLogin")}),a.jsx("th",{scope:"col",children:a.jsx("span",{className:"sr-only",children:t("actions")})})]})}),a.jsx("tbody",{children:i==null?void 0:i.items.map(T=>{var N;return a.jsxs("tr",{children:[a.jsx("td",{"data-label":t("user"),children:a.jsxs("div",{className:"users-person",children:[a.jsx("span",{className:"users-avatar","aria-hidden":"true",children:(N=Array.from(T.name)[0])==null?void 0:N.toUpperCase()}),a.jsxs("div",{className:"users-account",children:[a.jsxs("strong",{children:[T.name,T.currentUser?a.jsx("span",{className:"users-self",children:t("you")}):null]}),a.jsx("span",{title:T.email||T.id,children:T.email||T.id})]})]})}),a.jsxs("td",{"data-label":t("role"),children:[a.jsx("span",{className:`users-role-badge${T.role==="super_admin"?" is-super":""}`,children:t(`roles.${T.role}`)}),T.roleConflict?a.jsx("span",{className:"users-inline-warning",children:t("roleConflict")}):null]}),a.jsx("td",{"data-label":t("status"),children:a.jsx("span",{className:"users-status",children:t(`states.${T.status}`,{defaultValue:t("unknown")})})}),a.jsx("td",{"data-label":t("lastLogin"),className:"users-last-login",children:_(T.lastLogin)}),a.jsx("td",{className:"users-actions",children:T.protected?a.jsx("span",{className:"users-protected",title:t("protectedExplanation"),children:t("initialAdministrator")}):a.jsx("button",{type:"button",className:"users-button is-text",disabled:s||!!l||T.currentUser,onClick:()=>{k(null),O(T)},children:t("changeRole")})})]},T.id)})})]}),!s&&!l&&(i==null?void 0:i.items.length)===0?a.jsxs("div",{className:"users-empty",children:[a.jsx("strong",{children:t("noUsers")}),a.jsx("span",{children:t(f||m?"tryAnotherSearch":"poolEmpty")})]}):null,s&&!i?a.jsx("div",{className:"users-empty",children:a.jsx(yn,{children:t("loading")})}):null]}),i?a.jsxs("footer",{className:"users-pagination",children:[a.jsx("span",{children:t("resultCount",{count:i.total})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",className:"users-button",disabled:b<=1||s,onClick:()=>v(T=>T-1),children:t("previous")}),a.jsxs("span",{children:[b," / ",j]}),a.jsx("button",{type:"button",className:"users-button",disabled:b>=j||s,onClick:()=>v(T=>T+1),children:t("next")})]})]}):null]}),w?a.jsx(cnt,{user:w,onClose:()=>O(null),onSaved:T=>{O(null),k(T),x(N=>N+1)}}):null]})}const dnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M5.293 12.707a1 1 0 0 1 0-1.414l5-5a1 1 0 1 1 1.414 1.414L8.414 11H18a1 1 0 1 1 0 2H8.414l3.293 3.293a1 1 0 0 1-1.414 1.414l-5-5Z",clipRule:"evenodd"})}),fnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M18.707 12.707a1 1 0 0 0 0-1.414l-5-5a1 1 0 1 0-1.414 1.414L15.586 11H6a1 1 0 1 0 0 2h9.586l-3.293 3.293a1 1 0 0 0 1.414 1.414l5-5Z",clipRule:"evenodd"})}),hnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M4.47192 2.5C5.02421 2.5 5.47192 2.94772 5.47192 3.5V5.07196C7.17065 3.47759 9.45675 2.5 11.9719 2.5C17.2186 2.5 21.4719 6.75329 21.4719 12C21.4719 17.2467 17.2186 21.5 11.9719 21.5C7.10262 21.5 3.0902 17.8375 2.53692 13.1164C2.47264 12.5679 2.8652 12.0711 3.41373 12.0068C3.96226 11.9425 4.45904 12.3351 4.52333 12.8836C4.95991 16.6089 8.12901 19.5 11.9719 19.5C16.1141 19.5 19.4719 16.1421 19.4719 12C19.4719 7.85786 16.1141 4.5 11.9719 4.5C9.75153 4.5 7.75552 5.46469 6.38146 7H9.00003C9.55232 7 10 7.44772 10 8C10 8.55228 9.55232 9 9.00003 9H4.47192C3.93256 9 3.49293 8.57299 3.47265 8.03859C3.47175 8.01771 3.47151 7.99677 3.47192 7.9758V3.5C3.47192 2.94772 3.91964 2.5 4.47192 2.5Z",fill:"currentColor"})}),ZI=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M2.55823 12C2.55823 6.75329 6.81152 2.5 12.0582 2.5C14.5734 2.5 16.8595 3.47759 18.5582 5.07197V3.5C18.5582 2.94772 19.0059 2.5 19.5582 2.5C20.1105 2.5 20.5582 2.94772 20.5582 3.5V7.97591C20.5586 7.99622 20.5584 8.01651 20.5576 8.03674C20.5382 8.572 20.0982 9 19.5582 9H15.0582C14.5059 9 14.0582 8.55228 14.0582 8C14.0582 7.44772 14.5059 7 15.0582 7H17.6487C16.2746 5.46469 14.2786 4.5 12.0582 4.5C7.91609 4.5 4.55823 7.85786 4.55823 12C4.55823 16.1421 7.91609 19.5 12.0582 19.5C15.9011 19.5 19.0702 16.6089 19.5068 12.8836C19.5711 12.3351 20.0679 11.9425 20.6164 12.0068C21.165 12.0711 21.5575 12.5679 21.4932 13.1164C20.94 17.8375 16.9275 21.5 12.0582 21.5C6.81152 21.5 2.55823 17.2467 2.55823 12Z",fill:"currentColor"})}),xA=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z",clipRule:"evenodd"})}),pnt=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M10.663 6.3872C10.8152 6.29068 11 6.40984 11 6.59007V8C11 8.55229 11.4477 9 12 9C12.5523 9 13 8.55229 13 8V6.59007C13 6.40984 13.1848 6.29068 13.337 6.3872C14.036 6.83047 14.5 7.61105 14.5 8.5C14.5 9.53284 13.8737 10.4194 12.9801 10.8006C12.9932 10.865 13 10.9317 13 11V13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13V11C11 10.9317 11.0068 10.865 11.0199 10.8006C10.1263 10.4194 9.5 9.53284 9.5 8.5C9.5 7.61105 9.96397 6.83047 10.663 6.3872Z",fill:"currentColor"}),a.jsx("path",{d:"M17.9754 4.01031C17.8588 4.00078 17.6965 4.00001 17.4 4.00001H9.8C8.94342 4.00001 8.36113 4.00078 7.91104 4.03756C7.47262 4.07338 7.24842 4.1383 7.09202 4.21799C6.7157 4.40974 6.40973 4.7157 6.21799 5.09202C6.1383 5.24842 6.07337 5.47263 6.03755 5.91104C6.00078 6.36113 6 6.94343 6 7.80001V16.1707C6.31278 16.0602 6.64937 16 7 16H18L18 4.60001C18 4.30348 17.9992 4.14122 17.9897 4.02464C17.9893 4.02 17.9889 4.0156 17.9886 4.01145C17.9844 4.01107 17.98 4.01069 17.9754 4.01031ZM17.657 18H7C6.44772 18 6 18.4477 6 19C6 19.5523 6.44772 20 7 20H17.657C17.5343 19.3301 17.5343 18.6699 17.657 18ZM4 19L4 7.75871C3.99999 6.95374 3.99998 6.28937 4.04419 5.74818C4.09012 5.18608 4.18868 4.66938 4.43597 4.18404C4.81947 3.43139 5.43139 2.81947 6.18404 2.43598C6.66937 2.18869 7.18608 2.09012 7.74818 2.0442C8.28937 1.99998 8.95373 1.99999 9.7587 2L17.4319 2C17.6843 1.99997 17.9301 1.99994 18.1382 2.01695C18.3668 2.03563 18.6366 2.07969 18.908 2.21799C19.2843 2.40974 19.5903 2.7157 19.782 3.09203C19.9203 3.36345 19.9644 3.63318 19.9831 3.86178C20.0001 4.06994 20 4.31574 20 4.56812L20 17C20 17.1325 19.9736 17.2638 19.9225 17.386C19.4458 18.5253 19.4458 19.4747 19.9225 20.614C20.0517 20.9227 20.0179 21.2755 19.8325 21.5541C19.6471 21.8326 19.3346 22 19 22H7C5.34315 22 4 20.6569 4 19Z",fill:"currentColor"})]}),Gx=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),bAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM16.0755 7.93219C16.5272 8.25003 16.6356 8.87383 16.3178 9.32549L11.5678 16.0755C11.3931 16.3237 11.1152 16.4792 10.8123 16.4981C10.5093 16.517 10.2142 16.3973 10.0101 16.1727L7.51006 13.4227C7.13855 13.014 7.16867 12.3816 7.57733 12.0101C7.98598 11.6386 8.61843 11.6687 8.98994 12.0773L10.6504 13.9039L14.6822 8.17451C15 7.72284 15.6238 7.61436 16.0755 7.93219Z",fill:"currentColor"})}),mnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 9",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"})}),gnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",clipRule:"evenodd"})}),bnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})}),XU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 6C12.5523 6 13 6.44772 13 7V12C13 12.2652 12.8946 12.5196 12.7071 12.7071L10.2071 15.2071C9.81658 15.5976 9.18342 15.5976 8.79289 15.2071C8.40237 14.8166 8.40237 14.1834 8.79289 13.7929L11 11.5858V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),ynt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12.659 9.753a1 1 0 0 1-1.318 0l-4-3.5A1 1 0 1 1 8.66 4.747L12 7.671l3.341-2.924a1 1 0 1 1 1.318 1.506l-4 3.5Zm-4.002 9.501a1 1 0 1 1-1.314-1.508l4-3.485a1 1 0 0 1 1.314 0l4 3.485a1 1 0 1 1-1.314 1.508L12 16.34l-3.343 2.913Z"})}),YU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),vnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),xnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z"})}),wnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 10 16",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"})}),Ont=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),knt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M12 7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8h-3a1 1 0 0 1-1-1Zm-5 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),Snt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),Ent=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M14.4472 7.10558C14.9412 7.35257 15.1414 7.95324 14.8944 8.44722L10.8944 16.4472C10.6474 16.9412 10.0468 17.1414 9.55279 16.8944C9.05881 16.6474 8.85858 16.0468 9.10557 15.5528L13.1056 7.55279C13.3526 7.05881 13.9532 6.85859 14.4472 7.10558ZM6.6 7.20001C7.04183 7.53138 7.13137 8.15818 6.8 8.60001L4.25 12L6.8 15.4C7.13137 15.8418 7.04183 16.4686 6.6 16.8C6.15817 17.1314 5.53137 17.0418 5.2 16.6L2.2 12.6C1.93333 12.2444 1.93333 11.7556 2.2 11.4L5.2 7.40001C5.53137 6.95818 6.15817 6.86863 6.6 7.20001ZM17.4 7.20001C17.8418 6.86863 18.4686 6.95818 18.8 7.40001L21.8 11.4C22.0667 11.7556 22.0667 12.2444 21.8 12.6L18.8 16.6C18.4686 17.0418 17.8418 17.1314 17.4 16.8C16.9582 16.4686 16.8686 15.8418 17.2 15.4L19.75 12L17.2 8.60001C16.8686 8.15818 16.9582 7.53138 17.4 7.20001Z",fill:"currentColor"})}),yAe=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z"}),a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z",clipRule:"evenodd"})]}),Cnt=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M7.79289 9.04289C8.18342 8.65237 8.81658 8.65237 9.20711 9.04289L11.4571 11.2929C11.8476 11.6834 11.8476 12.3166 11.4571 12.7071L9.20711 14.9571C8.81658 15.3476 8.18342 15.3476 7.79289 14.9571C7.40237 14.5666 7.40237 13.9334 7.79289 13.5429L9.33579 12L7.79289 10.4571C7.40237 10.0666 7.40237 9.43342 7.79289 9.04289ZM12.25 14.25C12.25 13.6977 12.6977 13.25 13.25 13.25H15.5C16.0523 13.25 16.5 13.6977 16.5 14.25C16.5 14.8023 16.0523 15.25 15.5 15.25H13.25C12.6977 15.25 12.25 14.8023 12.25 14.25Z",fill:"currentColor"}),a.jsx("path",{d:"M2 8C2 5.79086 3.79086 4 6 4C6.55228 4 7 4.44772 7 5C7 5.55228 6.55228 6 6 6C4.89543 6 4 6.89543 4 8V16C4 17.1046 4.89543 18 6 18C6.55228 18 7 18.4477 7 19C7 19.5523 6.55228 20 6 20C3.79086 20 2 18.2091 2 16V8ZM17 5C17 4.44772 17.4477 4 18 4C20.2091 4 22 5.79086 22 8V16C22 18.2091 20.2091 20 18 20C17.4477 20 17 19.5523 17 19C17 18.4477 17.4477 18 18 18C19.1046 18 20 17.1046 20 16V8C20 6.89543 19.1046 6 18 6C17.4477 6 17 5.55228 17 5Z",fill:"currentColor"})]}),Tnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),Ant=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M12.75 9.50001C12.75 9.08579 13.0858 8.75001 13.5 8.75001H14.5C14.9142 8.75001 15.25 9.08579 15.25 9.50001V14.5C15.25 14.9142 14.9142 15.25 14.5 15.25H13.5C13.0858 15.25 12.75 14.9142 12.75 14.5V9.50001Z",fill:"currentColor"}),a.jsx("path",{d:"M9.50001 8.75001C9.08579 8.75001 8.75001 9.08579 8.75001 9.50001V14.5C8.75001 14.9142 9.08579 15.25 9.50001 15.25H10.5C10.9142 15.25 11.25 14.9142 11.25 14.5V9.50001C11.25 9.08579 10.9142 8.75001 10.5 8.75001H9.50001Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.97144 12C1.97144 6.46138 6.46138 1.97144 12 1.97144C17.5386 1.97144 22.0286 6.46138 22.0286 12C22.0286 17.5386 17.5386 22.0286 12 22.0286C6.46138 22.0286 1.97144 17.5386 1.97144 12ZM12 4.02858C7.59751 4.02858 4.02858 7.59751 4.02858 12C4.02858 16.4025 7.59751 19.9714 12 19.9714C16.4025 19.9714 19.9714 16.4025 19.9714 12C19.9714 7.59751 16.4025 4.02858 12 4.02858Z",fill:"currentColor"})]}),PY=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M9.5 9.33165V14.6683C9.5 15.4595 10.3752 15.9373 11.0408 15.5095L15.1915 12.8412C15.8038 12.4475 15.8038 11.5524 15.1915 11.1588L11.0408 8.49047C10.3752 8.06265 9.5 8.54049 9.5 9.33165Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z",fill:"currentColor"})]}),_nt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M8 16.7229V7.27711C8 6.29075 9.08894 5.69298 9.9211 6.22254L17.3428 10.9454C18.1147 11.4366 18.1147 12.5634 17.3428 13.0546L9.92109 17.7775C9.08894 18.3071 8 17.7093 8 16.7229Z",fill:"currentColor"})}),vAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),xAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 3C12.5523 3 13 3.44772 13 4L13 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13L13 13L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 13L4 13C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11L11 11L11 4C11 3.44772 11.4477 3 12 3Z",fill:"currentColor"})}),jnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),Nnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.875 4.5C7.35418 4.5 4.5 7.35418 4.5 10.875C4.5 14.3958 7.35418 17.25 10.875 17.25C14.3958 17.25 17.25 14.3958 17.25 10.875C17.25 7.35418 14.3958 4.5 10.875 4.5ZM2.5 10.875C2.5 6.24962 6.24962 2.5 10.875 2.5C15.5004 2.5 19.25 6.24962 19.25 10.875C19.25 12.8273 18.582 14.6236 17.462 16.0478L21.2071 19.7929C21.5976 20.1834 21.5976 20.8166 21.2071 21.2071C20.8166 21.5976 20.1834 21.5976 19.7929 21.2071L16.0478 17.462C14.6236 18.582 12.8273 19.25 10.875 19.25C6.24962 19.25 2.5 15.5004 2.5 10.875Z",fill:"currentColor"})}),Rnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),Int=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M6 8C6 6.89543 6.89543 6 8 6H16C17.1046 6 18 6.89543 18 8V16C18 17.1046 17.1046 18 16 18H8C6.89543 18 6 17.1046 6 16V8Z",fill:"currentColor"})}),Pnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M14.5 4a5.5 5.5 0 0 0-5.078 7.616 1 1 0 0 1-.216 1.092l-4.749 4.75a1.475 1.475 0 0 0 2.086 2.085l4.749-4.749a1 1 0 0 1 1.092-.216A5.5 5.5 0 0 0 20 9.414l-1.293 1.293a3.828 3.828 0 1 1-5.414-5.414L14.585 4H14.5ZM7 9.5a7.5 7.5 0 0 1 9.969-7.084 1 1 0 0 1 .378 1.651l-2.64 2.64a1.829 1.829 0 0 0 2.586 2.586l2.64-2.64a1 1 0 0 1 1.651.378 7.5 7.5 0 0 1-9.328 9.627l-4.299 4.3a3.475 3.475 0 0 1-4.914-4.915l4.299-4.299A7.497 7.497 0 0 1 7 9.5Z"})}),j_=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})}),Dnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5555 4C10.099 4 9.70052 4.30906 9.58693 4.75114L9.29382 5.8919H14.715L14.4219 4.75114C14.3083 4.30906 13.9098 4 13.4533 4H10.5555ZM16.7799 5.8919L16.3589 4.25342C16.0182 2.92719 14.8226 2 13.4533 2H10.5555C9.18616 2 7.99062 2.92719 7.64985 4.25342L7.22886 5.8919H4C3.44772 5.8919 3 6.33961 3 6.8919C3 7.44418 3.44772 7.8919 4 7.8919H4.10069L5.31544 19.3172C5.47763 20.8427 6.76455 22 8.29863 22H15.7014C17.2354 22 18.5224 20.8427 18.6846 19.3172L19.8993 7.8919H20C20.5523 7.8919 21 7.44418 21 6.8919C21 6.33961 20.5523 5.8919 20 5.8919H16.7799ZM17.888 7.8919H6.11196L7.30423 19.1057C7.3583 19.6142 7.78727 20 8.29863 20H15.7014C16.2127 20 16.6417 19.6142 16.6958 19.1057L17.888 7.8919ZM10 10C10.5523 10 11 10.4477 11 11V16C11 16.5523 10.5523 17 10 17C9.44772 17 9 16.5523 9 16V11C9 10.4477 9.44772 10 10 10ZM14 10C14.5523 10 15 10.4477 15 11V16C15 16.5523 14.5523 17 14 17C13.4477 17 13 16.5523 13 16V11C13 10.4477 13.4477 10 14 10Z"})}),Mnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M7.5 5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM3 7.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM17 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Zm-8.96 8.247C3.137 17.048 2.5 18.271 2.5 20a1 1 0 1 1-2 0c0-2.271.862-4.049 2.21-5.248C4.042 13.57 5.788 13 7.5 13s3.459.57 4.79 1.752c1.348 1.2 2.21 2.977 2.21 5.248a1 1 0 1 1-2 0c0-1.729-.638-2.952-1.54-3.753C10.042 15.43 8.788 15 7.5 15s-2.541.43-3.46 1.247Zm15.757-.607c-1.009-.638-2.338-.807-3.526-.472a1 1 0 0 1-.542-1.925c1.695-.478 3.616-.255 5.136.706 1.558.984 2.635 2.707 2.635 5.051a1 1 0 1 1-2 0c0-1.665-.732-2.746-1.703-3.36Z",clipRule:"evenodd"})}),wAe=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M10.42 2.006a4 4 0 0 1 3.159 0c.674.29 1.188.822 1.667 1.456.474.627 1 1.473 1.653 2.523l3.542 5.696c.72 1.16 1.3 2.09 1.682 2.854.384.766.654 1.517.59 2.292a4 4 0 0 1-1.604 2.886c-.625.463-1.405.63-2.258.709-.85.078-1.945.078-3.311.078H8.46c-1.366 0-2.46 0-3.31-.078-.854-.078-1.634-.246-2.26-.71a4 4 0 0 1-1.603-2.885c-.064-.775.206-1.526.59-2.292.383-.764.961-1.694 1.682-2.854l3.542-5.696c.653-1.05 1.18-1.896 1.653-2.523.48-.634.993-1.166 1.667-1.456Zm2.37 1.838a2 2 0 0 0-1.58 0c-.192.083-.448.28-.86.825-.413.544-.891 1.312-1.577 2.415l-3.488 5.61c-.755 1.214-1.283 2.066-1.62 2.737-.34.678-.402 1.02-.385 1.232a2 2 0 0 0 .802 1.443c.171.127.494.255 1.25.324.748.069 1.75.07 3.18.07h6.976c1.43 0 2.432-.001 3.18-.07.756-.069 1.079-.197 1.25-.324a2 2 0 0 0 .802-1.443c.017-.212-.045-.554-.385-1.232-.337-.671-.865-1.523-1.62-2.737l-3.488-5.61c-.686-1.103-1.164-1.87-1.576-2.415-.413-.546-.67-.742-.861-.825"}),a.jsx("path",{d:"M12 7.5a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0v-3a1 1 0 0 1 1-1M10.851 15a1.15 1.15 0 1 1 2.3 0 1.15 1.15 0 0 1-2.3 0"})]}),ZU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M5.636 5.636a1 1 0 0 1 1.414 0l4.95 4.95 4.95-4.95a1 1 0 0 1 1.414 1.414L13.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414L12 13.414l-4.95 4.95a1 1 0 0 1-1.414-1.414l4.95-4.95-4.95-4.95a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})});/** + */var FI=p,CZe=JR;function TZe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var AZe=typeof Object.is=="function"?Object.is:TZe,_Ze=CZe.useSyncExternalStore,jZe=FI.useRef,NZe=FI.useEffect,RZe=FI.useMemo,IZe=FI.useDebugValue;BCe.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=jZe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=RZe(function(){function c(m){if(!u){if(u=!0,d=m,m=i(m),r!==void 0&&o.hasValue){var g=o.value;if(r(g,m))return f=g}return f=m}if(g=f,AZe(d,m))return g;var b=i(m);return r!==void 0&&r(g,b)?(d=m,g):(d=m,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,i,r]);var l=_Ze(e,s[0],s[1]);return NZe(function(){o.hasValue=!0,o.value=l},[l]),IZe(l),l};FCe.exports=BCe;var UCe=FCe.exports;const PZe=Ew(UCe),DZe=parseInt(p.version,10);function EU(e){return DZe>=e}const MZe=EU(19),LZe=MZe?FZe:BZe;function QCe(e,t,n,i,r){return LZe(e,t,n,i,r)}function $Ze(e,t,n,i,r){const s=p.useCallback(()=>t(e.getSnapshot(),n,i,r),[e,t,n,i,r]);return JR.useSyncExternalStore(e.subscribe,s,s)}function FZe(e,t,n,i,r){return $Ze(e,t,n,i,r)}function BZe(e,t,n,i,r){return UCe.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,i,r))}class UZe{constructor(t){rn(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));rn(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const i of this.listeners){if(n!==this.updateTick)return;i(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,i,r){return QCe(this,t,n,i,r)}}const CU={...Py},jL=CU.useInsertionEffect,QZe=jL&&jL!==CU.useLayoutEffect?jL:e=>e();function Wn(e){const t=Ku(zZe).current;return t.next=e,QZe(t.effect),t.trampoline}function zZe(){const e={next:void 0,callback:VZe,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function VZe(){}class BI extends UZe{constructor(t,n={},i){super(t),this.context=n,this.selectors=i}useSyncedValue(t,n){p.useDebugValue(t);const i=this;Un(()=>{i.state[t]!==n&&i.set(t,n)},[i,t,n])}useSyncedValueWithCleanup(t,n){const i=this;Un(()=>(i.state[t]!==n&&i.set(t,n),()=>{i.set(t,void 0)}),[i,t,n])}useSyncedValues(t){const n=this,i=Object.values(t);Un(()=>{n.update(t)},[n,...i])}useControlledProp(t,n){p.useDebugValue(t);const i=this,r=n!==void 0;Un(()=>{r&&!Object.is(i.state[t],n)&&i.setState({...i.state,[t]:n})},[i,t,n,r])}select(t,n,i,r){const s=this.selectors[t];return s(this.state,n,i,r)}useState(t,n,i,r){return p.useDebugValue(t),QCe(this,this.selectors[t],n,i,r)}useContextCallback(t,n){p.useDebugValue(t);const i=Wn(n??kU);this.context[t]=i}useStateSetter(t){const n=p.useRef(void 0);return n.current===void 0&&(n.current=i=>{this.set(t,i)}),n.current}observe(t,n){let i;typeof t=="function"?i=t:i=this.selectors[t];let r=i(this.state);return n(r,r,this),this.subscribe(s=>{const o=i(s);if(!Object.is(r,o)){const l=r;r=o,n(o,l,this)}})}}function UI(){return typeof window<"u"}function $a(e){return TU(e)?(e.nodeName||"").toLowerCase():"#document"}function Fs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Sp(e){var t;return(t=(TU(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function TU(e){return UI()?e instanceof Node||e instanceof Fs(e).Node:!1}function ur(e){return UI()?e instanceof Element||e instanceof Fs(e).Element:!1}function Ls(e){return UI()?e instanceof HTMLElement||e instanceof Fs(e).HTMLElement:!1}function qx(e){return!UI()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fs(e).ShadowRoot}function hC(e){const{overflow:t,overflowX:n,overflowY:i,display:r}=au(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&r!=="inline"&&r!=="contents"}function HZe(e){return/^(table|td|th)$/.test($a(e))}function QI(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const qZe=/transform|translate|scale|rotate|perspective|filter/,WZe=/paint|layout|strict|content/,Zg=e=>!!e&&e!=="none";let NL;function AU(e){const t=ur(e)?au(e):e;return Zg(t.transform)||Zg(t.translate)||Zg(t.scale)||Zg(t.rotate)||Zg(t.perspective)||!_U()&&(Zg(t.backdropFilter)||Zg(t.filter))||qZe.test(t.willChange||"")||WZe.test(t.contain||"")}function KZe(e){let t=tg(e);for(;Ls(t)&&!Bm(t);){if(AU(t))return t;if(QI(t))return null;t=tg(t)}return null}function _U(){return NL==null&&(NL=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),NL}function Bm(e){return/^(html|body|#document)$/.test($a(e))}function au(e){return Fs(e).getComputedStyle(e)}function zI(e){return ur(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tg(e){if($a(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qx(e)&&e.host||Sp(e);return qx(t)?t.host:t}function zCe(e){const t=tg(e);return Bm(t)?(e.ownerDocument||e).body:Ls(t)&&hC(t)?t:zCe(t)}function DS(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zCe(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),o=Fs(r);if(s){const l=Q6(o);return t.concat(o,o.visualViewport||[],hC(r)?r:[],l&&n?DS(l):[])}else return t.concat(r,DS(r,[],n))}function Q6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _f(...e){return()=>{for(let t=0;t{e.removeEventListener(t,n,i)}}const hA=null;let GZe=class{constructor(){rn(this,"callbacks",[]);rn(this,"callbacksCount",0);rn(this,"nextId",1);rn(this,"startId",1);rn(this,"isScheduled",!1);rn(this,"tick",t=>{var r;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let s=0;s=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}},pA=new GZe;class Yl{constructor(){rn(this,"currentId",hA);rn(this,"cancel",()=>{this.currentId!==hA&&(pA.cancel(this.currentId),this.currentId=hA)});rn(this,"disposeEffect",()=>this.cancel)}static create(){return new Yl}static request(t){return pA.request(t)}static cancel(t){return pA.cancel(t)}request(t){this.cancel(),this.currentId=pA.request(()=>{this.currentId=hA,t()})}}function jU(){const e=Ku(Yl.create).current;return $I(e.disposeEffect),e}const Y1=0;class lu{constructor(){rn(this,"currentId",Y1);rn(this,"clear",()=>{this.currentId!==Y1&&(clearTimeout(this.currentId),this.currentId=Y1)});rn(this,"disposeEffect",()=>this.clear)}static create(){return new lu}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Y1,n()},t)}isStarted(){return this.currentId!==Y1}}function fy(){const e=Ku(lu.create).current;return $I(e.disposeEffect),e}let ZX=0;function XZe(e){return ZX+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ZX}`}function RL(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}function YZe(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:ZZe,platform:JZe,maxTouchPoints:eJe}=YZe(),VI=ZZe.toLowerCase(),MS=JZe.toLowerCase(),HI=/^i(os$|p)/.test(MS)||MS==="macintel"&&eJe>1,JX="android",z6=MS===JX||VI.includes(JX),tJe=!HI&&MS.startsWith("mac");MS.startsWith("win");const nJe=tJe||HI;var Uae;const Bw=typeof CSS<"u"&&!!((Uae=CSS.supports)!=null&&Uae.call(CSS,"-webkit-backdrop-filter:none"));!Bw&&VI.includes("firefox");!Bw&&VI.includes("chrom");const iJe=nJe,VCe=/jsdom|happydom/.test(VI),V6="data-base-ui-focusable",HCe="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Gl(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function zn(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&qx(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Yo(e){return"composedPath"in e?e.composedPath()[0]:e.target}function qCe(e,t){if(!ur(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,i]of t.entries())if(zn(i,n))return!i.hasAttribute("data-trigger-disabled");return!1}function IL(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function rJe(e){return e.matches("html,body")}function NU(e){return Ls(e)&&e.matches(HCe)}function sJe(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${HCe}`))!=null}function eY(e){return e?e.getAttribute("role")==="combobox"&&NU(e):!1}function H6(e){if(!e||VCe)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function tY(e){return e?e.hasAttribute(V6)?e:e.querySelector(`[${V6}]`)||e:null}function ng(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>{var s;return[...!n||(s=r.context)!=null&&s.open?[r]:[],...ng(e,r.id,n)]})}function nY(e,t){var r;let n=[],i=(r=e.find(s=>s.id===t))==null?void 0:r.parentId;for(;i;){const s=e.find(o=>o.id===i);i=s==null?void 0:s.parentId,s&&(n=n.concat(s))}return n}function oJe(e){e.preventDefault(),e.stopPropagation()}function aJe(e){return"nativeEvent"in e}function lJe(e){return e.pointerType===""&&e.isTrusted?!0:z6&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function WCe(e){return VCe?!1:!z6&&e.width===0&&e.height===0||z6&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Jv(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function cJe(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const uJe=["top","right","bottom","left"],ig=Math.min,qh=Math.max,cN=Math.round,mA=Math.floor,Wh=e=>({x:e,y:e}),dJe={left:"right",right:"left",bottom:"top",top:"bottom"};function RU(e,t,n){return qh(e,ig(t,n))}function Pf(e,t){return typeof e=="function"?e(t):e}function Qu(e){return e.split("-")[0]}function Ep(e){return e.split("-")[1]}function IU(e){return e==="x"?"y":"x"}function qI(e){return e==="y"?"height":"width"}function Iu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function WI(e){return IU(Iu(e))}function fJe(e,t,n){n===void 0&&(n=!1);const i=Ep(e),r=WI(e),s=qI(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=uN(o)),[o,uN(o)]}function hJe(e){const t=uN(e);return[q6(e),t,q6(t)]}function q6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const iY=["left","right"],rY=["right","left"],pJe=["top","bottom"],mJe=["bottom","top"];function gJe(e,t,n){switch(e){case"top":case"bottom":return n?t?rY:iY:t?iY:rY;case"left":case"right":return t?pJe:mJe;default:return[]}}function bJe(e,t,n,i){const r=Ep(e);let s=gJe(Qu(e),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),t&&(s=s.concat(s.map(q6)))),s}function uN(e){const t=Qu(e);return dJe[t]+e.slice(t.length)}function yJe(e){var t,n,i,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(r=e.left)!=null?r:0}}function PU(e){return typeof e!="number"?yJe(e):{top:e,right:e,bottom:e,left:e}}function dN(e){const{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function vJe(e){return e.visibility==="hidden"||e.visibility==="collapse"}function KCe(e,t=e?au(e):null){return!e||!e.isConnected||!t||vJe(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const xJe='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function wJe(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return qx(n)?n.host:null}function W6(e){for(const t of Array.from(e.children))if($a(t)==="summary")return t;return null}function OJe(e,t){const n=W6(t);return!!n&&(e===n||zn(n,e))}function GCe(e){const t=e?$a(e):"";return e!=null&&e.matches(xJe)&&(t!=="summary"||e.parentElement!=null&&$a(e.parentElement)==="details"&&W6(e.parentElement)===e)&&(t!=="details"||W6(e)==null)&&(t!=="input"||e.type!=="hidden")}function XCe(e){if(!GCe(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=wJe(t)){const n=t!==e,i=$a(t)==="slot";if(t.hasAttribute("inert")||n&&$a(t)==="details"&&!t.open&&!OJe(e,t)||t.hasAttribute("hidden")||!i&&!kJe(t,n))return!1}return!0}function kJe(e,t){const n=au(e);return t?n.display!=="none":KCe(e,n)}function YCe(e){const t=e.tabIndex;if(t<0){const n=$a(e);if(n==="details"||n==="audio"||n==="video"||Ls(e)&&e.isContentEditable)return 0}return t}function PL(e){if($a(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function SJe(e,t){const n=PL(e);if(!n)return!0;const i=t.find(r=>{const s=PL(r);return(s==null?void 0:s.name)===n.name&&s.form===n.form&&s.checked});return i?i===n:t.find(r=>{const s=PL(r);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function ZCe(e){if(Ls(e)&&$a(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ls(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function JCe(e,t){ZCe(e).forEach(n=>{GCe(n)&&t.push(n),JCe(n,t)})}function eTe(e,t,n){ZCe(e).forEach(i=>{Ls(i)&&i.matches(t)&&n.push(i),eTe(i,t,n)})}function DU(e){return XCe(e)&&YCe(e)>=0}function tTe(e){const t=[];return JCe(e,t),t.filter(XCe)}function pC(e){const t=tTe(e);return t.filter(n=>YCe(n)>=0&&SJe(n,t))}function nTe(e,t){const n=pC(e),i=n.length;if(i===0)return;const r=Gl(lr(e)),s=n.indexOf(r),o=s===-1?t===1?0:i-1:s+t;return n[o]}function MU(e){return nTe(lr(e).body,1)||e}function iTe(e){return nTe(lr(e).body,-1)||e}function rTe(e,t){if(!e)return null;const n=pC(lr(e).body),i=n.length;if(i===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+i)%i;return n[s]}function EJe(e){return rTe(e,1)}function CJe(e){return rTe(e,-1)}function ex(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!zn(n,i)}function TJe(e){pC(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function sY(e){const t=[];eTe(e,"[data-tabindex]",t),t.forEach(n=>{const i=n.dataset.tabindex;delete n.dataset.tabindex,i?n.setAttribute("tabindex",i):n.removeAttribute("tabindex")})}function DL(e){const t=new Map;let n=0,i=0;return e.forEach((r,s)=>{const o=r.transitionStatus==="ending";t.set(r.id,{value:r,domIndex:s,visibleIndex:o?-1:n,offsetY:i}),i+=r.height||0,o||(n+=1)}),t}function ML(e,t){let n=0;return e.map(i=>{if(i.transitionStatus==="ending")return i;const r=n>=t;return n+=1,i.limited===r?i:{...i,limited:r}})}const Yd={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>{var n;return(n=e.toastMetadata.get(t))==null?void 0:n.value},toastIndex:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.domIndex)??-1},toastOffsetY:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.offsetY)??0},toastVisibleIndex:(e,t)=>{var n;return((n=e.toastMetadata.get(t))==null?void 0:n.visibleIndex)??-1},focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement};class AJe extends BI{constructor(n){super({...n,toastMetadata:DL(n.toasts)},{},Yd);rn(this,"timers",new Map);rn(this,"areTimersPaused",!1);rn(this,"setViewport",n=>{this.set("viewport",n)});rn(this,"disposeEffect",()=>()=>{this.timers.forEach(n=>{var i;(i=n.timeout)==null||i.clear()}),this.timers.clear()});rn(this,"addToast",n=>{const{timeout:i,limit:r}=this.state,s=n.id||XZe("toast");if(n.id){const u=Yd.toast(this.state,n.id);if(u)if(u.transitionStatus==="ending")this.removeToast(n.id,!0);else{const{id:d,transitionStatus:f,...h}=n;return this.updateToastInternal(n.id,h,!0,!0),n.id}}const o={...n,id:s,updateKey:0,transitionStatus:"starting"},l=[o,...this.state.toasts];this.setToasts(ML(l,r));const c=o.timeout??i;return o.type!=="loading"&&c>0&&this.scheduleTimer(s,c,()=>this.closeToast(s)),Yd.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s});rn(this,"updateToast",(n,i)=>{this.updateToastInternal(n,i,!1,!0)});rn(this,"updateToastInternal",(n,i,r=!1,s=!1)=>{const{timeout:o,toasts:l}=this.state,c=Yd.toast(this.state,n);if(!c||c.transitionStatus==="ending")return;const u={...c,...i,...s&&{updateKey:c.updateKey+1}};this.setToasts(l.map(y=>y.id===n?u:y));const d=u.timeout??o,f=c.timeout??o,h=Object.hasOwn(i,"timeout"),m=u.transitionStatus!=="ending"&&u.type!=="loading"&&d>0,g=this.timers.has(n),b=f!==d,v=c.type==="loading";if(!m&&g){this.clearTimer(n);return}m&&(!g||b||h||v||r)&&(this.clearTimer(n),this.scheduleTimer(n,d,()=>this.closeToast(n)),Yd.expandedOrOutOfFocus(this.state)&&this.pauseTimers())});rn(this,"closeToast",n=>{const i=n===void 0,{limit:r,toasts:s}=this.state;let o;if(i)o=s,this.clearTimers();else{const u=Yd.toast(this.state,n);if(!u)return;o=[u],this.clearTimer(n)}const l=s.map(u=>i||u.id===n?{...u,transitionStatus:"ending",height:0}:u),c=ML(l,r);this.setToasts(c,!c.some(u=>u.transitionStatus!=="ending")),o.forEach(u=>{var d;u.transitionStatus!=="ending"&&((d=u.onClose)==null||d.call(u))}),this.handleFocusManagement(n)});rn(this,"promiseToast",(n,i)=>{const r=RL(i.loading),s=this.addToast({...r,type:"loading"}),o=n.then(l=>{const c=RL(i.success,l);return this.updateToast(s,{...c,type:"success",timeout:c.timeout}),l}).catch(l=>{const c=RL(i.error,l);return this.updateToast(s,{...c,type:"error",timeout:c.timeout}),Promise.reject(l)});return{}.hasOwnProperty.call(i,"setPromise")&&i.setPromise(o),o});rn(this,"handleDocumentPointerDown",n=>{if(n.pointerType!=="touch")return;const i=Yo(n);zn(this.state.viewport,i)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}syncProviderProps(n,i){const r=this.state.limit!==i;if(this.state.timeout===n&&!r)return;const s={timeout:n,limit:i};if(r){const o=ML(this.state.toasts,i);s.toasts=o,s.toastMetadata=DL(o)}this.update(s)}removeToast(n,i=!1){var l;const r=Yd.toastIndex(this.state,n);if(r===-1)return;const s=this.state.toasts[r];i||(l=s==null?void 0:s.onRemove)==null||l.call(s);const o=[...this.state.toasts];o.splice(r,1),this.setToasts(o)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(n=>{n.timeout&&(n.timeout.clear(),n.remaining=Math.max(n.remaining-(Date.now()-n.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((n,i)=>{n.remaining=n.remaining>0?n.remaining:n.delay,n.timeout??(n.timeout=lu.create()),n.timeout.start(n.remaining,()=>{this.handleTimerFired(i),n.callback()}),n.start=Date.now()}))}restoreFocusToPrevElement(){var n;(n=this.state.prevFocusElement)==null||n.focus({preventScroll:!0})}scheduleTimer(n,i,r){const s=Date.now(),l=!Yd.expandedOrOutOfFocus(this.state)?lu.create():void 0;l==null||l.start(i,()=>{this.handleTimerFired(n),r()}),this.timers.set(n,{timeout:l,start:s,delay:i,remaining:i,callback:r})}clearTimers(){this.timers.forEach(n=>{var i;(i=n.timeout)==null||i.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(n){var r;const i=this.timers.get(n);(r=i==null?void 0:i.timeout)==null||r.clear(),this.timers.delete(n),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(n){this.timers.delete(n),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(n,i=n.length===0){const r={toasts:n,toastMetadata:DL(n)};i&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(n){var c,u;const i=Gl(lr(this.state.viewport));if(!this.state.viewport||!zn(this.state.viewport,i)||!H6(i))return;if(n===void 0){this.restoreFocusToPrevElement();return}const r=Yd.toasts(this.state),s=Yd.toastIndex(this.state,n),o=(d,f)=>{for(let h=d;h>=0&&hnew AJe({timeout:i,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return $I(o.disposeEffect),p.useEffect(function(){return s?s[" subscribe"](({action:u,options:d})=>{const f=d.id;u==="promise"&&d.promise?o.promiseToast(d.promise,d):u==="update"&&f?o.updateToast(f,d):u==="close"?o.closeToast(f):o.addToast(d)}):void 0},[o,s]),a.jsxs($Ce.Provider,{value:o,children:[a.jsx(jJe,{store:o,timeout:i,limit:r}),n]})};function jJe(e){const{store:t,timeout:n,limit:i}=e;return Un(()=>{t.syncProviderProps(n,i)},[t,n,i]),null}const NJe={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},sTe={...NJe,position:"fixed",top:0,left:0},hy=p.forwardRef(function(t,n){const[i,r]=p.useState();Un(()=>{iJe&&Bw&&r("button")},[]);const s={tabIndex:0,role:i};return a.jsx("span",{...t,ref:n,style:sTe,"aria-hidden":i?void 0:!0,...s,"data-base-ui-focus-guard":""})});function Wx(e,t,n,i){const r=Ku(oTe).current;return IJe(r,e,t,n,i)&&aTe(r,[e,t,n,i]),r.callback}function RJe(e){const t=Ku(oTe).current;return PJe(t,e)&&aTe(t,e),t.callback}function oTe(){return{callback:null,cleanup:null,refs:[]}}function IJe(e,t,n,i,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==i||e.refs[3]!==r}function PJe(e,t){return e.refs.length!==t.length||e.refs.some((n,i)=>n!==t[i])}function aTe(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const i=Array(t.length).fill(null);for(let r=0;r{for(let r=0;r=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function FU(e){return typeof e=="function"}function uTe(e,t){return FU(e)?e(t):e??LU}function BJe(e,t){return t?e?(...n)=>{const i=n[0];if(hTe(i)){const s=i;hN(s);const o=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),o}const r=t(...n);return e==null||e(...n),r}:dTe(t):e}function dTe(e){return e&&((...t)=>{const n=t[0];return hTe(n)&&hN(n),e(...t)})}function hN(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function fTe(e,t){return t?e?t+" "+e:t:e}function hTe(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Do(e,t,n={}){const i=t.render,r=UJe(t,n);if(n.enabled===!1)return null;const s=n.state??Cl;return VJe(e,i,r,s)}function UJe(e,t={}){const{className:n,style:i,render:r}=e,{state:s=Cl,ref:o,props:l,stateAttributesMapping:c,enabled:u=!0}=t,d=u?MJe(n,s):void 0,f=u?lTe(i,s):void 0,h=u?DJe(s,c):Cl,m=u&&l?QJe(l):void 0,g=u?K6(h,m)??{}:Cl;return typeof document<"u"&&(u?Array.isArray(o)?g.ref=RJe([g.ref,oY(r),...o]):g.ref=Wx(g.ref,oY(r),o):Wx(null,null)),u?(d!==void 0&&(g.className=fTe(g.className,d)),f!==void 0&&(g.style=K6(g.style,f)),g):Cl}function QJe(e){return Array.isArray(e)?LJe(e):$U(void 0,e)}const zJe=Symbol.for("react.lazy");function VJe(e,t,n,i){if(t){if(typeof t=="function")return t(n,i);const r=$U(n,t.props);r.ref=n.ref;let s=t;return(s==null?void 0:s.$$typeof)===zJe&&(s=p.Children.toArray(t)[0]),p.cloneElement(s,r)}if(e&&typeof e=="string")return HJe(e,n);throw new Error(du(8))}function HJe(e,t){return e==="button"?p.createElement("button",{type:"button",...t,key:t.key}):e==="img"?p.createElement("img",{alt:"",...t,key:t.key}):p.createElement(e,t)}const qJe=p.forwardRef(function(t,n){var U;const{render:i,className:r,style:s,children:o,...l}=t,c=SU(),u=fy(),d=p.useRef(!1),f=p.useRef(!1),h=p.useRef(!1),m=c.useState("isEmpty"),g=c.useState("toasts"),b=c.useState("focused"),v=c.useState("expanded"),y=c.useState("prevFocusElement"),x=(U=g[0])==null?void 0:U.height,w=g.some(I=>I.transitionStatus==="ending"),O=g.filter(I=>I.priority==="high");p.useEffect(()=>{const I=c.state.viewport;if(!I||m)return;const H=Fs(I),K=lr(I);function F(X){X.key==="F6"&&Yo(X)!==I&&(X.preventDefault(),c.set("prevFocusElement",Gl(K)),I==null||I.focus({preventScroll:!0}),c.pauseTimers(),c.set("focused",!0))}function W(X){Yo(X)===H&&(c.set("isWindowFocused",!1),c.pauseTimers())}function V(X){if(X.relatedTarget)return;const ie=Yo(X),Q=Gl(lr(I));(ie===H||!zn(I,ie)||!H6(Q))&&c.resumeTimers(),u.start(0,()=>c.set("isWindowFocused",!0))}return _f(mi(H,"keydown",F),mi(H,"blur",W,!0),mi(H,"focus",V,!0),mi(K,"pointerdown",c.handleDocumentPointerDown,!0))},[c,u,m]);function S(I){var K,F;d.current=!0;const H=I.relatedTarget===c.state.viewport?g.find(W=>W.transitionStatus!=="ending"&&!W.limited):void 0;H?(F=(K=H.ref)==null?void 0:K.current)==null||F.focus():c.restoreFocusToPrevElement()}function k(I){I.key==="Tab"&&I.shiftKey&&Yo(I.nativeEvent)===c.state.viewport&&(I.preventDefault(),c.restoreFocusToPrevElement())}function C(){c.state.toasts.some(H=>H.transitionStatus==="ending")||h.current||!f.current||(c.state.isWindowFocused&&c.resumeTimers(),c.set("hovering",!1),f.current=!1)}p.useEffect(C,[w,c]);function E(){c.pauseTimers(),c.set("hovering",!0),f.current=!1}function R(){c.state.isWindowFocused&&c.resumeTimers()}function _(){f.current=!0,C()}function j(I){I.pointerType==="touch"&&(h.current=!0)}function T(I){I.pointerType==="touch"&&(h.current=!1,C())}function N(){if(d.current){d.current=!1;return}b||H6(Gl(lr(c.state.viewport)))&&(c.set("focused",!0),c.pauseTimers())}function A(I){!b||zn(c.state.viewport,I.relatedTarget)||(c.set("focused",!1),R())}const P={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:E,onMouseMove:E,onMouseLeave:_,onFocus:N,onBlur:A,onKeyDown:k,onClick:N,onPointerDown:j,onPointerUp:T,onPointerCancel:T,style:{"--toast-frontmost-height":x?`${x}px`:void 0}},D={expanded:v},M=!m&&y&&a.jsx(hy,{onFocus:S}),L=Do("div",t,{ref:[n,c.setViewport],state:D,props:[P,l,{children:a.jsxs(p.Fragment,{children:[M,o,M]})}]});return a.jsxs(p.Fragment,{children:[M,L,!b&&O.length>0&&a.jsx("div",{style:sTe,children:O.map(I=>a.jsxs("div",{role:"alert","aria-atomic":!0,children:[a.jsx("div",{children:I.title}),a.jsx("div",{children:I.description})]},I.id))})]})});function BU(e){return EU(19)?e:e?"true":void 0}const pTe=p.createContext(void 0);function WJe(){const e=p.useContext(pTe);if(!e)throw new Error(du(66));return e}let pN=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const KJe={"data-starting-style":""},GJe={"data-ending-style":""},KI={transitionStatus(e){return e==="starting"?KJe:e==="ending"?GJe:null}};function mh(e){return e==null?e:"current"in e?e.current:e}function UU(e,t=!1){const n=jU();return Wn((i,r=null)=>{n.cancel();const s=mh(e);if(s==null)return;const o=s,l=()=>{ri.flushSync(i)};if(typeof o.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function c(){Promise.all(o.getAnimations().map(u=>u.finished)).then(()=>{r!=null&&r.aborted||l()},()=>{if(r!=null&&r.aborted)return;if(o.getAnimations().some(d=>d.pending||d.playState!=="finished")){c();return}l()})}if(t){const u="data-starting-style";if(!o.hasAttribute(u)){n.request(c);return}const d=new MutationObserver(()=>{o.hasAttribute(u)||(d.disconnect(),c())});d.observe(o,{attributes:!0,attributeFilter:[u]}),r==null||r.addEventListener("abort",()=>d.disconnect(),{once:!0});return}n.request(c)})}function mC(e){const{enabled:t=!0,open:n,ref:i,onComplete:r}=e,s=Wn(r),o=UU(i,n);p.useEffect(()=>{if(!t)return;const l=new AbortController;return o(s,l.signal),()=>{l.abort()}},[t,n,s,o])}const XJe=500,YJe={style:{transition:"none"}},mTe="data-base-ui-click-trigger",ZJe="data-base-ui-swipe-ignore",JJe="data-swipe-ignore",eet=`[${ZJe}]`,tet=`[${JJe}]`,net={fallbackAxisSide:"end"},iet={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function LL(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function ret(e){const n=Fs(e).getComputedStyle(e).transform;let i=0,r=0,s=1;if(n&&n!=="none"){const o=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const l=o[1].split(", ").map(parseFloat);l.length===6?(i=l[4],r=l[5],s=Math.sqrt(l[0]*l[0]+l[1]*l[1])):l.length===16&&(i=l[12],r=l[13],s=l[0])}}return{x:i,y:r,scale:s}}const set={...KI,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},aY=40,oet=10,lY=.5,aet=1,cet=`${eet},${tet}`,uet=p.forwardRef(function(t,n){var Ve;const{toast:i,render:r,className:s,swipeDirection:o=["down","right"],style:l,...c}=t,u=((Ve=i.positionerProps)==null?void 0:Ve.anchor)!==void 0;let d=[];u||(d=Array.isArray(o)?o:[o]);const f=d.length>0,h=SU(),[m,g]=p.useState(void 0),[b,v]=p.useState(!1),[y,x]=p.useState(!1),[w,O]=p.useState({x:0,y:0}),[S,k]=p.useState({x:0,y:0,scale:1}),[C,E]=p.useState(),[R,_]=p.useState(),[j,T]=p.useState(null),N=p.useRef(null),A=p.useRef(void 0),P=p.useRef({x:0,y:0}),D=p.useRef({x:0,y:0,scale:1}),M=p.useRef(void 0),L=p.useRef(0),U=p.useRef(!1),I=p.useRef({x:0,y:0}),H=p.useRef(!1),K=p.useRef({x:0,y:0}),F=p.useRef(null),W=p.useRef(null),V=h.useState("toastIndex",i.id),X=h.useState("toastVisibleIndex",i.id),ie=h.useState("toastOffsetY",i.id),Q=h.useState("focused"),Z=h.useState("expanded");mC({open:i.transitionStatus!=="ending",ref:N,onComplete(){i.transitionStatus==="ending"&&h.removeToast(i.id)}});const ce=Wn((ve=!1)=>{const Re=N.current;if(!Re)return;const ne=Re.style.height;Re.style.height="auto";const ge=Re.offsetHeight;Re.style.height=ne;function Ce(){h.updateToastInternal(i.id,{ref:N,height:ge,transitionStatus:void 0})}ve?ri.flushSync(Ce):Ce()});Un(()=>{const ve=A.current;i.transitionStatus!=="starting"&&ve===i.id||(ve!==void 0&&(g(void 0),k({x:0,y:0,scale:1}),Ee({x:0,y:0})),A.current=i.id,ce())},[ce,i.id,i.transitionStatus]);function Ee(ve){K.current=ve,O(ve)}Un(()=>()=>{var ve;(ve=W.current)==null||ve.abort()},[]);function Y(ve,Re){const ne=ke=>ke>0?ke**lY:-(Math.abs(ke)**lY),ge=ve>0&&!d.includes("right")||ve<0&&!d.includes("left"),Ce=Re>0&&!d.includes("down")||Re<0&&!d.includes("up");return{x:ge?ne(ve):ve,y:Ce?ne(Re):Re}}const G=Wn(ve=>{var Ke;if(ve.pointerId!==F.current)return;F.current=null,(Ke=W.current)==null||Ke.abort(),W.current=null,v(!1),x(!1),T(null);const Re=D.current;if(ve.type==="pointercancel"||U.current){Ee({x:Re.x,y:Re.y}),g(void 0);return}const ne=K.current,ge=ne.x-Re.x,Ce=ne.y-Re.y;let ke;for(const it of d)if(LL(it,ge,Ce)>aY){ke=it;break}ke?(g(ke),h.closeToast(i.id)):(Ee({x:Re.x,y:Re.y}),g(void 0))});function te(ve){var it,ue;if(ve.button!==0)return;ve.pointerType==="touch"&&h.pauseTimers();const Re=Yo(ve.nativeEvent);if(Re==null?void 0:Re.closest(`button,a,input,textarea,[role="button"],${cet}`))return;U.current=!1,M.current=void 0,L.current=0,F.current=ve.pointerId,P.current={x:ve.clientX,y:ve.clientY},I.current=P.current;const ge=ve.currentTarget,Ce=ret(ge);D.current=Ce,k(Ce),Ee({x:Ce.x,y:Ce.y}),h.set("hovering",!0),v(!0),x(!1),T(null),H.current=!0,(it=W.current)==null||it.abort();const ke=new AbortController;W.current=ke;const Ke=lr(ge);Ke.addEventListener("pointerup",G,{signal:ke.signal}),Ke.addEventListener("pointercancel",G,{signal:ke.signal}),(ue=ge.setPointerCapture)==null||ue.call(ge,ve.pointerId)}function ye(ve){if(ve.pointerId!==F.current)return;ve.preventDefault(),H.current&&(P.current={x:ve.clientX,y:ve.clientY},H.current=!1);const{clientY:Re,clientX:ne,movementX:ge,movementY:Ce}=ve;(Ce<0&&Re>I.current.y||Ce>0&&ReI.current.x||ge>0&&ne=aet){x(!0);const Ct=d.includes("left")||d.includes("right"),dt=d.includes("up")||d.includes("down");if(Ct&&dt){const yt=Math.abs(ke),Ie=Math.abs(Ke);xe=yt>Ie?"horizontal":"vertical",T(xe)}}let Te;if(!M.current)xe==="vertical"?Ke>0?Te="down":Ke<0&&(Te="up"):xe==="horizontal"?ke>0?Te="right":ke<0&&(Te="left"):Math.abs(ke)>=Math.abs(Ke)?Te=ke>0?"right":"left":Te=Ke>0?"down":"up",Te&&d.includes(Te)&&(M.current=Te,L.current=LL(Te,ke,Ke),g(Te));else{const Ot=M.current,Ct=LL(Ot,ue,it);Ct>aY?(U.current=!1,g(Ot)):!(d.includes("left")&&d.includes("right"))&&!(d.includes("up")&&d.includes("down"))&&L.current-Ct>=oet&&(U.current=!0)}const qe=Y(ke,Ke);let De=D.current.x,At=D.current.y;const It=d.includes("left")||d.includes("right"),lt=d.includes("up")||d.includes("down");xe!=="vertical"&&It&&(De+=qe.x),xe!=="horizontal"&<&&(At+=qe.y),Ee({x:De,y:At})}function Ne(ve){if(ve.key==="Escape"){if(!N.current||!zn(N.current,Gl(lr(N.current))))return;h.closeToast(i.id)}}p.useEffect(()=>{const ve=N.current;if(!f||!ve)return;function Re(ne){F.current===null||!zn(ve,Yo(ne))||ne.preventDefault()}return mi(ve,"touchmove",Re,{passive:!1})},[f]);function pe(){const ve=w.x-S.x,Re=w.y-S.y;return{transition:b?"none":void 0,transform:b?`translateX(${w.x}px) translateY(${w.y}px) scale(${S.scale})`:void 0,"--toast-swipe-movement-x":`${ve}px`,"--toast-swipe-movement-y":`${Re}px`}}const me=i.priority==="high",se={role:me?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":R,"aria-hidden":me&&!Q?!0:void 0,onPointerDown:f?te:void 0,onPointerMove:f?ye:void 0,onPointerUp:f?G:void 0,onPointerCancel:f?G:void 0,onKeyDown:Ne,inert:BU(i.limited),style:{...pe(),"--toast-index":i.transitionStatus==="ending"?V:X,"--toast-offset-y":`${ie}px`,"--toast-height":i.height?`${i.height}px`:void 0}},Se=p.useMemo(()=>({toast:i,setTitleId:E,setDescriptionId:_,recalculateHeight:ce,visibleIndex:X,expanded:Z}),[i,E,_,ce,X,Z]),Le={transitionStatus:i.transitionStatus,expanded:Z,limited:i.limited||!1,type:i.type,swiping:b,swipeDirection:m},be=Do("div",t,{ref:[n,N],state:Le,stateAttributesMapping:set,props:[se,c]});return a.jsx(pTe.Provider,{value:Se,children:be})});let cY=0;function det(e,t="mui"){const[n,i]=p.useState(e),r=e||n;return p.useEffect(()=>{n==null&&(cY+=1,i(`${t}-${cY}`))},[n,t]),r}const uY=CU.useId;function gC(e,t){if(uY!==void 0){const n=uY();return e??(t?`${t}-${n}`:n)}return det(e,t)}function gTe(e){return e==null||typeof e=="boolean"||e===""?!1:Array.isArray(e)?e.some(gTe):!0}function fet(e){return p.isValidElement(e)&&gTe(e.props.children)}function bTe(e,t,n){const{toast:i,setTitleId:r,setDescriptionId:s}=WJe(),o=n==="title"?r:s,l=t??(n==="title"?i.title:i.description);return{id:gC(e),children:l,type:i.type,setId:o}}function yTe(e,t,n){const i=fet(e);return Un(()=>{if(i)return n(t),()=>{n(r=>r===t?void 0:r)}},[i,t,n]),i?e:null}const het=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,children:l,...c}=t,{id:u,children:d,type:f,setId:h}=bTe(o,l,"description"),g=Do("p",t,{ref:n,state:{type:f},props:{...c,id:u,children:d}});return yTe(g,u,h)}),pet=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,children:l,...c}=t,{id:u,children:d,type:f,setId:h}=bTe(o,l,"title"),g=Do("h2",t,{ref:n,state:{type:f},props:{...c,id:u,children:d}});return yTe(g,u,h)}),met=p.createContext(void 0);function get(e=!1){const t=p.useContext(met);if(t===void 0&&!e)throw new Error(du(16));return t}function bet(e){const{focusableWhenDisabled:t,disabled:n,composite:i=!1,tabIndex:r=0,isNativeButton:s}=e,o=i&&t!==!1,l=i&&t===!1;return{props:p.useMemo(()=>{const u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return i||(u.tabIndex=r,!s&&n&&(u.tabIndex=t?r:-1)),(s&&(t||o)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||l)&&(u.disabled=n),u},[i,n,t,o,l,s,r])}}function $L(e,t,{detail:n=0}={}){e.dispatchEvent(new(Fs(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function QU(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:i=0,native:r=!0,composite:s}=e,o=p.useRef(null),l=get(!0),c=s??l!==void 0,{props:u}=bet({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:i,isNativeButton:r}),d=p.useCallback(()=>{const m=o.current;FL(m)&&c&&t&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,u.disabled,c]);Un(d,[d]);const f=p.useCallback((m={})=>{const{onClick:g,onMouseDown:b,onKeyUp:v,onKeyDown:y,onPointerDown:x,...w}=m;return $U({onClick(O){if(t){O.preventDefault();return}g==null||g(O)},onMouseDown(O){t||b==null||b(O)},onKeyDown(O){if(t||(hN(O),y==null||y(O),O.baseUIHandlerPrevented))return;const S=O.target===O.currentTarget,k=O.currentTarget,C=FL(k),E=!r&&yet(k),R=S&&(r?C:!E),_=O.key==="Enter",j=O.key===" ",T=k.getAttribute("role"),N=(T==null?void 0:T.startsWith("menuitem"))||T==="option"||T==="gridcell";if(S&&c&&j){if(O.defaultPrevented&&N)return;O.preventDefault(),(!r||C)&&(O.preventBaseUIHandler(),$L(k,O));return}if(!R||r||!j&&!_){S&&E&&j&&O.preventDefault();return}O.defaultPrevented||(O.preventDefault(),_&&(O.preventBaseUIHandler(),$L(k,O)))},onKeyUp(O){if(!t){if(hN(O),v==null||v(O),O.target===O.currentTarget&&r&&c&&FL(O.currentTarget)&&O.key===" "){O.preventDefault();return}O.baseUIHandlerPrevented||O.target===O.currentTarget&&!r&&!c&&!O.defaultPrevented&&O.key===" "&&(O.preventBaseUIHandler(),$L(O.currentTarget,O))}},onPointerDown(O){if(t){O.preventDefault();return}x==null||x(O)}},r?{type:"button"}:{role:"button"},u,w)},[t,u,c,r]),h=Wn(m=>{o.current=m,d()});return{getButtonProps:f,buttonRef:h}}function FL(e){return Ls(e)&&e.tagName==="BUTTON"}function yet(e){return Ls(e)&&e.tagName==="A"&&!!e.href}const vTe="none",Kx="trigger-press",Bc="trigger-hover",xTe="outside-press",wTe="close-press",LS="focus-out",OTe="escape-key",kTe="imperative-action";function Gs(e,t,n,i){let r=!1,s=!1;const o=Cl;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...o}}function mN(e){return`data-base-ui-${e}`}const STe=p.createContext(null),ETe=()=>p.useContext(STe),vet=mN("portal");function CTe(e={}){const{ref:t,container:n,componentProps:i=Cl,elementProps:r}=e,s=gC(),o=ETe(),l=o==null?void 0:o.portalNode,[c,u]=p.useState(null),[d,f]=p.useState(null),h=Wn(v=>{v!==null&&f(v)}),m=p.useRef(null);Un(()=>{if(n===null){m.current&&(m.current=null,f(null),u(null));return}const v=(n&&(TU(n)?n:n.current))??l??document.body;if(v==null){m.current&&(m.current=null,f(null),u(null));return}m.current!==v&&(m.current=v,f(null),u(v))},[n,l]);const g=Do("div",i,{ref:[t,h],props:[{id:s,[vet]:""},r]}),b=c&&g?ri.createPortal(g,c):null;return{node:d,nodeId:p.isValidElement(g)?g.props.id:void 0,subtree:b}}const TTe=p.forwardRef(function(t,n){const{render:i,className:r,style:s,children:o,container:l,...c}=t,{node:u,nodeId:d,subtree:f}=CTe({container:l,ref:n,componentProps:t,elementProps:c}),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=p.useRef(null),[v,y]=p.useState(null),x=p.useRef(!1),w=v==null?void 0:v.modal,O=v==null?void 0:v.open,S=!!v&&!v.modal&&v.open&&!!u;p.useEffect(()=>{if(!u||w)return;function C(E){u&&E.relatedTarget&&ex(E)&&(E.type==="focusin"?x.current&&(sY(u),x.current=!1):(TJe(u),x.current=!0))}return _f(mi(u,"focusin",C,!0),mi(u,"focusout",C,!0))},[u,w]),Un(()=>{!u||O!==!0||!x.current||(sY(u),x.current=!1)},[O,u]);const k=p.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:m,beforeInsideRef:g,afterInsideRef:b,portalNode:u,setFocusManagerState:y}),[u]);return a.jsxs(p.Fragment,{children:[f,a.jsxs(STe.Provider,{value:k,children:[S&&u&&a.jsx(hy,{"data-type":"outside",ref:h,onFocus:C=>{var E;if(ex(C,u))(E=g.current)==null||E.focus();else{const R=v?v.domReference:null,_=iTe(R);_==null||_.focus()}}}),S&&u&&a.jsx("span",{"aria-owns":d,style:iet}),u&&ri.createPortal(o,u),S&&u&&a.jsx(hy,{"data-type":"outside",ref:m,onFocus:C=>{var E;if(ex(C,u))(E=b.current)==null||E.focus();else{const R=v?v.domReference:null,_=MU(R);_==null||_.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,Gs(LS,C.nativeEvent)))}}})]})]})}),xet=p.forwardRef(function(t,n){const{children:i,container:r,className:s,render:o,style:l,...c}=t,{node:u,subtree:d}=CTe({container:r,ref:n,componentProps:t,elementProps:c});return!d&&!u?null:a.jsxs(p.Fragment,{children:[d,u&&ri.createPortal(i,u)]})}),wet=p.forwardRef(function(t,n){return a.jsx(xet,{ref:n,...t})});function Ol(e){const t=Ku(Oet,e).current;return t.next=e,Un(t.effect),t}function Oet(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ket(e,t){return t!=null&&!Jv(t)?0:typeof e=="function"?e():e}function G6(e,t,n){const i=ket(e,n);return typeof i=="number"?i:i==null?void 0:i[t]}function dY(e){return typeof e=="function"?e():e}function ATe(e,t){return t||e==="click"||e==="mousedown"}function Eet(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}let gA=0;function BL(e,t={}){const{preventScroll:n=!1,sync:i=!1,shouldFocus:r}=t;cancelAnimationFrame(gA);function s(){r&&!r()||e==null||e.focus({preventScroll:n})}if(i)return s(),kU;const o=requestAnimationFrame(s);return gA=o,()=>{gA===o&&(cancelAnimationFrame(o),gA=0)}}const UL={inert:new WeakMap,"aria-hidden":new WeakMap},fY="data-base-ui-inert",X6={inert:new WeakSet,"aria-hidden":new WeakSet};let Z1=new WeakMap,QL=0;function Cet(e){return X6[e]}function _Te(e){return e?qx(e)?e.host:_Te(e.parentNode):null}const hY=(e,t)=>t.map(n=>{if(e.contains(n))return n;const i=_Te(n);return e.contains(i)?i:null}).filter(n=>n!=null),pY=e=>{const t=new Set;return e.forEach(n=>{let i=n;for(;i&&!t.has(i);)t.add(i),i=i.parentNode}),t},mY=(e,t,n)=>{const i=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(o=>{$a(o)!=="script"&&(t.has(o)?r(o):i.push(o))})};return r(e),i};function Tet(e,t,n,i,{mark:r=!0}){let s=null;i?s="inert":n&&(s="aria-hidden");let o=null,l=null;const c=hY(t,e),u=r?mY(t,pY(c),new Set(c)):[],d=[],f=[];if(s){const h=UL[s],m=Cet(s);l=m,o=h;const g=hY(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(g);mY(t,pY(b),new Set(b)).forEach(y=>{const x=y.getAttribute(s),w=x!==null&&x!=="false",O=(h.get(y)||0)+1;h.set(y,O),d.push(y),O===1&&w&&m.add(y),w||y.setAttribute(s,s==="inert"?"":"true")})}return r&&u.forEach(h=>{const m=(Z1.get(h)||0)+1;Z1.set(h,m),f.push(h),m===1&&h.setAttribute(fY,"")}),QL+=1,()=>{o&&d.forEach(h=>{const g=(o.get(h)||0)-1;o.set(h,g),g||(!(l!=null&&l.has(h))&&s&&h.removeAttribute(s),l==null||l.delete(h))}),r&&f.forEach(h=>{const m=(Z1.get(h)||0)-1;Z1.set(h,m),m||h.removeAttribute(fY)}),QL-=1,QL||(UL.inert=new WeakMap,UL["aria-hidden"]=new WeakMap,X6.inert=new WeakSet,X6["aria-hidden"]=new WeakSet,Z1=new WeakMap)}}function gY(e,t={}){const{ariaHidden:n=!1,inert:i=!1,mark:r=!0}=t,s=lr(e[0]).body;return Tet(e,s,n,i,{mark:r})}function jTe(){const e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}class Aet{constructor(){rn(this,"nodesRef",{current:[]});rn(this,"events",jTe())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(i=>i===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const NTe=p.createContext(null),RTe=p.createContext(null),GI=()=>{var e;return((e=p.useContext(NTe))==null?void 0:e.id)||null},Uw=e=>{const t=p.useContext(RTe);return e??t};function _et(e){const t=gC(),n=Uw(e),i=GI();return Un(()=>{if(!t)return;const r={id:t,parentId:i};return n==null||n.addNode(r),()=>{n==null||n.removeNode(r)}},[n,t,i]),t}function jet(e){const{children:t,id:n}=e,i=GI();return a.jsx(NTe.Provider,{value:p.useMemo(()=>({id:n,parentId:i}),[n,i]),children:t})}function Net(e){const{children:t,externalTree:n}=e,i=Ku(()=>n??new Aet).current;return a.jsx(RTe.Provider,{value:i,children:t})}function Ret(e,t){const n=Fs(Yo(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const bY=20;let Sm=[];function zU(){Sm=Sm.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function yY(e){zU(),e&&$a(e)!=="body"&&(Sm.push(new WeakRef(e)),Sm.length>bY&&(Sm=Sm.slice(-bY)))}function vY(){var e;return zU(),(e=Sm[Sm.length-1])==null?void 0:e.deref()}function Iet(e){return e?DU(e)?e:pC(e)[0]||e:null}function xY(e){var r;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((r=e.getAttribute("role"))!=null&&r.includes("dialog")))return;const n=tTe(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return DU(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),i=e.getAttribute("tabindex");n.length===0?i!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ITe(e){const{context:t,children:n,disabled:i=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:o=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:h,externalTree:m,getInsideElements:g}=e,b="rootStore"in t?t.rootStore:t,v=b.useState("open"),y=b.useState("domReferenceElement"),x=b.useState("floatingElement"),{events:w,dataRef:O}=b.context,S=Wn(()=>{var Y;return(Y=O.current.floatingContext)==null?void 0:Y.nodeId}),k=r===!1,C=eY(y)&&k,E=Ol(r),R=Ol(s),_=Ol(u),j=Ol(v),T=Uw(m),N=ETe(),A=p.useRef(!1),P=p.useRef(!1),D=p.useRef(!1),M=p.useRef(null),L=p.useRef(""),U=p.useRef(""),I=p.useRef(null),H=p.useRef(null),K=Wx(I,h,N==null?void 0:N.beforeInsideRef),F=Wx(H,N==null?void 0:N.afterInsideRef),W=fy(),V=fy(),X=jU(),ie=N!=null,Q=tY(x),Z=Wn((Y=Q)=>Y?pC(Y):[]),ce=Wn(()=>(g==null?void 0:g().filter(Y=>Y!=null))??[]);p.useEffect(()=>{if(i||!l)return;function Y(te){te.key==="Tab"&&zn(Q,Gl(lr(Q)))&&Z().length===0&&!C&&oJe(te)}const G=lr(Q);return mi(G,"keydown",Y)},[i,Q,l,C,Z]),p.useEffect(()=>{if(i||!v)return;const Y=lr(Q);function G(){D.current=!1}function te(Ne){const pe=Yo(Ne),me=ce(),se=zn(x,pe)||zn(y,pe)||zn(N==null?void 0:N.portalNode,pe)||me.some(Se=>Se===pe||zn(Se,pe));D.current=!se,U.current=Ne.pointerType||"keyboard",pe!=null&&pe.closest(`[${mTe}]`)&&(P.current=!0,V.start(0,()=>{P.current=!1}))}function ye(){U.current="keyboard"}return _f(mi(Y,"pointerdown",te,!0),mi(Y,"pointerup",G,!0),mi(Y,"pointercancel",G,!0),mi(Y,"keydown",ye,!0),G)},[i,x,y,Q,v,N,V,ce]),p.useEffect(()=>{if(i||!c)return;const Y=lr(Q);function G(){P.current=!0,V.start(0,()=>{P.current=!1})}function te(me){const se=Yo(me);DU(se)&&(M.current=se)}function ye(me){const se=me.relatedTarget,Se=me.currentTarget,Le=Yo(me);l&&se==null&&Le!=null&&zn(x,Le)&&yY(Le),queueMicrotask(()=>{const be=S(),Ve=b.context.triggerElements,ve=ce(),Re=(se==null?void 0:se.hasAttribute(mN("focus-guard")))&&[I.current,H.current,N==null?void 0:N.beforeInsideRef.current,N==null?void 0:N.afterInsideRef.current,N==null?void 0:N.beforeOutsideRef.current,N==null?void 0:N.afterOutsideRef.current,mh(f),mh(d)].includes(se),ne=!(zn(y,se)||zn(x,se)||zn(se,x)||zn(N==null?void 0:N.portalNode,se)||ve.some(ge=>ge===se||zn(ge,se))||Ve.hasMatchingElement(ge=>zn(ge,se))||Re||T&&(ng(T.nodesRef.current,be).find(ge=>{var Ce,ke;return zn((Ce=ge.context)==null?void 0:Ce.elements.floating,se)||zn((ke=ge.context)==null?void 0:ke.elements.domReference,se)})||nY(T.nodesRef.current,be).find(ge=>{var Ce,ke,Ke;return[(Ce=ge.context)==null?void 0:Ce.elements.floating,tY((ke=ge.context)==null?void 0:ke.elements.floating)].includes(se)||((Ke=ge.context)==null?void 0:Ke.elements.domReference)===se})));if(Se===y&&Q&&xY(Q),o&&Se!==y&&!KCe(Le)&&Gl(Y)===Y.body){if(Ls(Q)&&(Q.focus(),o==="popup")){X.request(()=>{Q.focus()});return}const ge=Z(),Ce=M.current,ke=(Ce&&ge.includes(Ce)?Ce:null)||ge[ge.length-1]||Q;Ls(ke)&&ke.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(C||!l)&&se&&ne&&!P.current&&(C||se!==vY())&&(A.current=!0,b.setOpen(!1,Gs(LS,me)))})}function Ne(){D.current||(O.current.insideReactTree=!0,W.start(0,()=>{O.current.insideReactTree=!1}))}const pe=Ls(y)?y:null;if(!(!x&&!pe))return _f(pe&&mi(pe,"focusout",ye),pe&&mi(pe,"pointerdown",G),x&&mi(x,"focusin",te),x&&mi(x,"focusout",ye),x&&N&&mi(x,"focusout",Ne,!0))},[i,y,x,Q,l,T,N,b,c,o,Z,C,S,O,W,V,X,d,f,ce]),p.useEffect(()=>{var Se,Le,be;if(i||!x||!v)return;const Y=Array.from(((Se=N==null?void 0:N.portalNode)==null?void 0:Se.querySelectorAll(`[${mN("portal")}]`))||[]),te=(be=(Le=(T?nY(T.nodesRef.current,S()):[]).find(Ve=>{var ve;return eY(((ve=Ve.context)==null?void 0:ve.elements.domReference)||null)}))==null?void 0:Le.context)==null?void 0:be.elements.domReference,Ne=[...[x,...Y,I.current,H.current,N==null?void 0:N.beforeOutsideRef.current,N==null?void 0:N.afterOutsideRef.current,...ce()],te,mh(f),mh(d),C?y:null].filter(Ve=>Ve!=null),pe=gY(Ne,{ariaHidden:l||C,mark:!1}),me=[x,...Y].filter(Ve=>Ve!=null),se=gY(me);return()=>{se(),pe()}},[v,i,y,x,l,N,C,T,S,d,f,ce]),Un(()=>{if(!v||i||!Ls(Q))return;L.current="",U.current="";const Y=lr(Q),G=Gl(Y);queueMicrotask(()=>{const te=E.current,ye=typeof te=="function"?te(_.current||""):te;if(ye===void 0||ye===!1||zn(Q,G))return;let pe=null;const me=()=>(pe==null&&(pe=Z(Q)),pe[0]||Q);let se;ye===!0||ye===null?se=me():se=mh(ye),se=se||me();const Se=zn(Q,Gl(Y));BL(se,{preventScroll:se===Q,shouldFocus(){if(!j.current)return!1;if(Se)return!0;const Le=Gl(Y);return!(Le!==se&&zn(Q,Le))}})})},[i,v,Q,Z,E,_,j]),Un(()=>{if(i||!Q)return;const Y=lr(Q),G=Gl(Y),te=_.current==null;yY(G);function ye(pe){if(pe.open||(L.current=Ret(pe.nativeEvent,U.current)),pe.reason===Bc&&pe.nativeEvent.type==="mouseleave"&&(A.current=!0),pe.reason===xTe)if(pe.nested)A.current=!1;else if(lJe(pe.nativeEvent)||WCe(pe.nativeEvent))A.current=!1;else{let me=!1;lr(Q).createElement("div").focus({get preventScroll(){return me=!0,!1}}),me?A.current=!1:A.current=!0}}w.on("openchange",ye);function Ne(pe){const me=R.current;let se=typeof me=="function"?me(pe):me;if(se===void 0||se===!1)return null;se===null&&(se=!0);const Se=y!=null&&y.isConnected?y:null,Le=G!=null&&G.isConnected&&$a(G)!=="body"?G:null;let be=te?Le||Se:Se||Le;return be||(be=vY()||null),typeof se=="boolean"?be:mh(se)||be||null}return()=>{w.off("openchange",ye);const pe=Gl(Y),me=ce(),se=zn(x,pe)||me.some(Ve=>Ve===pe||zn(Ve,pe))||T&&ng(T.nodesRef.current,S(),!1).some(Ve=>{var ve;return zn((ve=Ve.context)==null?void 0:ve.elements.floating,pe)}),Se=R.current,Le=L.current,be=Ne(Le);queueMicrotask(()=>{const Ve=Iet(be),ve=typeof Se!="boolean";if(Se&&!A.current&&Ls(Ve)&&(!(!ve&&Ve!==pe&&pe!==Y.body)||se)){const Re={preventScroll:!0};Le==="keyboard"&&(Re.focusVisible=!0),Ve.focus(Re)}A.current=!1})}},[i,x,Q,R,_,w,T,y,S,ce]),Un(()=>{if(!Bw||v||!x)return;const Y=Gl(lr(x));!Ls(Y)||!NU(Y)||zn(x,Y)&&Y.blur()},[v,x]),Un(()=>{if(!(i||!N))return N.setFocusManagerState({modal:l,closeOnFocusOut:c,open:v,onOpenChange:b.setOpen,domReference:y}),()=>{N.setFocusManagerState(null)}},[i,N,l,v,b,c,y]),Un(()=>{if(!(i||!Q))return xY(Q),()=>{queueMicrotask(zU)}},[i,Q]);const Ee=!i&&(l?!C:!0)&&(ie||l);return a.jsxs(p.Fragment,{children:[Ee&&a.jsx(hy,{"data-type":"inside",ref:K,onFocus:Y=>{var G;if(l){const te=Z();BL(te[te.length-1])}else if(N!=null&&N.portalNode)if(A.current=!1,ex(Y,N.portalNode)){const te=MU(y);te==null||te.focus()}else(G=mh(f??N.beforeOutsideRef))==null||G.focus()}}),n,Ee&&a.jsx(hy,{"data-type":"inside",ref:F,onFocus:Y=>{var G;if(l)BL(Z()[0]);else if(N!=null&&N.portalNode)if(c&&(A.current=!0),ex(Y,N.portalNode)){const te=iTe(y);te==null||te.focus()}else(G=mh(d??N.afterOutsideRef))==null||G.focus()}})]})}function Pet(e,t={}){const{enabled:n=!0,event:i="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:o=!0,touchOpenDelay:l=0,reason:c=Kx}=t,u="rootStore"in e?e.rootStore:e,d=u.context.dataRef,f=p.useRef(void 0),h=jU(),m=fy(),g=p.useMemo(()=>{function b(y,x,w,O){const S=Gs(c,x,w);y&&O==="touch"&&l>0?m.start(l,()=>{u.setOpen(!0,S)}):u.setOpen(y,S)}function v(y,x,w){const O=d.current.openEvent,S=u.select("domReferenceElement")!==x;return y&&S||!y||!r?!0:O&&o?!w(O.type):!1}return{onPointerDown(y){f.current=Jv(y.pointerType,!0)&&WCe(y.nativeEvent)?"virtual":y.pointerType},onMouseDown(y){const x=f.current,w=y.nativeEvent,O=u.select("open");if(y.button!==0||i==="click"||Jv(x,!0)&&s)return;const S=v(O,y.currentTarget,E=>E==="click"||E==="mousedown"),k=Yo(w);if(NU(k)){b(S,w,k,x);return}const C=y.currentTarget;h.request(()=>{b(S,w,C,x)})},onClick(y){if(i==="mousedown-only")return;const x=f.current;if(i==="mousedown"&&x){f.current=void 0;return}if(Jv(x,!0)&&s)return;const w=u.select("open"),O=v(w,y.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");b(O,y.nativeEvent,y.currentTarget,x)},onKeyDown(){f.current=void 0}}},[d,i,s,c,u,o,r,h,m,l]);return p.useMemo(()=>n?{reference:g}:Cl,[n,g])}function Det(){return!1}function Met(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function PTe(e,t={}){const{enabled:n=!0,escapeKey:i=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:o=Det,bubbles:l,externalTree:c}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),f=u.useState("floatingElement"),{dataRef:h}=u.context,m=Uw(c),g=Wn(typeof r=="function"?r:()=>!1),b=typeof r=="function"?g:r,v=b!==!1,y=Wn(()=>s),{escapeKey:x,outsidePress:w}=Met(l),O=p.useRef(!1),S=p.useRef(!1),k=p.useRef(!1),C=p.useRef(!1),E=p.useRef(""),R=p.useRef(null),_=fy(),j=fy(),T=Wn(()=>{j.clear(),h.current.insideReactTree=!1}),N=Wn(K=>{var V;const F=(V=h.current.floatingContext)==null?void 0:V.nodeId;return(m?ng(m.nodesRef.current,F):[]).some(X=>{var ie;return((ie=X.context)==null?void 0:ie.open)&&!X.context.dataRef.current[K]})}),A=Wn(K=>IL(K,u.select("floatingElement"))||IL(K,u.select("domReferenceElement"))),P=Wn(K=>{o()&&u.setOpen(!1,Gs(Kx,K.nativeEvent))}),D=Wn(K=>{if(!d||!n||!i||K.key!=="Escape"||C.current||!x&&N("__escapeKeyBubbles"))return;const F=aJe(K)?K.nativeEvent:K,W=Gs(OTe,F);u.setOpen(!1,W),W.isCanceled||K.preventDefault(),!x&&!W.isPropagationAllowed&&K.stopPropagation()}),M=Wn(()=>{h.current.insideReactTree=!0,j.start(0,T)}),L=Wn(K=>{if(!d||!n||K.button!==0)return;const F=Yo(K.nativeEvent);zn(u.select("floatingElement"),F)&&(O.current||(O.current=!0,S.current=!1))}),U=Wn(K=>{!d||!n||(K.defaultPrevented||K.nativeEvent.defaultPrevented)&&O.current&&(S.current=!0)});p.useEffect(()=>{if(!d||!n)return T;h.current.__escapeKeyBubbles=x,h.current.__outsidePressBubbles=w;const K=new lu,F=new lu;function W(){K.clear(),C.current=!0}function V(){K.start(Bw?5:0,()=>{C.current=!1})}function X(){k.current=!0,F.start(0,()=>{k.current=!1})}function ie(){O.current=!1,S.current=!1}function Q(){const ve=E.current,Re=ve==="pen"||!ve?"mouse":ve,ne=y(),ge=typeof ne=="function"?ne():ne;return typeof ge=="string"?ge:ge[Re]}function Z(ve){const Re=Q();return Re==="intentional"&&ve.type!=="click"||Re==="sloppy"&&ve.type==="click"}function ce(ve){var ge;const Re=(ge=h.current.floatingContext)==null?void 0:ge.nodeId,ne=m&&ng(m.nodesRef.current,Re).some(Ce=>{var ke;return IL(ve,(ke=Ce.context)==null?void 0:ke.elements.floating)});return A(ve)||ne}function Ee(ve){if(Z(ve)){ve.type!=="click"&&!A(ve)&&(F.clear(),k.current=!1),T();return}if(h.current.insideReactTree){T();return}const Re=Yo(ve),ne=`[${mN("inert")}]`,ge=ur(Re)?Re.getRootNode():null,Ce=Array.from((qx(ge)?ge:lr(u.select("floatingElement"))).querySelectorAll(ne)),ke=u.context.triggerElements;if(Re&&(ke.hasElement(Re)||ke.hasMatchingElement(it=>zn(it,Re))))return;let Ke=ur(Re)?Re:null;for(;Ke&&!Bm(Ke);){const it=tg(Ke);if(Bm(it)||!ur(it))break;Ke=it}if(!(Ce.length&&ur(Re)&&!rJe(Re)&&!zn(Re,u.select("floatingElement"))&&Ce.every(it=>!zn(Ke,it)))){if(Ls(Re)&&!("touches"in ve)){const it=Bm(Re),ue=au(Re),xe=/auto|scroll/,Te=it||xe.test(ue.overflowX),qe=it||xe.test(ue.overflowY),De=Te&&Re.clientWidth>0&&Re.scrollWidth>Re.clientWidth,At=qe&&Re.clientHeight>0&&Re.scrollHeight>Re.clientHeight,It=ue.direction==="rtl",lt=At&&(It?ve.offsetX<=Re.offsetWidth-Re.clientWidth:ve.offsetX>Re.clientWidth),Ot=De&&ve.offsetY>Re.clientHeight;if(lt||Ot)return}if(!ce(ve)){if(Q()==="intentional"&&k.current){F.clear(),k.current=!1;return}typeof b=="function"&&!b(ve)||N("__outsidePressBubbles")||(u.setOpen(!1,Gs(xTe,ve)),T())}}}function Y(ve){Q()!=="sloppy"||ve.pointerType==="touch"||!u.select("open")||!n||A(ve)||Ee(ve)}function G(ve){if(Q()!=="sloppy"||!u.select("open")||!n||A(ve))return;const Re=ve.touches[0];Re&&(R.current={startTime:Date.now(),startX:Re.clientX,startY:Re.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},_.start(1e3,()=>{R.current&&(R.current.dismissOnTouchEnd=!1,R.current.dismissOnMouseDown=!1)}))}function te(ve,Re){const ne=Yo(ve);if(!ne)return;const ge=mi(ne,ve.type,()=>{Re(ve),ge()})}function ye(ve){E.current="touch",te(ve,G)}function Ne(ve){_.clear(),ve.type==="pointerdown"&&(E.current=ve.pointerType),!(ve.type==="mousedown"&&R.current&&!R.current.dismissOnMouseDown)&&te(ve,Re=>{Re.type==="pointerdown"?Y(Re):Ee(Re)})}function pe(ve){if(!O.current)return;const Re=S.current;if(ie(),Q()==="intentional"){if(ve.type==="pointercancel"){Re&&X();return}if(!ce(ve)){if(Re){X();return}typeof b=="function"&&!b(ve)||(F.clear(),k.current=!0,T())}}}function me(ve){if(Q()!=="sloppy"||!R.current||A(ve))return;const Re=ve.touches[0];if(!Re)return;const ne=Math.abs(Re.clientX-R.current.startX),ge=Math.abs(Re.clientY-R.current.startY),Ce=Math.sqrt(ne*ne+ge*ge);Ce>5&&(R.current.dismissOnTouchEnd=!0),Ce>10&&(Ee(ve),_.clear(),R.current=null)}function se(ve){te(ve,me)}function Se(ve){Q()!=="sloppy"||!R.current||A(ve)||(R.current.dismissOnTouchEnd&&Ee(ve),_.clear(),R.current=null)}function Le(ve){te(ve,Se)}const be=lr(f),Ve=_f(i&&_f(mi(be,"keydown",D),mi(be,"compositionstart",W),mi(be,"compositionend",V)),v&&_f(mi(be,"click",Ne,!0),mi(be,"pointerdown",Ne,!0),mi(be,"pointerup",pe,!0),mi(be,"pointercancel",pe,!0),mi(be,"mousedown",Ne,!0),mi(be,"mouseup",pe,!0),mi(be,"touchstart",ye,!0),mi(be,"touchmove",se,!0),mi(be,"touchend",Le,!0)));return()=>{Ve(),K.clear(),F.clear(),ie(),k.current=!1,T()}},[h,f,i,v,b,d,n,x,w,D,T,y,N,A,m,u,_]);const I=p.useMemo(()=>({onKeyDown:D,onPointerDown:P,onClick:P}),[D,P]),H=p.useMemo(()=>({onKeyDown:D,onPointerDown:U,onMouseDown:U,onClickCapture:M,onMouseDownCapture(K){M(),L(K)},onPointerDownCapture(K){M(),L(K)},onMouseUpCapture:M,onTouchEndCapture:M,onTouchMoveCapture:M}),[D,M,L,U]);return p.useMemo(()=>n?{reference:I,floating:H,trigger:I}:{},[n,I,H])}function wY(e,t,n){let{reference:i,floating:r}=e;const s=Iu(t),o=WI(t),l=qI(o),c=Qu(t),u=s==="y",d=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,h=i[l]/2-r[l]/2;let m;switch(c){case"top":m={x:d,y:i.y-r.height};break;case"bottom":m={x:d,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:f};break;case"left":m={x:i.x-r.width,y:f};break;default:m={x:i.x,y:i.y}}const g=Ep(t);return g&&(m[o]+=h*(g==="end"?1:-1)*(n&&u?-1:1)),m}async function Let(e,t){var n;t===void 0&&(t={});const{x:i,y:r,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Pf(t,e),g=PU(m),v=l[h?f==="floating"?"reference":"floating":f],y=dN(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=f==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),O=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},S=dN(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(y.top-S.top+g.top)/O.y,bottom:(S.bottom-y.bottom+g.bottom)/O.y,left:(y.left-S.left+g.left)/O.x,right:(S.right-y.right+g.right)/O.x}}const $et=50,Fet=async(e,t,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Let},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=wY(u,i,c),h=i,m=0;const g={};for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:r,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Pf(e,t)||{};if(u==null)return{};const f=PU(d),h={x:n,y:i},m=WI(r),g=qI(m),b=await o.getDimensions(u),v=m==="y",y=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",O=s.reference[g]+s.reference[m]-h[m]-s.floating[g],S=h[m]-s.reference[m],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=k?k[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(k)))&&(C=l.floating[w]||s.floating[g]);const E=O/2-S/2,R=C/2-b[g]/2-1,_=ig(f[y],R),j=ig(f[x],R),T=C-b[g]-j,N=C/2-b[g]/2+E,A=RU(_,N,T),P=!c.arrow&&Ep(r)!=null&&N!==A&&s.reference[g]/2-(N<_?_:j)-b[g]/2<0,D=P?N<_?N-_:N-T:0;return{[m]:h[m]+D,data:{[m]:A,centerOffset:N-A-D,...P&&{alignmentOffset:D}},reset:P}}}),Uet=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Pf(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Qu(r),x=Iu(l),w=Qu(l)===l,O=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(w||!b?[uN(l)]:hJe(l)),k=g!=="none";!h&&k&&S.push(...bJe(l,b,g,O));const C=[l,...S],E=await c.detectOverflow(t,v),R=[];let _=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&R.push(E[y]),f){const A=fJe(r,o,O);R.push(E[A[0]],E[A[1]])}if(_=[..._,{placement:r,overflows:R}],!R.every(A=>A<=0)){var j,T;const A=(((j=s.flip)==null?void 0:j.index)||0)+1,P=C[A];if(P&&(!(f==="alignment"?x!==Iu(P):!1)||_.every(L=>Iu(L.placement)===x?L.overflows[0]>0:!0)))return{data:{index:A,overflows:_},reset:{placement:P}};let D=(T=_.filter(M=>M.overflows[0]<=0).sort((M,L)=>M.overflows[1]-L.overflows[1])[0])==null?void 0:T.placement;if(!D)switch(m){case"bestFit":{var N;const M=(N=_.filter(L=>{if(k){const U=Iu(L.placement);return U===x||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,I)=>U+I,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:N[0];M&&(D=M);break}case"initialPlacement":D=l;break}if(r!==D)return{reset:{placement:D}}}return{}}}};function OY(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kY(e){return uJe.some(t=>e[t]>=0)}const Qet=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:i}=t,{strategy:r="referenceHidden",...s}=Pf(e,t);switch(r){case"referenceHidden":{const o=await i.detectOverflow(t,{...s,elementContext:"reference"}),l=OY(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:kY(l)}}}case"escaped":{const o=await i.detectOverflow(t,{...s,altBoundary:!0}),l=OY(o,n.floating);return{data:{escapedOffsets:l,escaped:kY(l)}}}default:return{}}}}},DTe=new Set(["left","top"]);async function zet(e,t){const{placement:n,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Qu(n),l=Ep(n),c=Iu(n)==="y",u=DTe.has(o)?-1:1,d=s&&c?-1:1,f=Pf(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Vet=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:r,y:s,placement:o,middlewareData:l}=t,c=await zet(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:o}}}}},Het=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:r,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:w,y:O}=x;return{x:w,y:O}}},...u}=Pf(e,t),d={x:n,y:i},f=await s.detectOverflow(t,u),h=Iu(r),m=IU(h);let g=d[m],b=d[h];const v=(x,w)=>RU(w+f[x==="y"?"top":"left"],w,w-f[x==="y"?"bottom":"right"]);o&&(g=v(m,g)),l&&(b=v(h,b));const y=c.fn({...t,[m]:g,[h]:b});return{...y,data:{x:y.x-n,y:y.y-i,enabled:{[m]:o,[h]:l}}}}}},qet=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,i;const{x:r,y:s,placement:o,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Pf(e,t),h={x:r,y:s},m=Iu(o),g=IU(m);let b=h[g],v=h[m];const y=Pf(u,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(i=y.crossAxis)!=null?i:0};if(d){const S=g==="y"?"height":"width",k=l.reference[g]-l.floating[S]+x.mainAxis,C=l.reference[g]+l.reference[S]-x.mainAxis;bC&&(b=C)}if(f){var w,O;const S=g==="y"?"width":"height",k=DTe.has(Qu(o)),C=l.reference[m]-l.floating[S]+(k&&((w=c.offset)==null?void 0:w[m])||0)+(k?0:x.crossAxis),E=l.reference[m]+l.reference[S]+(k?0:((O=c.offset)==null?void 0:O[m])||0)-(k?x.crossAxis:0);vE&&(v=E)}return{[g]:b,[m]:v}}}},Wet=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:i,platform:r,elements:s}=t,{apply:o=()=>{},...l}=Pf(e,t),c=await r.detectOverflow(t,l),u=Qu(n),d=Ep(n),f=Iu(n)==="y",{width:h,height:m}=i.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const v=m-c.top-c.bottom,y=h-c.left-c.right,x=ig(m-c[g],v),w=ig(h-c[b],y),O=t.middlewareData.shift,S=!O;let k=x,C=w;O!=null&&O.enabled.x&&(C=y),O!=null&&O.enabled.y&&(k=v),S&&!d&&(f?C=h-2*qh(c.left,c.right):k=m-2*qh(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:k});const E=await r.getDimensions(s.floating);return h!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function MTe(e){const t=au(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=Ls(e),s=r?e.offsetWidth:n,o=r?e.offsetHeight:i,l=cN(n)!==s||cN(i)!==o;return l&&(n=s,i=o),{width:n,height:i,$:l}}function VU(e){return ur(e)?e:e.contextElement}function tx(e){const t=VU(e);if(!Ls(t))return Wh(1);const n=t.getBoundingClientRect(),{width:i,height:r,$:s}=MTe(t);let o=(s?cN(n.width):n.width)/i,l=(s?cN(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Ket=Wh(0);function LTe(e){const t=Fs(e);return!_U()||!t.visualViewport?Ket:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Get(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Fs(e)}function py(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=VU(e);let o=Wh(1);t&&(i?ur(i)&&(o=tx(i)):o=tx(e));const l=Get(s,n,i)?LTe(s):Wh(0);let c=(r.left+l.x)/o.x,u=(r.top+l.y)/o.y,d=r.width/o.x,f=r.height/o.y;if(s&&i){const h=Fs(s),m=ur(i)?Fs(i):i;let g=h,b=Q6(g);for(;b&&m!==g;){const v=tx(b),y=b.getBoundingClientRect(),x=au(b),w=y.left+(b.clientLeft+parseFloat(x.paddingLeft))*v.x,O=y.top+(b.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=w,u+=O,g=Fs(b),b=Q6(g)}}return dN({width:d,height:f,x:c,y:u})}function XI(e,t){const n=zI(e).scrollLeft;return t?t.left+n:py(Sp(e)).left+n}function $Te(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-XI(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function Xet(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e;const s=r==="fixed",o=Sp(i),l=t?QI(t.floating):!1;if(i===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Wh(1);const d=Wh(0),f=Ls(i);if((f||!s)&&(($a(i)!=="body"||hC(o))&&(c=zI(i)),f)){const m=py(i);u=tx(i),d.x=m.x+i.clientLeft,d.y=m.y+i.clientTop}const h=o&&!f&&!s?$Te(o,c):Wh(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function Yet(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Zet(e){const t=zI(e),n=e.ownerDocument.body,i=qh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=qh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+XI(e);const o=-t.scrollTop;return au(n).direction==="rtl"&&(s+=qh(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:o}}const Jet=25;function ett(e,t,n){n===void 0&&(n="viewport");const i=n==="layoutViewport",r=Fs(e),s=Sp(e),o=r.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(o){const h=!_U()||t==="fixed";i?h||(u=-o.offsetLeft,d=-o.offsetTop):(l=o.width,c=o.height,h&&(u=o.offsetLeft,d=o.offsetTop))}if(XI(s)<=0){const h=s.ownerDocument,m=h.body,g=getComputedStyle(m),b=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(s.clientWidth-m.clientWidth-b),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?v/2:v;y<=Jet&&(l-=y)}return{width:l,height:c,x:u,y:d}}function ttt(e,t){const n=py(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=tx(e),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=r*s.x,u=i*s.y;return{width:o,height:l,x:c,y:u}}function SY(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=ett(e,n,t);else if(t==="document")i=Zet(Sp(e));else if(ur(t))i=ttt(t,n);else{const r=LTe(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return dN(i)}function ntt(e,t){const n=t.get(e);if(n)return n;let i=DS(e,[],!1).filter(l=>ur(l)&&$a(l)!=="body"),r=null;const s=au(e).position==="fixed";let o=s?tg(e):e;for(;ur(o)&&!Bm(o);){const l=au(o),c=AU(o),u=r?r.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?i=i.filter(f=>f!==o):r=l,o=tg(o)}return t.set(e,i),i}function itt(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e;const o=[...n==="clippingAncestors"?QI(t)?[]:ntt(t,this._c):[].concat(n),i],l=SY(t,o[0],r);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h{l(!1,1e-7)},1e3)}C=!1}try{i=new IntersectionObserver(E,{...k,root:s.ownerDocument})}catch{i=new IntersectionObserver(E,k)}i.observe(e)}const c=Fs(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),o()}}function Y6(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,u=VU(e),d=r||s?[...u?DS(u):[],...t?DS(t):[]]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const f=u&&l?ctt(u,n,s):null;let h=-1,m=null;o&&(m=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,b=c?py(e):null;c&&v();function v(){const y=py(e);b&&!BTe(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(x=>{r&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const utt=Vet,dtt=Het,ftt=Uet,htt=Wet,ptt=Qet,CY=Bet,mtt=qet,gtt=(e,t,n)=>{const i=new Map,r=n??{},s={...ltt,...r.platform,_c:i};return Fet(e,t,{...r,platform:s})};var btt=typeof document<"u",ytt=function(){},__=btt?p.useLayoutEffect:ytt;function gN(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!gN(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!gN(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UTe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function TY(e,t){const n=UTe(e);return Math.round(t*n)/n}function VL(e){const t=p.useRef(e);return __(()=>{t.current=e}),t}function QTe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(i);gN(h,i)||m(i);const[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useCallback(L=>{L!==k.current&&(k.current=L,b(L))},[]),w=p.useCallback(L=>{L!==C.current&&(C.current=L,y(L))},[]),O=s||g,S=o||v,k=p.useRef(null),C=p.useRef(null),E=p.useRef(d),R=c!=null,_=VL(c),j=VL(r),T=VL(u),N=p.useCallback(()=>{if(!k.current||!C.current)return;const L={placement:t,strategy:n,middleware:h};j.current&&(L.platform=j.current),gtt(k.current,C.current,L).then(U=>{const I={...U,isPositioned:T.current!==!1};A.current&&!gN(E.current,I)&&(E.current=I,ri.flushSync(()=>{f(I)}))})},[h,t,n,j,T]);__(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[u]);const A=p.useRef(!1);__(()=>(A.current=!0,()=>{A.current=!1}),[]),__(()=>{if(O&&(k.current=O),S&&(C.current=S),O&&S){if(_.current)return _.current(O,S,N);N()}},[O,S,N,_,R]);const P=p.useMemo(()=>({reference:k,floating:C,setReference:x,setFloating:w}),[x,w]),D=p.useMemo(()=>({reference:O,floating:S}),[O,S]),M=p.useMemo(()=>{const L={position:n,left:0,top:0};if(!D.floating)return L;const U=TY(D.floating,d.x),I=TY(D.floating,d.y);return l?{...L,transform:"translate("+U+"px, "+I+"px)",...UTe(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:I}},[n,l,D.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:N,refs:P,elements:D,floatingStyles:M}),[d,N,P,D,M])}const vtt=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&t(i)?i.current!=null?CY({element:i.current,padding:r}).fn(n):{}:i?CY({element:i,padding:r}).fn(n):{}}}},zTe=(e,t)=>{const n=utt(e);return{name:n.name,fn:n.fn,options:[e,t]}},VTe=(e,t)=>{const n=dtt(e);return{name:n.name,fn:n.fn,options:[e,t]}},HTe=(e,t)=>({fn:mtt(e).fn,options:[e,t]}),qTe=(e,t)=>{const n=ftt(e);return{name:n.name,fn:n.fn,options:[e,t]}},WTe=(e,t)=>{const n=htt(e);return{name:n.name,fn:n.fn,options:[e,t]}},xtt=(e,t)=>{const n=ptt(e);return{name:n.name,fn:n.fn,options:[e,t]}},wtt=(e,t)=>{const n=vtt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ott={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class HU extends BI{constructor(n){const{syncOnly:i,nested:r,onOpenChange:s,triggerElements:o,...l}=n;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:jTe(),nested:r,triggerElements:o},Ott);rn(this,"syncOpenEvent",(n,i)=>{(!n||!this.state.open||i!=null&&cJe(i))&&(this.context.dataRef.current.openEvent=n?i:void 0)});rn(this,"dispatchOpenChange",(n,i)=>{this.syncOpenEvent(n,i.event);const r={open:n,reason:i.reason,nativeEvent:i.event,nested:this.context.nested,triggerElement:i.trigger};this.context.events.emit("openchange",r)});rn(this,"setOpen",(n,i)=>{var r,s,o,l;if(this.syncOnly){(s=(r=this.context).onOpenChange)==null||s.call(r,n,i);return}this.dispatchOpenChange(n,i),(l=(o=this.context).onOpenChange)==null||l.call(o,n,i)});this.syncOnly=i}}function ktt(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:i,floatingId:r,nested:s,onOpenChange:o}=e,l=t.useState("open"),c=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),d=t.context.triggerElements,f=o,h=p.useRef(null);i===void 0&&h.current===null&&(h.current=new HU({open:l,transitionStatus:void 0,referenceElement:c,floatingElement:u,triggerElements:d,onOpenChange:f,floatingId:r,syncOnly:!0,nested:s}));const m=i??h.current;return t.useSyncedValue("floatingId",r),Un(()=>{const g={open:l,floatingId:r,referenceElement:c,floatingElement:u};ur(c)&&(g.domReferenceElement=c),m.state.positionReference===m.state.referenceElement&&(g.positionReference=c),m.update(g)},[l,r,c,u,m]),m.context.onOpenChange=f,m.context.nested=s,m}function KTe(e,t=!1,n=!1){const[i,r]=p.useState(e&&t?"idle":void 0),[s,o]=p.useState(e);return e&&!s&&(o(!0),r("starting")),!e&&s&&i!=="ending"&&!n&&r("ending"),!e&&!s&&i==="ending"&&r(void 0),Un(()=>{if(!e&&s&&i!=="ending"&&n){const l=Yl.request(()=>{r("ending")});return()=>{Yl.cancel(l)}}},[e,s,i,n]),Un(()=>{if(!e||t)return;const l=Yl.request(()=>{r(void 0)});return()=>{Yl.cancel(l)}},[t,e]),Un(()=>{if(!e||!t)return;e&&s&&i!=="idle"&&r("starting");const l=Yl.request(()=>{r("idle")});return()=>{Yl.cancel(l)}},[t,e,s,i]),{mounted:s,setMounted:o,transitionStatus:i}}const GTe={tabIndex:-1,[V6]:""};function XTe(e){return t=>t==="touch"?e.current:!0}function YTe(e,t=!1){const n=gC(),i=GI()!=null,r=Ku(()=>e(n,i)).current;return ktt({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:i,onOpenChange:r.setOpen}),r}function ZTe({handle:e,store:t}){return Un(()=>e.attachStore(t),[e,t]),null}function Stt(e,t){const n=p.useRef(null),i=p.useRef(null);return p.useCallback(r=>{if(e===void 0)return;let s=!1;if(n.current!==null){const o=n.current,l=i.current,c=t.context.triggerElements.getById(o);l&&c===l&&(t.context.triggerElements.delete(o),s=!0),n.current=null,i.current=null}if(r!==null&&(n.current=e,i.current=r,t.context.triggerElements.add(e,r),s=!0),s){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function JTe(e,t,n,i=!1){t?e.preventUnmountingOnClose=!1:i&&(e.preventUnmountingOnClose=!0);const r=(n==null?void 0:n.id)??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function Ett(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Ctt(e,t,n,i){const r=n.useState("isMountedByTrigger",e),s=Stt(e,n),o=Wn(c=>{const u=n.select("open"),d=n.select("activeTriggerId");if(d===e){n.update({activeTriggerElement:c,...u?i:null});return}d==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:c,...i})}),l=p.useCallback(c=>{s(c),c&&o(c)},[s,o]);return Un(()=>{r&&n.update({activeTriggerElement:t.current,...i})},[r,n,t,...Object.values(i)]),{registerTrigger:l,isMountedByThisTrigger:r}}function eAe(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,i=p.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),o=e.useState("activeTriggerId"),l=e.useState("activeTriggerElement");Un(()=>{if(!r){i.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const d=e.select("activeTriggerId");let f=null;if(d){const h=e.context.triggerElements.getById(d);if(h)i.current=d,h!==e.state.activeTriggerElement&&(u.activeTriggerElement=h);else{for(const[m,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){u.activeTriggerId=m,u.activeTriggerElement=g,i.current=m;break}u.activeTriggerId===void 0&&(i.current===d?f=d:i.current=null)}}else i.current=null;if(!f&&!d&&c===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[m,g]=h.value;u.activeTriggerId=m,u.activeTriggerElement=g,i.current=m}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){const h=Gs(vTe);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,o,l,n])}function tAe(e,t,n){const{mounted:i,setMounted:r,transitionStatus:s}=KTe(e),o=t.useState("preventUnmountingOnClose"),l=e?!1:o;t.useSyncedValues({mounted:i,transitionStatus:s,preventUnmountingOnClose:l});const c=Wn(()=>{var u,d;r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(d=(u=t.context).onOpenChangeComplete)==null||d.call(u,!1)});return mC({enabled:i&&!e&&!l,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}function nAe(e,t){e.useSyncedValues(t),Un(()=>()=>{e.update({activeTriggerProps:Cl,inactiveTriggerProps:Cl,popupProps:Cl})},[e])}function iAe(e,t){Un(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Un(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class qU{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Ttt(){return new HU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new qU,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function rAe(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ttt(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Cl,inactiveTriggerProps:Cl,popupProps:Cl}}function sAe(e,t,n=!1){return new HU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const Mk=e=>e.triggerIdProp??e.activeTriggerId,WU=e=>e.openProp??e.open,AY=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function oAe(e,t){return t!==void 0&&WU(e)&&Mk(e)===t}function Att(e,t){return oAe(e,t)?!0:t!==void 0&&WU(e)&&Mk(e)==null&&e.triggerCount===1}const aAe={open:WU,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Mk,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:AY,isTriggerActive:(e,t)=>t!==void 0&&Mk(e)===t,isOpenedByTrigger:(e,t)=>oAe(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Mk(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Att(e,t)?AY(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function _tt(e){const t=p.useCallback(i=>e===void 0?kU:e.subscribeStore(i),[e]),n=p.useCallback(()=>e===void 0?void 0:e.store,[e]);return JR.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}function jtt(e){return Ntt(e,e.rootContext)}function Ntt(e,t){const{nodeId:n,externalTree:i}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),o=t.useState("domReferenceElement"),l=t.useState("open"),c=t.useState("floatingId"),[u,d]=p.useState(null),[f,h]=p.useState(void 0),[m,g]=p.useState(void 0),b=p.useRef(null),v=Uw(i),y=p.useMemo(()=>({reference:r,floating:s,domReference:o}),[r,s,o]),x=QTe({...e,elements:{...y,...u&&{reference:u}}}),w=ur(f)?f:null,O=m===void 0?t.state.floatingElement:m;t.useSyncedValue("referenceElement",f??null),t.useSyncedValue("domReferenceElement",f===void 0?o:w),t.useSyncedValue("floatingElement",O);const S=p.useCallback(j=>{const T=ur(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(T),x.refs.setReference(T)},[x.refs]),k=p.useCallback(j=>{(ur(j)||j===null)&&(b.current=j,h(j)),(ur(x.refs.reference.current)||x.refs.reference.current===null||j!==null&&!ur(j))&&x.refs.setReference(j)},[x.refs,h]),C=p.useCallback(j=>{g(j),x.refs.setFloating(j)},[x.refs]),E=p.useMemo(()=>({...x.refs,setReference:k,setFloating:C,setPositionReference:S,domReference:b}),[x.refs,k,C,S]),R=p.useMemo(()=>({...x.elements,domReference:o}),[x.elements,o]),_=p.useMemo(()=>({...x,dataRef:t.context.dataRef,open:l,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:E,elements:R,nodeId:n,rootStore:t}),[x,E,R,n,t,l,c]);return Un(()=>{o&&(b.current=o)},[o]),Un(()=>{t.context.dataRef.current.floatingContext=_;const j=v==null?void 0:v.nodesRef.current.find(T=>T.id===n);j&&(j.context=_)}),p.useMemo(()=>({...x,context:_,refs:E,elements:R,rootStore:t}),[x,E,R,_,t])}class KU{constructor(){rn(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});rn(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new lu,this.restTimeout=new lu,this.handleCloseOptions=void 0}static create(){return new KU}}const bN=new WeakMap;function yN(e){var n,i,r;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&bN.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(i=e.pointerEventsReferenceElement)==null||i.style.removeProperty("pointer-events"),(r=e.pointerEventsFloatingElement)==null||r.style.removeProperty("pointer-events"),bN.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function lAe(e,t){const{scopeElement:n,referenceElement:i,floatingElement:r}=t,s=bN.get(n);s&&s!==e&&yN(s),yN(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=i,e.pointerEventsFloatingElement=r,bN.set(n,e),n.style.pointerEvents="none",i.style.pointerEvents="auto",r.style.pointerEvents="auto"}function cAe(e){const t=e.context.dataRef.current,n=Ku(()=>t.hoverInteractionState??KU.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),$I(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Rtt(e,t={}){const{enabled:n=!0,closeDelay:i=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,o=s.useState("open"),l=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:u}=s.context,d=Uw(),f=GI(),h=cAe(s),m=fy(),g=Wn(()=>{var y;return ATe((y=u.current.openEvent)==null?void 0:y.type,h.interactedInside)}),b=Wn(()=>{var y;return Eet((y=u.current.openEvent)==null?void 0:y.type)}),v=Wn(()=>{yN(h)});Un(()=>{o||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,v())},[o,h,v]),p.useEffect(()=>v,[v]),Un(()=>{var y,x,w,O,S;if(n&&o&&(y=h.handleCloseOptions)!=null&&y.blockPointerEvents&&b()&&ur(c)&&l){const k=c,C=l,E=lr(l),R=(w=(x=d==null?void 0:d.nodesRef.current.find(N=>N.id===f))==null?void 0:x.context)==null?void 0:w.elements.floating;R&&(R.style.pointerEvents="");const _=h.pointerEventsScopeElement!==C?h.pointerEventsScopeElement:null,j=R!==C?R:null,T=((S=(O=h.handleCloseOptions)==null?void 0:O.getScope)==null?void 0:S.call(O))??_??j??k.closest("[data-rootownerid]")??E.body;return lAe(h,{scopeElement:T,referenceElement:k,floatingElement:C}),()=>{v()}}},[n,o,c,l,h,b,d,f,v]),p.useEffect(()=>{if(!n)return;function y(){return!!(d&&f&&ng(d.nodesRef.current,f).length>0)}function x(E){const R=G6(i,"close",h.pointerType),_=()=>{s.setOpen(!1,Gs(Bc,E)),d==null||d.events.emit("floating.closed",E)};R?h.openChangeTimeout.start(R,_):(h.openChangeTimeout.clear(),_())}function w(E){const R=Yo(E);if(!sJe(R)){h.interactedInside=!1;return}h.interactedInside=(R==null?void 0:R.closest("[aria-haspopup]"))!=null}function O(){h.openChangeTimeout.clear(),m.clear(),d==null||d.events.off("floating.closed",k),v()}function S(E){var T;if(y()&&d){d.events.on("floating.closed",k);return}if(qCe(E.relatedTarget,s.context.triggerElements))return;const R=((T=u.current.floatingContext)==null?void 0:T.nodeId)??r,_=E.relatedTarget;if(!(d&&R&&ur(_)&&ng(d.nodesRef.current,R,!1).some(N=>{var A;return zn((A=N.context)==null?void 0:A.elements.floating,_)}))){if(h.handler){h.handler(E);return}v(),b()&&!g()&&x(E)}}function k(E){!d||!f||y()||m.start(0,()=>{d.events.off("floating.closed",k),s.setOpen(!1,Gs(Bc,E)),d.events.emit("floating.closed",E)})}const C=l;return _f(C&&mi(C,"mouseenter",O),C&&mi(C,"mouseleave",S),C&&mi(C,"pointerdown",w,!0),()=>{d==null||d.events.off("floating.closed",k)})},[n,l,s,u,i,r,b,g,v,h,d,f,m])}const Itt={current:null};function Ptt(e,t={}){var D;const{enabled:n=!0,delay:i=0,handleClose:r=null,mouseOnly:s=!1,restMs:o=0,move:l=!0,triggerElementRef:c=Itt,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:f,isClosing:h,shouldOpen:m,guardStaleOpen:g=!1}=t,b="rootStore"in e?e.rootStore:e,{dataRef:v,events:y}=b.context,x=Uw(u),w=cAe(b),O=p.useRef(!1),S=Ol(r),k=Ol(i),C=Ol(o),E=Ol(n),R=Ol(m),_=Ol(h),j=Wn(()=>{var M;return ATe((M=v.current.openEvent)==null?void 0:M.type,w.interactedInside)}),T=Wn(()=>{var M;return((M=R.current)==null?void 0:M.call(R))!==!1}),N=Wn((M,L,U)=>{const I=b.context.triggerElements;if(I.hasElement(L))return!M||!zn(M,L);if(!ur(U))return!1;const H=U;return I.hasMatchingElement(K=>zn(K,H))&&(!M||!zn(M,H))}),A=Wn(()=>{if(!w.handler)return;lr(b.select("domReferenceElement")).removeEventListener("mousemove",w.handler),w.handler=void 0}),P=Wn(()=>{yN(w)});return d&&(w.handleCloseOptions=(D=S.current)==null?void 0:D.__options),p.useEffect(()=>A,[A]),p.useEffect(()=>{if(!n)return;function M(L){L.open?O.current=!1:(O.current=L.reason===Bc,A(),w.openChangeTimeout.clear(),w.restTimeout.clear(),w.blockMouseMove=!0,w.restTimeoutPending=!1)}return y.on("openchange",M),()=>{y.off("openchange",M)}},[n,y,w,A]),p.useEffect(()=>{if(!n)return;function M(F,W=!0){const V=G6(k.current,"close",w.pointerType);V?w.openChangeTimeout.start(V,()=>{b.setOpen(!1,Gs(Bc,F)),x==null||x.events.emit("floating.closed",F)}):W&&(w.openChangeTimeout.clear(),b.setOpen(!1,Gs(Bc,F)),x==null||x.events.emit("floating.closed",F))}const L=c.current??(d?b.select("domReferenceElement"):null);if(!ur(L))return;function U(F){var me;if(w.openChangeTimeout.clear(),w.blockMouseMove=!1,s&&!Jv(w.pointerType))return;const W=dY(C.current),V=G6(k.current,"open",w.pointerType),X=Yo(F),ie=F.currentTarget??null,Q=b.select("domReferenceElement");let Z=ie;if(ur(X)&&!b.context.triggerElements.hasElement(X)){for(const se of b.context.triggerElements.elements())if(zn(se,X)){Z=se;break}}ur(ie)&&ur(Q)&&!b.context.triggerElements.hasElement(ie)&&zn(ie,Q)&&(Z=Q);const ce=Z==null?!1:N(Q,Z,X),Ee=b.select("open"),Y=((me=_.current)==null?void 0:me.call(_))??b.select("transitionStatus")==="ending",G=!Ee&&Y&&O.current,te=!ce&&ur(Z)&&ur(Q)&&zn(Q,Z)&&G,ye=W>0&&!V,Ne=ce&&(Ee||G)||te,pe=!Ee||ce;if(Ne){T()&&b.setOpen(!0,Gs(Bc,F,Z));return}ye||(V?w.openChangeTimeout.start(V,()=>{pe&&T()&&b.setOpen(!0,Gs(Bc,F,Z))}):pe&&T()&&b.setOpen(!0,Gs(Bc,F,Z)))}function I(F){if(j()){P();return}A();const W=b.select("domReferenceElement"),V=lr(W);w.restTimeout.clear(),w.restTimeoutPending=!1;const X=v.current.floatingContext??(f==null?void 0:f());if(qCe(F.relatedTarget,b.context.triggerElements))return;if(S.current&&X){b.select("open")||w.openChangeTimeout.clear();const Q=c.current;w.handler=S.current({...X,tree:x,x:F.clientX,y:F.clientY,onClose(){P(),A(),E.current&&!j()&&Q===b.select("domReferenceElement")&&M(F,!0)}}),V.addEventListener("mousemove",w.handler),w.handler(F);return}(w.pointerType==="touch"?!zn(b.select("floatingElement"),F.relatedTarget):!0)&&M(F)}function H(F){zn(L,F.relatedTarget)||(w.openChangeTimeout.clear(),w.restTimeout.clear(),w.restTimeoutPending=!1)}const K=g?mi(L,"mouseout",H):void 0;return l?_f(mi(L,"mousemove",U,{once:!0}),mi(L,"mouseenter",U),mi(L,"mouseleave",I),K):_f(mi(L,"mouseenter",U),mi(L,"mouseleave",I),K)},[A,P,v,k,b,n,S,w,d,N,j,s,l,C,c,x,E,f,_,T,g]),p.useMemo(()=>{if(!n)return;function M(L){w.pointerType=L.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(L){var X,ie,Q;const{nativeEvent:U}=L,I=L.currentTarget,H=b.select("domReferenceElement"),K=b.select("open"),F=N(H,I,L.target);if(s&&!Jv(w.pointerType))return;if(K&&F&&((X=w.handleCloseOptions)!=null&&X.blockPointerEvents)){const Z=b.select("floatingElement");if(Z){const ce=((Q=(ie=w.handleCloseOptions)==null?void 0:ie.getScope)==null?void 0:Q.call(ie))??I.ownerDocument.body;lAe(w,{scopeElement:ce,referenceElement:I,floatingElement:Z})}}const W=dY(C.current);if(K&&!F||W===0||!F&&w.restTimeoutPending&&L.movementX**2+L.movementY**2<2)return;w.restTimeout.clear();function V(){if(w.restTimeoutPending=!1,j())return;const Z=b.select("open");!w.blockMouseMove&&(!Z||F)&&T()&&b.setOpen(!0,Gs(Bc,U,I))}w.pointerType==="touch"?ri.flushSync(()=>{V()}):F&&K?V():(w.restTimeoutPending=!0,w.restTimeout.start(W,V))}}},[n,w,j,N,s,b,C,T])}const _Y=.1,Dtt=_Y*_Y,jr=.5;function bA(e,t,n,i,r,s){return i>=t!=s>=t&&e<=(r-n)*(t-i)/(s-i)+n}function yA(e,t,n,i,r,s,o,l,c,u){let d=!1;return bA(e,t,n,i,r,s)&&(d=!d),bA(e,t,r,s,o,l)&&(d=!d),bA(e,t,o,l,c,u)&&(d=!d),bA(e,t,c,u,n,i)&&(d=!d),d}function Mtt(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function vA(e,t,n,i,r,s){const o=Math.min(n,r),l=Math.max(n,r),c=Math.min(i,s),u=Math.max(i,s);return e>=o&&e<=l&&t>=c&&t<=u}function Ltt(e={}){const{blockPointerEvents:t=!1}=e,n=new lu,i=({x:r,y:s,placement:o,elements:l,onClose:c,nodeId:u,tree:d})=>{const f=o==null?void 0:o.split("-")[0];let h=!1,m=null,g=null,b=typeof performance<"u"?performance.now():0;function v(x,w){const O=performance.now(),S=O-b;if(m===null||g===null||S===0)return m=x,g=w,b=O,!1;const k=x-m,C=w-g,E=k*k+C*C,R=S*S*Dtt;return m=x,g=w,b=O,E0)}function N(){T()||y()}if(T())return;const A=O.getBoundingClientRect(),P=S.getBoundingClientRect(),D=r>P.right-P.width/2,M=s>P.bottom-P.height/2,L=P.width>A.width,U=P.height>A.height,I=(L?A:P).left,H=(L?A:P).right,K=(U?A:P).top,F=(U?A:P).bottom;if(f==="top"&&s>=A.bottom-1||f==="bottom"&&s<=A.top+1||f==="left"&&r>=A.right-1||f==="right"&&r<=A.left+1){N();return}let W=!1;switch(f){case"top":W=vA(k,C,I,A.top+1,H,P.bottom-1);break;case"bottom":W=vA(k,C,I,P.top+1,H,A.bottom-1);break;case"left":W=vA(k,C,P.right-1,F,A.left+1,K);break;case"right":W=vA(k,C,A.right-1,F,P.left+1,K);break}if(W)return;if(h&&!Mtt(k,C,A)){N();return}if(!R&&v(k,C)){N();return}let V=!1;switch(f){case"top":{const X=L?jr/2:jr*4,ie=L||D?r+X:r-X,Q=L?r-X:D?r+X:r-X,Z=s+jr+1,ce=D||L?P.bottom-jr:P.top,Ee=D?L?P.bottom-jr:P.top:P.bottom-jr;V=yA(k,C,ie,Z,Q,Z,P.left,ce,P.right,Ee);break}case"bottom":{const X=L?jr/2:jr*4,ie=L||D?r+X:r-X,Q=L?r-X:D?r+X:r-X,Z=s-jr,ce=D||L?P.top+jr:P.bottom,Ee=D?L?P.top+jr:P.bottom:P.top+jr;V=yA(k,C,ie,Z,Q,Z,P.left,ce,P.right,Ee);break}case"left":{const X=U?jr/2:jr*4,ie=U||M?s+X:s-X,Q=U?s-X:M?s+X:s-X,Z=r+jr+1,ce=M||U?P.right-jr:P.left,Ee=M?U?P.right-jr:P.left:P.right-jr;V=yA(k,C,ce,P.top,Ee,P.bottom,Z,ie,Z,Q);break}case"right":{const X=U?jr/2:jr*4,ie=U||M?s+X:s-X,Q=U?s-X:M?s+X:s-X,Z=r-jr,ce=M||U?P.left+jr:P.right,Ee=M?U?P.left+jr:P.right:P.left+jr;V=yA(k,C,Z,ie,Z,Q,ce,P.top,Ee,P.bottom);break}}V?h||n.start(40,N):N()}};return i.__options={...e,blockPointerEvents:t},i}const $tt=p.createContext(void 0);function Ftt(){const e=p.useContext($tt);return(e==null?void 0:e.direction)??"ltr"}const Btt=e=>({name:"arrow",options:e,async fn(t){var U,I;const{x:n,y:i,placement:r,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0,offsetParent:f="real"}=Pf(e,t)||{};if(u==null)return{};const h=PU(d),m={x:n,y:i},g=WI(r),b=qI(g),v=await o.getDimensions(u),y=g==="y",x=y?"top":"left",w=y?"bottom":"right",O=y?"clientHeight":"clientWidth",S=s.reference[b]+s.reference[g]-m[g]-s.floating[b],k=m[g]-s.reference[g],C=f==="real"?await((U=o.getOffsetParent)==null?void 0:U.call(o,u)):l.floating;let E=l.floating[O]||s.floating[b];(!E||!await((I=o.isElement)==null?void 0:I.call(o,C)))&&(E=l.floating[O]||s.floating[b]);const R=S/2-k/2,_=E/2-v[b]/2-1,j=Math.min(h[x],_),T=Math.min(h[w],_),N=j,A=E-v[b]-T,P=E/2-v[b]/2+R,D=RU(N,P,A),M=!c.arrow&&Ep(r)!=null&&P!==D&&s.reference[b]/2-(P({...Btt(e),options:[e,t]}),Qtt={name:"hide",async fn(e){const{width:t,height:n,x:i,y:r}=e.rects.reference,s=t===0&&n===0&&i===0&&r===0,o=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||s}}}},ztt={sideX:"left",sideY:"top"},jY="--available-width",NY="--available-height";function uAe(e,t,n){const i=e==="inline-start"||e==="inline-end";return{top:"top",right:i?n?"inline-start":"inline-end":"right",bottom:"bottom",left:i?n?"inline-end":"inline-start":"left"}[t]}function RY(e,t,n){const{rects:i,placement:r}=e;return{side:uAe(t,Qu(r),n),align:Ep(r)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function Vtt(e){return Htt(e,jtt)}function Htt(e,t){var dt,yt;const{anchor:n,positionMethod:i="absolute",side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,collisionBoundary:c,collisionPadding:u=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,inline:m,keepMounted:g=!1,floatingRootContext:b,mounted:v,collisionAvoidance:y,shift:x,nodeId:w,adaptiveOrigin:O,lazyFlip:S=!1,externalTree:k}=e,[C,E]=p.useState(null);!v&&C!==null&&E(null);const R=y.side||"flip",_=y.align||"flip",j=y.fallbackAxisSide||"end",T=(x==null?void 0:x.crossAxis)??!1,N=x==null?void 0:x.rootBoundary,A=typeof n=="function"?n:void 0,P=Wn(A),D=A?P:n,M=Ol(n),L=Ol(v),I=Ftt()==="rtl",H=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[r],K=o==="center"?H:`${H}-${o}`;let F=u;typeof F=="number"?F={top:F,right:F,bottom:F,left:F}:F&&(F={top:F.top||0,right:F.right||0,bottom:F.bottom||0,left:F.left||0});const W=1,V=r==="bottom"?W:0,X=r==="top"?W:0,ie=r==="right"?W:0,Q=r==="left"?W:0,Z={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:F},ce=p.useRef(null),Ee=Ol(s),Y=Ol(l),G=typeof s!="function"?s:0,te=typeof l!="function"?l:0,ye=[];m&&ye.push(m),ye.push(zTe(Ie=>{const vt=RY(Ie,r,I),jt=typeof Ee.current=="function"?Ee.current(vt):Ee.current,Nt=typeof Y.current=="function"?Y.current(vt):Y.current;return{mainAxis:jt,crossAxis:Nt,alignmentAxis:Nt}},[G,te,I,r]));const Ne=_==="none"&&R!=="shift",pe=!Ne&&(d||T||R==="shift"),me=R==="none"?null:qTe({...Z,padding:{top:F.top+W+V,right:F.right+W+Q,bottom:F.bottom+W+X,left:F.left+W+ie},mainAxis:!T&&R==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:j}),se=Ne?null:VTe({...Z,rootBoundary:N,mainAxis:_!=="none",crossAxis:pe,limiter:d||T?void 0:HTe(Ie=>{if(!ce.current)return{};const{width:vt,height:jt}=ce.current.getBoundingClientRect(),Nt=Iu(Qu(Ie.placement)),ln=Nt==="y"?vt:jt,He=Nt==="y"?F.left+F.right:F.top+F.bottom;return{offset:ln/2+He/2}})},[Z,d,T,N,F,_]);R==="shift"||_==="shift"||o==="center"?ye.push(se,me):ye.push(me,se),ye.push(WTe({...Z,apply({elements:{floating:Ie},availableWidth:vt,availableHeight:jt,rects:Nt}){if(!L.current)return;const ln=Ie.style;ln.setProperty(jY,`${vt}px`),ln.setProperty(NY,`${jt}px`);const He=Fs(Ie).devicePixelRatio||1,{x:Me,y:We,width:gt,height:st}=Nt.reference,xt=(Math.round((Me+gt)*He)-Math.round(Me*He))/He,ft=(Math.round((We+st)*He)-Math.round(We*He))/He;ln.setProperty("--anchor-width",`${xt}px`),ln.setProperty("--anchor-height",`${ft}px`)}}),Utt(Ie=>({element:ce.current||lr(Ie.elements.floating).createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Ie){var ot,vn,Ye;const{elements:vt,middlewareData:jt,placement:Nt,rects:ln,y:He}=Ie,Me=Qu(Nt),We=Iu(Me),gt=ce.current,st=((ot=jt.arrow)==null?void 0:ot.x)||0,xt=((vn=jt.arrow)==null?void 0:vn.y)||0,ft=(gt==null?void 0:gt.clientWidth)||0,Ht=(gt==null?void 0:gt.clientHeight)||0,cn=st+ft/2,hn=xt+Ht/2,Ge=Math.abs(((Ye=jt.shift)==null?void 0:Ye.y)||0),bt=ln.reference.height/2,St=typeof s=="function"?s(RY(Ie,r,I)):s,dn=Ge>St,Rt={top:`${cn}px calc(100% + ${St}px)`,bottom:`${cn}px ${-St}px`,left:`calc(100% + ${St}px) ${hn}px`,right:`${-St}px ${hn}px`}[Me],$e=`${cn}px ${ln.reference.y+bt-He}px`;return vt.floating.style.setProperty("--transform-origin",pe&&We==="y"&&dn?$e:Rt),{}}},Qtt,O),Un(()=>{!v&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[v,b]);const Se=p.useMemo(()=>({elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:Le,elements:be,x:Ve,y:ve,middlewareData:Re,update:ne,placement:ge,context:Ce,isPositioned:ke,floatingStyles:Ke}=t({rootContext:b,open:g?v:void 0,placement:K,middleware:ye,strategy:i,whileElementsMounted:g?void 0:(...Ie)=>Y6(...Ie,Se),nodeId:w,externalTree:k}),{sideX:it,sideY:ue}=Re.adaptiveOrigin||ztt,xe=ke?i:"fixed",Te=p.useMemo(()=>{let Ie;return ke?O?Ie={position:xe,[it]:Ve,[ue]:ve}:Ie={...Ke,position:xe}:Ie={position:xe,top:0,left:0},Ie[jY]="100vw",Ie[NY]="100vh",ke||(Ie.opacity=0),Ie},[O,xe,it,Ve,ue,ve,Ke,ke]),qe=p.useRef(null);Un(()=>{if(!v)return;const Ie=M.current,vt=typeof Ie=="function"?Ie():Ie,Nt=(IY(vt)?vt.current:vt)||null||null;Nt!==qe.current&&(Le.setPositionReference(Nt),qe.current=Nt)},[v,Le,D,M]),p.useEffect(()=>{if(!v)return;const Ie=M.current;typeof Ie!="function"&&IY(Ie)&&Ie.current!==qe.current&&(Le.setPositionReference(Ie.current),qe.current=Ie.current)},[v,Le,D,M]),p.useEffect(()=>{if(g&&v&&be.reference&&be.floating)return Y6(be.reference,be.floating,ne,Se)},[g,v,be,ne,Se]);const De=Qu(ge),At=uAe(r,De,I),It=Ep(ge)||"center",lt=!!((dt=Re.hide)!=null&&dt.referenceHidden);Un(()=>{S&&v&&ke&&De!==H&&E(De)},[S,v,ke,De,H]);const Ot=p.useMemo(()=>{var Ie,vt;return{position:"absolute",top:(Ie=Re.arrow)==null?void 0:Ie.y,left:(vt=Re.arrow)==null?void 0:vt.x}},[Re.arrow]),Ct=((yt=Re.arrow)==null?void 0:yt.centerOffset)!==0;return p.useMemo(()=>({positionerStyles:Te,arrowStyles:Ot,arrowRef:ce,arrowUncentered:Ct,side:At,align:It,physicalSide:De,anchorHidden:lt,refs:Le,context:Ce,isPositioned:ke,update:ne}),[Te,Ot,ce,Ct,At,It,De,lt,Le,Ce,ke,ne])}function IY(e){return e!=null&&"current"in e}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=pN.startingStyle]="startingStyle",e[e.endingStyle=pN.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const qtt={"data-popup-open":""},Wtt={"data-popup-open":"","data-pressed":""},Ktt={"data-open":""},Gtt={"data-closed":""},Xtt={"data-anchor-hidden":""},Ytt={open(e){return e?qtt:null}},Ztt={open(e){return e?Wtt:null}},GU={open(e){return e?Ktt:Gtt},anchorHidden(e){return e?Xtt:null}},dAe={...GU,...KI};function fAe(e){return e==="starting"?YJe:Cl}function Jtt(e,t,{styles:n,transitionStatus:i,props:r,refs:s,hidden:o,inert:l=!1}){const c={...n};return l&&(c.pointerEvents="none"),Do("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:o,style:c},fAe(i),r],stateAttributesMapping:GU})}function hAe(){const e=SU(),t=e.useState("toasts");return p.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function ent({orientation:e="vertical",maxHeight:t,hideScrollbar:n=!1,fadeEdges:i=!1,contentClassName:r="",className:s="",style:o,children:l,hasMore:c=!1,onLoadMore:u,threshold:d=24,onScroll:f,ref:h,...m}){const[g,b]=p.useState(!1),[v,y]=p.useState(!1),[x,w]=p.useState({top:!1,bottom:!1}),O=p.useRef(null),S=p.useRef(null),k=i&&e!=="horizontal",C=!!u&&e!=="horizontal";p.useImperativeHandle(h,()=>O.current,[]),p.useEffect(()=>()=>{var _;(_=S.current)==null||_.abort()},[]);const E=p.useCallback(()=>{const _=O.current;if(!k||!_)return;const j=_.scrollHeight-_.clientHeight,T=j>1&&_.scrollTop>1,N=j>1&&j-_.scrollTop>1;w(A=>A.top===T&&A.bottom===N?A:{top:T,bottom:N})},[k]);p.useEffect(()=>{const _=O.current;if(!k||!_)return;const j=new ResizeObserver(E);j.observe(_);for(const T of _.children)j.observe(T);return E(),()=>j.disconnect()},[k,C,E]);async function R(){if(!u||!c||S.current)return;const _=new AbortController;S.current=_,b(!0),y(!1);try{await u(_.signal)}catch{_.signal.aborted||y(!0)}finally{_.signal.aborted||b(!1),S.current===_&&(S.current=null)}}return a.jsxs("div",{...m,ref:O,className:`studio-scroll-area ${s}`.trim(),"data-orientation":e,"data-hide-scrollbar":n||void 0,"data-fade-edges":k&&(x.top||x.bottom)||void 0,"data-fade-top":k&&x.top||void 0,"data-fade-bottom":k&&x.bottom||void 0,style:{maxHeight:t,...o},onScroll:_=>{f==null||f(_),E();const j=_.currentTarget;!_.defaultPrevented&&e!=="horizontal"&&!v&&j.scrollTop>0&&j.scrollHeight-j.clientHeight-j.scrollTop<=Math.max(0,d)&&R()},children:[a.jsx("div",{className:`studio-scroll-area__content ${r}`.trim(),"aria-busy":u?g:void 0,children:l}),u&&e!=="horizontal"&&a.jsx(a.Fragment,{children:a.jsxs("div",{className:"studio-scroll-area__footer",children:[g?a.jsx(MCe,{size:24}):a.jsx("span",{role:"status","aria-live":"polite",children:v?"加载失败":c?"向下滚动加载更多":"已加载全部"}),!g&&c&&a.jsx("button",{type:"button",onClick:()=>void R(),children:v?"重试":"加载更多"})]})})]})}function tnt(){const{add:e,close:t}=hAe();return{add:p.useCallback(({id:i,title:r,description:s,variant:o="info",duration:l,action:c,closeLabel:u,onClose:d})=>e({id:i,title:r,description:s,timeout:l,priority:"low",onClose:d,data:{variant:o,action:c,closeLabel:u}}),[e]),dismiss:t}}function nnt({position:e,label:t}){const{toasts:n,close:i}=hAe();return a.jsx(wet,{children:a.jsx(qJe,{className:"studio-toast-viewport","data-position":e,"data-empty":n.length===0||void 0,"aria-label":t,render:a.jsx(ent,{contentClassName:"studio-toast-viewport__stack"}),children:n.map(r=>{var s,o,l;return a.jsx(uet,{toast:r,className:"studio-toast-root",swipeDirection:[],children:a.jsx(OZe,{role:"presentation",variant:(s=r.data)==null?void 0:s.variant,title:r.title!=null?a.jsx(pet,{render:a.jsx("div",{}),children:r.title}):void 0,description:r.description!=null?a.jsx(het,{render:a.jsx("div",{}),children:r.description}):void 0,action:(o=r.data)==null?void 0:o.action,closeLabel:(l=r.data)==null?void 0:l.closeLabel,onDismiss:()=>i(r.id)})},r.id)})})})}function int({children:e,duration:t=4e3,position:n="top-center",label:i="通知"}){return a.jsxs(_Je,{timeout:t,limit:3,children:[e,a.jsx(nnt,{position:n,label:i})]})}function rnt({ownerId:e,sessionId:t,onOpen:n,hideNotices:i,refreshKey:r,onUpdate:s}){const{t:o}=Ae("sandbox"),l=tnt(),c=p.useRef(new Map),u=p.useRef(new Map),d=p.useRef(null),f=p.useRef({sessionId:t,onOpen:n,toast:l,t:o,hideNotices:i,onUpdate:s});return f.current={sessionId:t,onOpen:n,toast:l,t:o,hideNotices:i,onUpdate:s},p.useEffect(()=>{if(i){f.current.toast.dismiss(),u.current.clear();return}for(const h of c.current.values())h.sessionId===t&&(f.current.toast.dismiss(h.runId),u.current.delete(h.runId))},[t,i]),p.useEffect(()=>{var h;(h=d.current)==null||h.call(d)},[r]),p.useEffect(()=>{if(!e)return;const h=new AbortController,m=c.current,g=u.current,b=new Set;let v,y=!1,x=[],w="";const O=(C,E=w)=>{var R,_;w=E,h.signal.aborted||(_=(R=f.current).onUpdate)==null||_.call(R,{ownerId:e,runs:x,loading:C,error:E})},S=C=>{const{toast:E,t:R,sessionId:_,onOpen:j}=f.current;if(!h.signal.aborted){if(f.current.hideNotices||C.sessionId===_){E.dismiss(C.runId),g.delete(C.runId);return}b.has(C.runId)||g.get(C.runId)===C.state||(g.set(C.runId,C.state),E.add({id:C.runId,duration:0,title:R(`taskNotice.${C.state}`),description:C.message.slice(0,80),variant:C.state==="succeeded"?"success":C.state==="failed"?"error":"info",closeLabel:R("taskNotice.hide"),onClose:()=>b.add(C.runId),action:a.jsx(LCe,{variant:"secondary",onClick:()=>{j(C.sessionId,h.signal).catch(T=>{h.signal.aborted||E.add({id:"task-open-error",variant:"error",description:T instanceof Error?T.message:String(T)})})},children:R("taskNotice.open")})}))}},k=async(C=!1)=>{if(!(y||h.signal.aborted)){clearTimeout(v),y=!0,C&&O(!0);try{const E=await pd.active(h.signal);if(h.signal.aborted)return;x=E,O(!1,"");const R=new Set(E.map(_=>_.runId));for(const _ of m.values())if(!R.has(_.runId)&&!Fc(_)){let j;try{j=await pd.get(_.runId,h.signal)}catch(T){if(T instanceof Hx&&T.status===404){m.delete(_.runId),g.delete(_.runId),f.current.toast.dismiss(_.runId);continue}throw T}if(h.signal.aborted)return;m.set(j.runId,j),S(j)}for(const _ of E)m.set(_.runId,_),S(_);f.current.toast.dismiss("task-connection")}catch(E){if(h.signal.aborted)return;E instanceof Hx&&[401,403].includes(E.status)&&(x=[],m.clear(),g.clear(),f.current.toast.dismiss()),O(!1,E instanceof Error?E.message:f.current.t("taskNotice.reconnecting")),!h.signal.aborted&&m.size&&!f.current.hideNotices&&f.current.toast.add({id:"task-connection",duration:0,description:f.current.t("taskNotice.reconnecting")})}finally{y=!1,h.signal.aborted||(v=setTimeout(k,3e3))}}};return d.current=()=>{k(!0)},O(!0),k(),()=>{h.abort(),clearTimeout(v),d.current=null,f.current.toast.dismiss()}},[e]),null}function snt(e){const{t}=Ae("sandbox");return a.jsx(int,{position:"bottom-right",label:t("taskNotice.label"),children:a.jsx(rnt,{...e},e.ownerId)})}const $S=["super_admin","admin","developer","user"];class FS extends Error{constructor(t,n){super(t),this.code=t,this.status=n}}async function pAe(e){let t;try{t=await e.json()}catch{throw new FS("invalid_response",e.status)}if(!e.ok){const n=t&&typeof t=="object"&&"code"in t&&typeof t.code=="string"?t.code:"request_failed";throw new FS(n,e.status)}return t}function mAe(e){return!e||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"email"in e&&typeof e.email=="string"&&"role"in e&&$S.some(t=>t===e.role)&&"status"in e&&typeof e.status=="string"&&"lastLogin"in e&&typeof e.lastLogin=="string"&&"protected"in e&&typeof e.protected=="boolean"&&"currentUser"in e&&typeof e.currentUser=="boolean"&&"roleConflict"in e&&typeof e.roleConflict=="boolean"}async function ont(e){const t=new URLSearchParams({page:String(e.page),pageSize:"20",query:e.query});e.role&&t.set("role",e.role);const n=await pAe(await gn(`/web/users?${t}`,{signal:e.signal,cache:"no-store"}));if(!n||typeof n!="object"||!("items"in n)||!Array.isArray(n.items)||!n.items.every(mAe)||!("total"in n)||typeof n.total!="number"||!("poolTotal"in n)||typeof n.poolTotal!="number"||!("page"in n)||typeof n.page!="number"||!("pageSize"in n)||typeof n.pageSize!="number"||!("userPoolId"in n)||typeof n.userPoolId!="string"||!("clientId"in n)||typeof n.clientId!="string"||!("provider"in n)||!["volcengine","byteplus"].includes(String(n.provider)))throw new FS("invalid_response",502);return n}async function ant(e,t,n){const i=await pAe(await gn(`/web/users/${encodeURIComponent(e.id)}/role`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t,expectedRole:e.role}),signal:n}));if(!i||typeof i!="object"||!("user"in i)||!mAe(i.user))throw new FS("invalid_response",502);return i.user}function lnt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 9.5 5 5 5-5"})})}function cnt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m6.5 12.5 3.5 3.5 7.5-8"})})}function Ag({ariaLabel:e,value:t,valueLabel:n,placeholder:i,options:r,disabled:s=!1,searchValue:o,searchPlaceholder:l,loading:c=!1,hasMore:u=!1,emptyMessage:d,onSearchChange:f,onLoadMore:h,onChange:m}){const{t:g}=Ae("ui"),b=l??g("deploymentSelect.searchPlaceholder"),v=d??g("deploymentSelect.emptyMessage"),y=p.useId(),x=p.useRef(null),w=p.useRef(null),O=p.useRef(null),S=p.useRef(null),k=p.useRef([]),[C,E]=p.useState(!1),[R,_]=p.useState(0),j=r.find(L=>L.value===t),T=(j==null?void 0:j.label)??(t?n:void 0),N=o!==void 0&&!!f,A=()=>{E(!1),N&&o&&(f==null||f(""))};p.useEffect(()=>{if(!C)return;const L=U=>{U.target instanceof Node&&x.current&&!x.current.contains(U.target)&&A()};return window.addEventListener("pointerdown",L),()=>window.removeEventListener("pointerdown",L)},[C,f,o,N]),p.useEffect(()=>{var L,U;if(C){if(N){(L=O.current)==null||L.focus();return}(U=k.current[R])==null||U.focus()}},[C,N]),p.useEffect(()=>{var L;!C||N&&document.activeElement===O.current||(L=k.current[R])==null||L.focus()},[R,C,N]),p.useEffect(()=>{_(L=>Math.min(L,Math.max(0,r.length-1)))},[r.length]),p.useEffect(()=>{if(!C||!u||c||!h)return;const L=window.requestAnimationFrame(()=>{const U=S.current;U&&U.scrollHeight<=U.clientHeight+1&&h()});return()=>window.cancelAnimationFrame(L)},[u,c,h,C,r.length]);const P=(L=1)=>{const U=r.findIndex(H=>H.value===t),I=U>=0?U:L===1?0:Math.max(0,r.length-1);_(I),E(!0)},D=L=>{r.length!==0&&_((L+r.length)%r.length)},M=L=>{var U;m(L.value),A(),(U=w.current)==null||U.focus()};return a.jsxs("div",{className:"pp-deployment-select",ref:x,onKeyDown:L=>{var I,H;const U=L.target===O.current;if(L.key==="Escape"&&C){L.preventDefault(),A(),(I=w.current)==null||I.focus();return}if(L.key==="Tab"){A();return}if(U){L.key==="ArrowDown"&&r.length>0&&(L.preventDefault(),_(0),(H=k.current[0])==null||H.focus());return}L.key==="ArrowDown"?(L.preventDefault(),C?D(R+1):P(1)):L.key==="ArrowUp"?(L.preventDefault(),C?D(R-1):P(-1)):C&&L.key==="Home"?(L.preventDefault(),_(0)):C&&L.key==="End"&&(L.preventDefault(),_(Math.max(0,r.length-1)))},children:[a.jsxs("button",{ref:w,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":C,"aria-controls":C?y:void 0,disabled:s,onClick:()=>{C?A():P()},children:[a.jsx("span",{className:T?void 0:"is-placeholder",children:T??i}),a.jsx(lnt,{className:`pp-deployment-select-chevron${C?" is-open":""}`})]}),C&&a.jsxs("div",{className:"pp-deployment-select-menu",children:[N&&a.jsx("div",{className:"pp-deployment-select-search",children:a.jsx("input",{ref:O,type:"search",value:o,"aria-label":g("deploymentSelect.searchAriaLabel",{label:e}),placeholder:b,autoComplete:"off",onChange:L=>f==null?void 0:f(L.currentTarget.value)})}),a.jsx("div",{id:y,ref:S,className:"pp-deployment-select-options",role:"listbox","aria-label":e,"aria-busy":c||void 0,onScroll:L=>{if(!u||c||!h)return;const U=L.currentTarget;U.scrollHeight-U.scrollTop-U.clientHeight<=24&&h()},children:r.map((L,U)=>{const I=L.value===t;return a.jsxs("button",{ref:H=>{k.current[U]=H},type:"button",role:"option","aria-selected":I,tabIndex:U===R?0:-1,className:`pp-deployment-select-option${I?" is-selected":""}`,title:L.description,onFocus:()=>_(U),onClick:()=>M(L),children:[a.jsxs("span",{className:"pp-deployment-select-copy",children:[a.jsxs("span",{className:"pp-deployment-select-name",children:[L.label,L.badge&&a.jsx("span",{className:"pp-deployment-select-badge",children:L.badge})]}),L.description&&a.jsx("small",{children:L.description})]}),I&&a.jsx(cnt,{})]},L.value)})}),c&&a.jsx("div",{className:"pp-deployment-select-state","aria-live":"polite",children:g("deploymentSelect.loadingMore")}),!c&&r.length===0&&a.jsx("div",{className:"pp-deployment-select-state",children:v})]})]})}function YI({label:e,onClick:t}){return a.jsx("button",{type:"button",className:"page-back-button","aria-label":e,title:e,onClick:t,children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m14.5 6-6 6 6 6"})})})}function yn({as:e="span",className:t="",duration:n=4,spread:i=20,children:r,style:s,...o}){const l=Math.min(Math.max(i,5),45);return a.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...s,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...o,children:r})}function unt(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M16 7a6.5 6.5 0 1 0 .2 5M16 3.5V7h-3.5"})})}function gAe(e){return e instanceof FS?e.code:"request_failed"}function dnt({user:e,onClose:t,onSaved:n}){const{t:i,i18n:r}=Ae("users"),s=p.useRef(null),o=p.useRef(null),l=p.useId(),c=p.useId(),[u,d]=p.useState(e.role),[f,h]=p.useState(!1),[m,g]=p.useState("");p.useEffect(()=>{const v=s.current,y=document.activeElement;return v==null||v.showModal(),()=>{var x;(x=o.current)==null||x.abort(),v==null||v.close(),y instanceof HTMLElement&&y.isConnected&&y.focus()}},[]);const b=async()=>{if(f||u===e.role&&!e.roleConflict)return;const v=new AbortController;o.current=v,h(!0),g("");try{const y=await ant(e,u,v.signal);v.signal.aborted||n(y)}catch(y){v.signal.aborted||g(i(`errors.${gAe(y)}`,{defaultValue:i("errors.request_failed")}))}finally{v.signal.aborted||h(!1)}};return a.jsxs("dialog",{ref:s,className:"user-role-dialog","aria-labelledby":l,"aria-describedby":c,"aria-busy":f,onCancel:v=>{v.preventDefault(),f||t()},children:[a.jsxs("header",{children:[a.jsx("h2",{id:l,children:i("changeRole")}),a.jsx("button",{type:"button",className:"users-close",onClick:t,disabled:f,"aria-label":i("close"),children:a.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:a.jsx("path",{d:"m5 5 10 10M15 5 5 15"})})})]}),a.jsxs("div",{className:"user-role-dialog-body",children:[a.jsxs("div",{className:"users-account",children:[a.jsx("strong",{children:e.name}),a.jsx("span",{children:e.email||e.id})]}),a.jsx("label",{className:"users-field-label",children:i("role")}),a.jsx(Ag,{ariaLabel:i("role"),placeholder:i("role"),value:u,disabled:f,options:$S.map(v=>({value:v,label:i(`roles.${v}`),description:i(`descriptions.${v}`)})),onChange:v=>{const y=$S.find(x=>x===v);y&&d(y)}},r.resolvedLanguage),a.jsx("p",{id:c,className:"users-help",children:i("effectiveAfterRefresh")}),m?a.jsx("p",{className:"users-error",role:"alert",children:m}):null]}),a.jsxs("footer",{children:[a.jsx("button",{className:"users-button",type:"button",disabled:f,onClick:t,children:i("cancel")}),a.jsx("button",{className:"users-button is-primary",type:"button",disabled:f||u===e.role&&!e.roleConflict,onClick:()=>void b(),children:i(f?"saving":"save")})]})]})}function fnt({onBack:e}){const{t,i18n:n}=Ae("users"),[i,r]=p.useState(null),[s,o]=p.useState(!0),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(""),[m,g]=p.useState(""),[b,v]=p.useState(1),[y,x]=p.useState(0),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(null);p.useEffect(()=>{const T=new AbortController;return o(!0),c(""),ont({page:b,query:f,role:m,signal:T.signal}).then(N=>{if(!T.signal.aborted){if(N.total>0&&N.items.length===0&&b>1){v(1);return}r(N),E(new Date)}}).catch(N=>{T.signal.aborted||c(gAe(N))}).finally(()=>{T.signal.aborted||o(!1)}),()=>T.abort()},[b,f,m,y]);const R=T=>{T.preventDefault(),h(u.trim()),v(1),x(N=>N+1)},_=T=>{if(!T)return t("neverLoggedIn");const N=Number(T),A=new Date(Number.isFinite(N)&&N>0?N<1e12?N*1e3:N:T);return Number.isNaN(A.getTime())?t("unknown"):A.toLocaleString(n.resolvedLanguage,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})},j=Math.max(1,Math.ceil(((i==null?void 0:i.total)??0)/20));return a.jsxs("section",{className:"users-page","aria-labelledby":"users-title",children:[a.jsxs("header",{className:"users-page-header",children:[a.jsx(YI,{label:t("back"),onClick:e}),a.jsx("h1",{id:"users-title",children:t("title")}),i?a.jsx("span",{className:"users-count",children:t("memberCount",{count:i.poolTotal})}):null]}),a.jsxs("div",{className:"users-content",children:[i?a.jsxs("div",{className:"users-pool",children:[a.jsx("span",{children:i.provider==="byteplus"?"BytePlus Identity":t("volcengineIdentity")}),a.jsxs("span",{className:"users-pool-id",title:i.userPoolId,children:[t("pool")," ",i.userPoolId]})]}):null,a.jsxs("div",{className:"users-toolbar",children:[a.jsxs("form",{className:"users-search",onSubmit:R,children:[a.jsx("input",{value:u,onChange:T=>d(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.nativeEvent.isComposing||T.keyCode===229)&&T.preventDefault()},"aria-label":t("searchPlaceholder"),placeholder:t("searchPlaceholder"),maxLength:200}),a.jsx("button",{type:"submit",className:"users-button",disabled:s,children:t("search")})]}),a.jsx("div",{className:"users-role-filter",children:a.jsx(Ag,{ariaLabel:t("filterRole"),placeholder:t("allRoles"),value:m,options:[{value:"",label:t("allRoles")},...$S.map(T=>({value:T,label:t(`roles.${T}`)}))],onChange:T=>{const N=$S.find(A=>A===T);g(N??""),v(1)}})}),a.jsxs("button",{type:"button",className:"users-button users-refresh",disabled:s,onClick:()=>{k(null),x(T=>T+1)},children:[a.jsx(unt,{}),a.jsx("span",{children:t("refresh")})]})]}),a.jsx("div",{className:"users-feedback","aria-live":"polite",children:s?a.jsx(yn,{children:t("loading")}):S?a.jsx("span",{children:t("saved",{name:S.name,role:t(`roles.${S.role}`)})}):C?a.jsx("span",{children:t("updatedAt",{time:C.toLocaleTimeString(n.resolvedLanguage,{hour:"2-digit",minute:"2-digit",hour12:!1})})}):null}),l?a.jsxs("div",{className:"users-error users-error-banner",role:"alert",children:[a.jsx("span",{children:t(`errors.${l}`,{defaultValue:t("errors.request_failed")})}),a.jsx("button",{type:"button",className:"users-button",onClick:()=>x(T=>T+1),children:t("retry")})]}):null,a.jsxs("div",{className:"users-table-wrap","aria-busy":s,children:[a.jsxs("table",{className:"users-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:t("user")}),a.jsx("th",{scope:"col",children:t("role")}),a.jsx("th",{scope:"col",children:t("status")}),a.jsx("th",{scope:"col",children:t("lastLogin")}),a.jsx("th",{scope:"col",children:a.jsx("span",{className:"sr-only",children:t("actions")})})]})}),a.jsx("tbody",{children:i==null?void 0:i.items.map(T=>{var N;return a.jsxs("tr",{children:[a.jsx("td",{"data-label":t("user"),children:a.jsxs("div",{className:"users-person",children:[a.jsx("span",{className:"users-avatar","aria-hidden":"true",children:(N=Array.from(T.name)[0])==null?void 0:N.toUpperCase()}),a.jsxs("div",{className:"users-account",children:[a.jsxs("strong",{children:[T.name,T.currentUser?a.jsx("span",{className:"users-self",children:t("you")}):null]}),a.jsx("span",{title:T.email||T.id,children:T.email||T.id})]})]})}),a.jsxs("td",{"data-label":t("role"),children:[a.jsx("span",{className:`users-role-badge${T.role==="super_admin"?" is-super":""}`,children:t(`roles.${T.role}`)}),T.roleConflict?a.jsx("span",{className:"users-inline-warning",children:t("roleConflict")}):null]}),a.jsx("td",{"data-label":t("status"),children:a.jsx("span",{className:"users-status",children:t(`states.${T.status}`,{defaultValue:t("unknown")})})}),a.jsx("td",{"data-label":t("lastLogin"),className:"users-last-login",children:_(T.lastLogin)}),a.jsx("td",{className:"users-actions",children:T.protected?a.jsx("span",{className:"users-protected",title:t("protectedExplanation"),children:t("initialAdministrator")}):a.jsx("button",{type:"button",className:"users-button is-text",disabled:s||!!l||T.currentUser,onClick:()=>{k(null),O(T)},children:t("changeRole")})})]},T.id)})})]}),!s&&!l&&(i==null?void 0:i.items.length)===0?a.jsxs("div",{className:"users-empty",children:[a.jsx("strong",{children:t("noUsers")}),a.jsx("span",{children:t(f||m?"tryAnotherSearch":"poolEmpty")})]}):null,s&&!i?a.jsx("div",{className:"users-empty",children:a.jsx(yn,{children:t("loading")})}):null]}),i?a.jsxs("footer",{className:"users-pagination",children:[a.jsx("span",{children:t("resultCount",{count:i.total})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",className:"users-button",disabled:b<=1||s,onClick:()=>v(T=>T-1),children:t("previous")}),a.jsxs("span",{children:[b," / ",j]}),a.jsx("button",{type:"button",className:"users-button",disabled:b>=j||s,onClick:()=>v(T=>T+1),children:t("next")})]})]}):null]}),w?a.jsx(dnt,{user:w,onClose:()=>O(null),onSaved:T=>{O(null),k(T),x(N=>N+1)}}):null]})}const hnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M5.293 12.707a1 1 0 0 1 0-1.414l5-5a1 1 0 1 1 1.414 1.414L8.414 11H18a1 1 0 1 1 0 2H8.414l3.293 3.293a1 1 0 0 1-1.414 1.414l-5-5Z",clipRule:"evenodd"})}),pnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M18.707 12.707a1 1 0 0 0 0-1.414l-5-5a1 1 0 1 0-1.414 1.414L15.586 11H6a1 1 0 1 0 0 2h9.586l-3.293 3.293a1 1 0 0 0 1.414 1.414l5-5Z",clipRule:"evenodd"})}),mnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M4.47192 2.5C5.02421 2.5 5.47192 2.94772 5.47192 3.5V5.07196C7.17065 3.47759 9.45675 2.5 11.9719 2.5C17.2186 2.5 21.4719 6.75329 21.4719 12C21.4719 17.2467 17.2186 21.5 11.9719 21.5C7.10262 21.5 3.0902 17.8375 2.53692 13.1164C2.47264 12.5679 2.8652 12.0711 3.41373 12.0068C3.96226 11.9425 4.45904 12.3351 4.52333 12.8836C4.95991 16.6089 8.12901 19.5 11.9719 19.5C16.1141 19.5 19.4719 16.1421 19.4719 12C19.4719 7.85786 16.1141 4.5 11.9719 4.5C9.75153 4.5 7.75552 5.46469 6.38146 7H9.00003C9.55232 7 10 7.44772 10 8C10 8.55228 9.55232 9 9.00003 9H4.47192C3.93256 9 3.49293 8.57299 3.47265 8.03859C3.47175 8.01771 3.47151 7.99677 3.47192 7.9758V3.5C3.47192 2.94772 3.91964 2.5 4.47192 2.5Z",fill:"currentColor"})}),ZI=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M2.55823 12C2.55823 6.75329 6.81152 2.5 12.0582 2.5C14.5734 2.5 16.8595 3.47759 18.5582 5.07197V3.5C18.5582 2.94772 19.0059 2.5 19.5582 2.5C20.1105 2.5 20.5582 2.94772 20.5582 3.5V7.97591C20.5586 7.99622 20.5584 8.01651 20.5576 8.03674C20.5382 8.572 20.0982 9 19.5582 9H15.0582C14.5059 9 14.0582 8.55228 14.0582 8C14.0582 7.44772 14.5059 7 15.0582 7H17.6487C16.2746 5.46469 14.2786 4.5 12.0582 4.5C7.91609 4.5 4.55823 7.85786 4.55823 12C4.55823 16.1421 7.91609 19.5 12.0582 19.5C15.9011 19.5 19.0702 16.6089 19.5068 12.8836C19.5711 12.3351 20.0679 11.9425 20.6164 12.0068C21.165 12.0711 21.5575 12.5679 21.4932 13.1164C20.94 17.8375 16.9275 21.5 12.0582 21.5C6.81152 21.5 2.55823 17.2467 2.55823 12Z",fill:"currentColor"})}),xA=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z",clipRule:"evenodd"})}),gnt=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M10.663 6.3872C10.8152 6.29068 11 6.40984 11 6.59007V8C11 8.55229 11.4477 9 12 9C12.5523 9 13 8.55229 13 8V6.59007C13 6.40984 13.1848 6.29068 13.337 6.3872C14.036 6.83047 14.5 7.61105 14.5 8.5C14.5 9.53284 13.8737 10.4194 12.9801 10.8006C12.9932 10.865 13 10.9317 13 11V13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13V11C11 10.9317 11.0068 10.865 11.0199 10.8006C10.1263 10.4194 9.5 9.53284 9.5 8.5C9.5 7.61105 9.96397 6.83047 10.663 6.3872Z",fill:"currentColor"}),a.jsx("path",{d:"M17.9754 4.01031C17.8588 4.00078 17.6965 4.00001 17.4 4.00001H9.8C8.94342 4.00001 8.36113 4.00078 7.91104 4.03756C7.47262 4.07338 7.24842 4.1383 7.09202 4.21799C6.7157 4.40974 6.40973 4.7157 6.21799 5.09202C6.1383 5.24842 6.07337 5.47263 6.03755 5.91104C6.00078 6.36113 6 6.94343 6 7.80001V16.1707C6.31278 16.0602 6.64937 16 7 16H18L18 4.60001C18 4.30348 17.9992 4.14122 17.9897 4.02464C17.9893 4.02 17.9889 4.0156 17.9886 4.01145C17.9844 4.01107 17.98 4.01069 17.9754 4.01031ZM17.657 18H7C6.44772 18 6 18.4477 6 19C6 19.5523 6.44772 20 7 20H17.657C17.5343 19.3301 17.5343 18.6699 17.657 18ZM4 19L4 7.75871C3.99999 6.95374 3.99998 6.28937 4.04419 5.74818C4.09012 5.18608 4.18868 4.66938 4.43597 4.18404C4.81947 3.43139 5.43139 2.81947 6.18404 2.43598C6.66937 2.18869 7.18608 2.09012 7.74818 2.0442C8.28937 1.99998 8.95373 1.99999 9.7587 2L17.4319 2C17.6843 1.99997 17.9301 1.99994 18.1382 2.01695C18.3668 2.03563 18.6366 2.07969 18.908 2.21799C19.2843 2.40974 19.5903 2.7157 19.782 3.09203C19.9203 3.36345 19.9644 3.63318 19.9831 3.86178C20.0001 4.06994 20 4.31574 20 4.56812L20 17C20 17.1325 19.9736 17.2638 19.9225 17.386C19.4458 18.5253 19.4458 19.4747 19.9225 20.614C20.0517 20.9227 20.0179 21.2755 19.8325 21.5541C19.6471 21.8326 19.3346 22 19 22H7C5.34315 22 4 20.6569 4 19Z",fill:"currentColor"})]}),Gx=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),bAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM16.0755 7.93219C16.5272 8.25003 16.6356 8.87383 16.3178 9.32549L11.5678 16.0755C11.3931 16.3237 11.1152 16.4792 10.8123 16.4981C10.5093 16.517 10.2142 16.3973 10.0101 16.1727L7.51006 13.4227C7.13855 13.014 7.16867 12.3816 7.57733 12.0101C7.98598 11.6386 8.61843 11.6687 8.98994 12.0773L10.6504 13.9039L14.6822 8.17451C15 7.72284 15.6238 7.61436 16.0755 7.93219Z",fill:"currentColor"})}),bnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 9",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"})}),ynt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",clipRule:"evenodd"})}),vnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})}),XU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 6C12.5523 6 13 6.44772 13 7V12C13 12.2652 12.8946 12.5196 12.7071 12.7071L10.2071 15.2071C9.81658 15.5976 9.18342 15.5976 8.79289 15.2071C8.40237 14.8166 8.40237 14.1834 8.79289 13.7929L11 11.5858V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),xnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12.659 9.753a1 1 0 0 1-1.318 0l-4-3.5A1 1 0 1 1 8.66 4.747L12 7.671l3.341-2.924a1 1 0 1 1 1.318 1.506l-4 3.5Zm-4.002 9.501a1 1 0 1 1-1.314-1.508l4-3.485a1 1 0 0 1 1.314 0l4 3.485a1 1 0 1 1-1.314 1.508L12 16.34l-3.343 2.913Z"})}),YU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),wnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),Ont=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z"})}),knt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 10 16",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"})}),Snt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),Ent=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M12 7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8h-3a1 1 0 0 1-1-1Zm-5 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),Cnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),Tnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M14.4472 7.10558C14.9412 7.35257 15.1414 7.95324 14.8944 8.44722L10.8944 16.4472C10.6474 16.9412 10.0468 17.1414 9.55279 16.8944C9.05881 16.6474 8.85858 16.0468 9.10557 15.5528L13.1056 7.55279C13.3526 7.05881 13.9532 6.85859 14.4472 7.10558ZM6.6 7.20001C7.04183 7.53138 7.13137 8.15818 6.8 8.60001L4.25 12L6.8 15.4C7.13137 15.8418 7.04183 16.4686 6.6 16.8C6.15817 17.1314 5.53137 17.0418 5.2 16.6L2.2 12.6C1.93333 12.2444 1.93333 11.7556 2.2 11.4L5.2 7.40001C5.53137 6.95818 6.15817 6.86863 6.6 7.20001ZM17.4 7.20001C17.8418 6.86863 18.4686 6.95818 18.8 7.40001L21.8 11.4C22.0667 11.7556 22.0667 12.2444 21.8 12.6L18.8 16.6C18.4686 17.0418 17.8418 17.1314 17.4 16.8C16.9582 16.4686 16.8686 15.8418 17.2 15.4L19.75 12L17.2 8.60001C16.8686 8.15818 16.9582 7.53138 17.4 7.20001Z",fill:"currentColor"})}),yAe=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z"}),a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z",clipRule:"evenodd"})]}),Ant=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M7.79289 9.04289C8.18342 8.65237 8.81658 8.65237 9.20711 9.04289L11.4571 11.2929C11.8476 11.6834 11.8476 12.3166 11.4571 12.7071L9.20711 14.9571C8.81658 15.3476 8.18342 15.3476 7.79289 14.9571C7.40237 14.5666 7.40237 13.9334 7.79289 13.5429L9.33579 12L7.79289 10.4571C7.40237 10.0666 7.40237 9.43342 7.79289 9.04289ZM12.25 14.25C12.25 13.6977 12.6977 13.25 13.25 13.25H15.5C16.0523 13.25 16.5 13.6977 16.5 14.25C16.5 14.8023 16.0523 15.25 15.5 15.25H13.25C12.6977 15.25 12.25 14.8023 12.25 14.25Z",fill:"currentColor"}),a.jsx("path",{d:"M2 8C2 5.79086 3.79086 4 6 4C6.55228 4 7 4.44772 7 5C7 5.55228 6.55228 6 6 6C4.89543 6 4 6.89543 4 8V16C4 17.1046 4.89543 18 6 18C6.55228 18 7 18.4477 7 19C7 19.5523 6.55228 20 6 20C3.79086 20 2 18.2091 2 16V8ZM17 5C17 4.44772 17.4477 4 18 4C20.2091 4 22 5.79086 22 8V16C22 18.2091 20.2091 20 18 20C17.4477 20 17 19.5523 17 19C17 18.4477 17.4477 18 18 18C19.1046 18 20 17.1046 20 16V8C20 6.89543 19.1046 6 18 6C17.4477 6 17 5.55228 17 5Z",fill:"currentColor"})]}),_nt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),jnt=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M12.75 9.50001C12.75 9.08579 13.0858 8.75001 13.5 8.75001H14.5C14.9142 8.75001 15.25 9.08579 15.25 9.50001V14.5C15.25 14.9142 14.9142 15.25 14.5 15.25H13.5C13.0858 15.25 12.75 14.9142 12.75 14.5V9.50001Z",fill:"currentColor"}),a.jsx("path",{d:"M9.50001 8.75001C9.08579 8.75001 8.75001 9.08579 8.75001 9.50001V14.5C8.75001 14.9142 9.08579 15.25 9.50001 15.25H10.5C10.9142 15.25 11.25 14.9142 11.25 14.5V9.50001C11.25 9.08579 10.9142 8.75001 10.5 8.75001H9.50001Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.97144 12C1.97144 6.46138 6.46138 1.97144 12 1.97144C17.5386 1.97144 22.0286 6.46138 22.0286 12C22.0286 17.5386 17.5386 22.0286 12 22.0286C6.46138 22.0286 1.97144 17.5386 1.97144 12ZM12 4.02858C7.59751 4.02858 4.02858 7.59751 4.02858 12C4.02858 16.4025 7.59751 19.9714 12 19.9714C16.4025 19.9714 19.9714 16.4025 19.9714 12C19.9714 7.59751 16.4025 4.02858 12 4.02858Z",fill:"currentColor"})]}),PY=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M9.5 9.33165V14.6683C9.5 15.4595 10.3752 15.9373 11.0408 15.5095L15.1915 12.8412C15.8038 12.4475 15.8038 11.5524 15.1915 11.1588L11.0408 8.49047C10.3752 8.06265 9.5 8.54049 9.5 9.33165Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z",fill:"currentColor"})]}),Nnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M8 16.7229V7.27711C8 6.29075 9.08894 5.69298 9.9211 6.22254L17.3428 10.9454C18.1147 11.4366 18.1147 12.5634 17.3428 13.0546L9.92109 17.7775C9.08894 18.3071 8 17.7093 8 16.7229Z",fill:"currentColor"})}),vAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),xAe=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 3C12.5523 3 13 3.44772 13 4L13 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13L13 13L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 13L4 13C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11L11 11L11 4C11 3.44772 11.4477 3 12 3Z",fill:"currentColor"})}),Rnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),Int=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.875 4.5C7.35418 4.5 4.5 7.35418 4.5 10.875C4.5 14.3958 7.35418 17.25 10.875 17.25C14.3958 17.25 17.25 14.3958 17.25 10.875C17.25 7.35418 14.3958 4.5 10.875 4.5ZM2.5 10.875C2.5 6.24962 6.24962 2.5 10.875 2.5C15.5004 2.5 19.25 6.24962 19.25 10.875C19.25 12.8273 18.582 14.6236 17.462 16.0478L21.2071 19.7929C21.5976 20.1834 21.5976 20.8166 21.2071 21.2071C20.8166 21.5976 20.1834 21.5976 19.7929 21.2071L16.0478 17.462C14.6236 18.582 12.8273 19.25 10.875 19.25C6.24962 19.25 2.5 15.5004 2.5 10.875Z",fill:"currentColor"})}),Pnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),Dnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M6 8C6 6.89543 6.89543 6 8 6H16C17.1046 6 18 6.89543 18 8V16C18 17.1046 17.1046 18 16 18H8C6.89543 18 6 17.1046 6 16V8Z",fill:"currentColor"})}),Mnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M14.5 4a5.5 5.5 0 0 0-5.078 7.616 1 1 0 0 1-.216 1.092l-4.749 4.75a1.475 1.475 0 0 0 2.086 2.085l4.749-4.749a1 1 0 0 1 1.092-.216A5.5 5.5 0 0 0 20 9.414l-1.293 1.293a3.828 3.828 0 1 1-5.414-5.414L14.585 4H14.5ZM7 9.5a7.5 7.5 0 0 1 9.969-7.084 1 1 0 0 1 .378 1.651l-2.64 2.64a1.829 1.829 0 0 0 2.586 2.586l2.64-2.64a1 1 0 0 1 1.651.378 7.5 7.5 0 0 1-9.328 9.627l-4.299 4.3a3.475 3.475 0 0 1-4.914-4.915l4.299-4.299A7.497 7.497 0 0 1 7 9.5Z"})}),j_=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})}),Lnt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5555 4C10.099 4 9.70052 4.30906 9.58693 4.75114L9.29382 5.8919H14.715L14.4219 4.75114C14.3083 4.30906 13.9098 4 13.4533 4H10.5555ZM16.7799 5.8919L16.3589 4.25342C16.0182 2.92719 14.8226 2 13.4533 2H10.5555C9.18616 2 7.99062 2.92719 7.64985 4.25342L7.22886 5.8919H4C3.44772 5.8919 3 6.33961 3 6.8919C3 7.44418 3.44772 7.8919 4 7.8919H4.10069L5.31544 19.3172C5.47763 20.8427 6.76455 22 8.29863 22H15.7014C17.2354 22 18.5224 20.8427 18.6846 19.3172L19.8993 7.8919H20C20.5523 7.8919 21 7.44418 21 6.8919C21 6.33961 20.5523 5.8919 20 5.8919H16.7799ZM17.888 7.8919H6.11196L7.30423 19.1057C7.3583 19.6142 7.78727 20 8.29863 20H15.7014C16.2127 20 16.6417 19.6142 16.6958 19.1057L17.888 7.8919ZM10 10C10.5523 10 11 10.4477 11 11V16C11 16.5523 10.5523 17 10 17C9.44772 17 9 16.5523 9 16V11C9 10.4477 9.44772 10 10 10ZM14 10C14.5523 10 15 10.4477 15 11V16C15 16.5523 14.5523 17 14 17C13.4477 17 13 16.5523 13 16V11C13 10.4477 13.4477 10 14 10Z"})}),$nt=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M7.5 5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM3 7.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM17 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Zm-8.96 8.247C3.137 17.048 2.5 18.271 2.5 20a1 1 0 1 1-2 0c0-2.271.862-4.049 2.21-5.248C4.042 13.57 5.788 13 7.5 13s3.459.57 4.79 1.752c1.348 1.2 2.21 2.977 2.21 5.248a1 1 0 1 1-2 0c0-1.729-.638-2.952-1.54-3.753C10.042 15.43 8.788 15 7.5 15s-2.541.43-3.46 1.247Zm15.757-.607c-1.009-.638-2.338-.807-3.526-.472a1 1 0 0 1-.542-1.925c1.695-.478 3.616-.255 5.136.706 1.558.984 2.635 2.707 2.635 5.051a1 1 0 1 1-2 0c0-1.665-.732-2.746-1.703-3.36Z",clipRule:"evenodd"})}),wAe=e=>a.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[a.jsx("path",{d:"M10.42 2.006a4 4 0 0 1 3.159 0c.674.29 1.188.822 1.667 1.456.474.627 1 1.473 1.653 2.523l3.542 5.696c.72 1.16 1.3 2.09 1.682 2.854.384.766.654 1.517.59 2.292a4 4 0 0 1-1.604 2.886c-.625.463-1.405.63-2.258.709-.85.078-1.945.078-3.311.078H8.46c-1.366 0-2.46 0-3.31-.078-.854-.078-1.634-.246-2.26-.71a4 4 0 0 1-1.603-2.885c-.064-.775.206-1.526.59-2.292.383-.764.961-1.694 1.682-2.854l3.542-5.696c.653-1.05 1.18-1.896 1.653-2.523.48-.634.993-1.166 1.667-1.456Zm2.37 1.838a2 2 0 0 0-1.58 0c-.192.083-.448.28-.86.825-.413.544-.891 1.312-1.577 2.415l-3.488 5.61c-.755 1.214-1.283 2.066-1.62 2.737-.34.678-.402 1.02-.385 1.232a2 2 0 0 0 .802 1.443c.171.127.494.255 1.25.324.748.069 1.75.07 3.18.07h6.976c1.43 0 2.432-.001 3.18-.07.756-.069 1.079-.197 1.25-.324a2 2 0 0 0 .802-1.443c.017-.212-.045-.554-.385-1.232-.337-.671-.865-1.523-1.62-2.737l-3.488-5.61c-.686-1.103-1.164-1.87-1.576-2.415-.413-.546-.67-.742-.861-.825"}),a.jsx("path",{d:"M12 7.5a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0v-3a1 1 0 0 1 1-1M10.851 15a1.15 1.15 0 1 1 2.3 0 1.15 1.15 0 0 1-2.3 0"})]}),ZU=e=>a.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M5.636 5.636a1 1 0 0 1 1.414 0l4.95 4.95 4.95-4.95a1 1 0 0 1 1.414 1.414L13.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414L12 13.414l-4.95 4.95a1 1 0 0 1-1.414-1.414l4.95-4.95-4.95-4.95a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})});/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lnt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OAe=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** + */const Fnt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OAe=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var $nt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var Bnt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fnt=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...l},c)=>p.createElement("svg",{ref:c,...$nt,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:OAe("lucide",r),...l},[...o.map(([u,d])=>p.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + */const Unt=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...l},c)=>p.createElement("svg",{ref:c,...Bnt,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:OAe("lucide",r),...l},[...o.map(([u,d])=>p.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wn=(e,t)=>{const n=p.forwardRef(({className:i,...r},s)=>p.createElement(Fnt,{ref:s,iconNode:t,className:OAe(`lucide-${Lnt(e)}`,i),...r}));return n.displayName=`${e}`,n};/** + */const wn=(e,t)=>{const n=p.forwardRef(({className:i,...r},s)=>p.createElement(Unt,{ref:s,iconNode:t,className:OAe(`lucide-${Fnt(e)}`,i),...r}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -158,7 +158,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bnt=wn("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + */const Qnt=wn("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -168,7 +168,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Unt=wn("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const znt=wn("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -183,12 +183,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qnt=wn("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + */const Vnt=wn("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const znt=wn("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const Hnt=wn("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -198,12 +198,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vnt=wn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const qnt=wn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hnt=wn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const Wnt=wn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -218,7 +218,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qnt=wn("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Knt=wn("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -228,12 +228,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wnt=wn("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const Gnt=wn("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Knt=wn("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + */const Xnt=wn("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -243,12 +243,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gnt=wn("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const Ynt=wn("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xnt=wn("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const Znt=wn("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -273,17 +273,17 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ynt=wn("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const Jnt=wn("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Znt=wn("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + */const eit=wn("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jnt=wn("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** + */const tit=wn("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -293,7 +293,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eit=wn("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** + */const nit=wn("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -303,12 +303,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tit=wn("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** + */const iit=wn("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nit=wn("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const rit=wn("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -318,17 +318,17 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iit=wn("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + */const sit=wn("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rit=wn("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const oit=wn("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sit=wn("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + */const ait=wn("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -353,7 +353,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oit=wn("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + */const lit=wn("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -363,12 +363,12 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ait=wn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const cit=wn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lit=wn("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const uit=wn("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -378,7 +378,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cit=wn("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const dit=wn("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -388,17 +388,17 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uit=wn("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const fit=wn("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dit=wn("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const hit=wn("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fit=wn("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const pit=wn("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -408,7 +408,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hit=wn("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const mit=wn("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -418,7 +418,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pit=wn("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** + */const git=wn("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -428,7 +428,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mit=wn("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + */const bit=wn("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -443,7 +443,7 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const git=wn("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** + */const yit=wn("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -453,18 +453,18 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bit=wn("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const vit=wn("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yit=wn("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const xit=wn("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xa=wn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),LY=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),I_=Object.freeze({modelName:"",current:LY,cumulative:LY}),vit={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},xit=24,wit=64,Oit=16;function wA(e){var l,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,i=((l=t.match(n))==null?void 0:l.length)??0,r=t.replace(n," "),s=(r.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),o=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+o}function kit(e){var l,c,u;const t=((l=e.instruction)==null?void 0:l.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],i=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],r=wA(t),s=n.reduce((d,f)=>d+wit+wA(f),0),o=i.reduce((d,f)=>d+Oit+wA(f.name)+wA(f.description??""),0);return xit+r+s+o}function Sit({usage:e,contextWindow:t,estimatedSystemTokens:n}){const i=Math.max(1,Math.round(t)),r=Math.max(0,e.current.promptTokenCount),s=Math.max(r,e.current.totalTokenCount),o=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,r-o),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:o+c;return{systemTokens:o,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function Eit(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let i=0;const r=t.map(s=>{const o=i;return i+=s.tokens,{...s,start:o,end:i}});return Array.from({length:100},(s,o)=>{const l=o*n,c=l+n,u=r.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(l,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:o,slices:u}})}function J1(e,t){const n=e,i=n[t]??n[vit[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function Cit(e){const t=J1(e,"promptTokenCount"),n=J1(e,"candidatesTokenCount"),i=J1(e,"thoughtsTokenCount");return{totalTokenCount:J1(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:J1(e,"cachedContentTokenCount")}}function Tit(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function jAe(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",i=typeof t.model_version=="string"?t.model_version.trim():"",r=n||i||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return r===e.modelName?e:{...e,modelName:r};const o=Cit(s);return o.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:o,cumulative:Tit(e.cumulative,o)}}function $Y(e){return e.reduce((t,n)=>jAe(t,n),I_)}function FY(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function Ait(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function _it(e,t){if(!t)return e;const n=new Set(e.filter(r=>Ait(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function gy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Em(e){return typeof e=="string"?e:""}function NAe(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function jit(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=gy(t)??{};return gy(n.result)??n}function Nit(e){var n;const t=(n=gy(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(i=>{var r;return Em((r=gy(i))==null?void 0:r.label)}):[]}function RAe(e,t,n){const i=Nit(e),r=jit(t),s=Array.isArray(r.branches)?r.branches:[],o=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=gy(s[c])??{};return{label:Em(u.label)||i[c]||`方向 ${c+1}`,content:Em(u.content),status:NAe(u.status,o),error:Em(u.error)}})}}function Rit(e){const t=gy(e),n=gy(t==null?void 0:t.veadkStudioToolProgress);return!n||n.toolName!=="branch_compare"||typeof n.branchIndex!="number"||n.branchIndex<0||n.branchIndex>1?null:{toolName:"branch_compare",requestId:Em(n.requestId),branchIndex:n.branchIndex,label:Em(n.label),delta:Em(n.delta),status:NAe(n.status,"running"),error:Em(n.error)||void 0}}function Iit(e,t,n){return{branches:RAe(e,t,"running").branches.map((s,o)=>o===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}function Ca(e,t){return mn.t(`blocks.codexProgress.${e}`,{ns:"conversation",...t})}const IAe=28e4;function BY(e){try{return JSON.stringify(e).length}catch{return IAe}}function Pit(e){const t=e.slice(-200);let n=t.reduce((i,r)=>i+BY(r),0);for(;t.length>1&&n>IAe;)n-=BY(t.shift());return t}function Hc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Bi(e){return typeof e=="string"?e:""}function nQ(e,t=""){const n=Bi(e).toLowerCase();return t.endsWith(".failed")||["failed","error","declined","cancelled"].includes(n)?"failed":t.endsWith(".completed")||["completed","done","success"].includes(n)?"completed":"running"}function PAe(e){if(e.response!==void 0)return e.response;if(e.result!==void 0)return e.result;const t=e.aggregatedOutput??e.aggregated_output??e.output,n=e.exitCode??e.exit_code;if(!(t===void 0&&n===void 0))return{...t!==void 0?{output:t}:{},...n!==void 0?{exitCode:n}:{}}}function DAe(e){if(e.args!==void 0)return e.args;if(e.arguments!==void 0)return e.arguments;if(e.input!==void 0)return e.input;const t=Bi(e.command),n=Bi(e.cwd);if(t||n)return{...t?{command:t}:{},...n?{cwd:n}:{}};if(e.changes!==void 0)return{changes:e.changes};if(e.approval!==void 0)return e.approval}function bb(e,t,n,i,r){return{kind:"tool",name:e,callId:t,args:i,response:r,done:n!=="running",status:n,...n==="failed"?{defaultOpen:!0}:{}}}function MAe(e){const t=Bi(e.id||e.itemId||e.item_id),n=Bi(e.kind);if(!t||!n)return null;const i=nQ(e.status),r=Bi(e.text||e.detail||e.delta),s=!Bi(e.text||e.detail)&&typeof e.delta=="string";if(n==="thinking"||n==="reasoning")return r?{id:t,block:{kind:"thinking",text:r,done:i!=="running"},appendText:s}:null;if(n==="commentary")return r?{id:t,block:{kind:"text",text:r},appendText:s}:null;if(["message","text","assistant_final","final"].includes(n))return r?{id:t,block:{kind:"text",text:r},appendText:s,finalAnswer:!0}:null;if(n==="plan"){const o=Array.isArray(e.plan)?e.plan:[];return{id:t,block:{kind:"plan",title:Bi(e.title)||Ca("planTitle"),summary:r||void 0,items:o.flatMap(l=>{const c=Hc(l),u=Bi(c==null?void 0:c.text);if(!u)return[];const d=Bi(c==null?void 0:c.status);return[{text:u,status:["pending","in_progress","completed","failed"].includes(d)?d:"pending"}]}),done:i!=="running"}}}if(["tool","command","command_execution","commandExecution","file_change","fileChange","mcp_tool_call","mcpToolCall","collab_tool_call","web_search","approval","status"].includes(n)){const o=Ca(n==="file_change"||n==="fileChange"?"fallback.fileChange":n==="approval"?"fallback.approval":n==="status"?"fallback.status":"fallback.command"),l=DAe(e),c=PAe(e)??(n==="status"&&r||void 0);return{id:t,block:bb(Bi(e.name||e.title)||o,t,i,l,c)}}return null}function LAe(e){const t=Bi(e.type),n=Hc(e.item),i=Bi(n==null?void 0:n.type),r=Bi((n==null?void 0:n.id)||e.id)||(t==="turn.failed"?"turn":"");if(!r)return null;const s=nQ(n==null?void 0:n.status,t);if(i==="reasoning"||i==="agent_message"){const o=Bi(n==null?void 0:n.text);return o?{id:r,block:i==="reasoning"?{kind:"thinking",text:o,done:s!=="running"}:{kind:"text",text:o},...i==="agent_message"&&(n==null?void 0:n.phase)!=="commentary"?{finalAnswer:!0}:{}}:null}if(i==="todo_list"){const l=(Array.isArray(n==null?void 0:n.items)?n.items:[]).flatMap(c=>{const u=Hc(c),d=Bi(u==null?void 0:u.text);if(!d)return[];const f=Bi(u==null?void 0:u.status).toLowerCase(),h=(u==null?void 0:u.completed)===!0||["completed","done"].includes(f)?"completed":["failed","error"].includes(f)?"failed":["in_progress","running"].includes(f)?"in_progress":"pending";return[{text:d,status:h}]});return l.length?{id:r,block:{kind:"plan",title:Ca("planTitle"),summary:Ca("planSummary",{completed:l.filter(c=>c.status==="completed").length,total:l.length}),items:l,done:s!=="running"}}:null}if(i==="command_execution"){const o=Ca(`command.${s}`);return{id:r,block:bb(o,r,s,DAe(n??{}),PAe(n??{}))}}if(i==="file_change"){const o=Array.isArray(n==null?void 0:n.changes)?n.changes:[],l=o.length?Ca("projectFiles",{count:o.length}):Ca("projectFile"),c=Ca(`fileChange.${s}`,{subject:l});return{id:r,block:bb(c,r,s,o.length?{changes:o}:void 0)}}if(i==="mcp_tool_call"){const o=[Bi(n==null?void 0:n.server),Bi(n==null?void 0:n.tool)].filter(Boolean).join("/")||Ca("externalTool"),l=Ca(`mcp.${s}`,{tool:o}),c=Hc(n==null?void 0:n.error),u=(n==null?void 0:n.result)!==void 0?n.result:Bi(c==null?void 0:c.message)||void 0;return{id:r,block:bb(l,r,s,n==null?void 0:n.arguments,u)}}if(i==="collab_tool_call"){const o=Bi(n==null?void 0:n.tool),l=["spawn_agent","send_input","wait","close_agent"].includes(o)?o:"default",c=Ca(`collaboration.${l}.${s}`),u=Object.fromEntries(["tool","receiver_thread_ids","prompt"].filter(d=>(n==null?void 0:n[d])!==void 0).map(d=>[d,n==null?void 0:n[d]]));return{id:r,block:bb(c,r,s,Object.keys(u).length?u:void 0,n==null?void 0:n.agents_states)}}if(i==="web_search"){const o=Ca(`webSearch.${s}`),l=Object.fromEntries(["query","action"].filter(c=>(n==null?void 0:n[c])!==void 0).map(c=>[c,n==null?void 0:n[c]]));return{id:r,block:bb(o,r,s,Object.keys(l).length?l:void 0)}}if(i==="error"||t==="error"||t==="turn.failed"){const o=Hc(e.error),l=Bi((n==null?void 0:n.message)||e.message||(o==null?void 0:o.message))||Ca("errorDetail");return{id:r,block:bb(Ca("errorTitle"),r,"failed",void 0,l)}}return null}function Dit(e){const t=Hc(e),n=Hc(t==null?void 0:t.veadkStudioToolProgress);if(!n||n.kind!=="codex")return null;const i=Bi(n.toolName),r=Bi(n.requestId);if(!i||!r)return null;const s=Hc(n.event??n.activity);if(!s)return null;const o=Hc(s.item)||Bi(s.type)?LAe(s):MAe(s);if(!o)return null;const l=Bi(n.title||n.label),c=Bi(s.agentSessionId??s.agent_session_id),u=Bi(s.sandboxSessionId??s.sandbox_session_id),d=Bi(s.threadId??s.thread_id),f=nQ(s.status,Bi(s.type)),m=Bi(s.kind)==="status"&&f!=="running"?f:void 0;return{toolName:i,requestId:r,...l?{title:l}:{},...c?{agentSessionId:c}:{},...u?{sandboxSessionId:u}:{},...d?{threadId:d}:{},...m?{terminalStatus:m}:{},event:o}}function Mit(e,t){const n=Hc(t),i=Hc((n==null?void 0:n.codexActivity)??(n==null?void 0:n.codex_activity));if(!i)return e;const r=Bi(i.title)||(e==null?void 0:e.title)||"Codex Sandbox",s=Bi(i.agentSessionId??i.agent_session_id)||(e==null?void 0:e.agentSessionId),o=Bi(i.sandboxSessionId??i.sandbox_session_id)||(e==null?void 0:e.sandboxSessionId),l=Bi(i.threadId??i.thread_id)||(e==null?void 0:e.threadId);let c={title:r,...s?{agentSessionId:s}:{},...o?{sandboxSessionId:o}:{},...l?{threadId:l}:{},items:(e==null?void 0:e.items.slice())??[]};const u=Array.isArray(i.events)?i.events:[];for(const d of u){const f=Hc(d);if(!f)continue;const h=Hc(f.item)||Bi(f.type)?LAe(f):MAe(f);h&&(h.finalAnswer||(c=J6(c,{title:r,...s?{agentSessionId:s}:{},...o?{sandboxSessionId:o}:{},...l?{threadId:l}:{},event:h})))}return c}function J6(e,t){const n=(e==null?void 0:e.items.slice())??[],i=n.findIndex(r=>r.id===t.event.id);if(i>=0){const r=n[i].block,s=t.event.block;t.event.appendText&&r.kind==="text"&&s.kind==="text"?n[i]={id:t.event.id,block:{...s,text:r.text+s.text}}:t.event.appendText&&r.kind==="thinking"&&s.kind==="thinking"?n[i]={id:t.event.id,block:{...s,text:r.text+s.text}}:n[i]={id:t.event.id,block:s}}else n.push({id:t.event.id,block:t.event.block});return{title:t.title||(e==null?void 0:e.title)||"Codex Sandbox",...t.agentSessionId||e!=null&&e.agentSessionId?{agentSessionId:t.agentSessionId||(e==null?void 0:e.agentSessionId)}:{},...t.sandboxSessionId||e!=null&&e.sandboxSessionId?{sandboxSessionId:t.sandboxSessionId||(e==null?void 0:e.sandboxSessionId)}:{},...t.threadId||e!=null&&e.threadId?{threadId:t.threadId||(e==null?void 0:e.threadId)}:{},items:Pit(n)}}const $Ae="send_a2ui_json_to_client",eF="validated_a2ui_json",tF="adk_request_credential",UY="transfer_to_agent";function Lit(e){var i,r,s,o;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.exchanged_auth_credential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.oauth2)??((o=t==null?void 0:t.raw_auth_credential)==null?void 0:o.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function nF(){return{blocks:[],liveStart:0,pendingCodexProgress:[]}}function QY(e,t){if(t.event.finalAnswer)return"applied";let n=-1;for(let i=e.length-1;i>=0;i-=1){const r=e[i];if(!(r.kind!=="tool"||r.name!==t.toolName)){if(r.callId===t.requestId)return r.done?"completed":(r.codexActivity=J6(r.codexActivity,t),r.status=t.terminalStatus??"running",t.terminalStatus&&(r.done=!0),"applied");if(!r.done){if(n>=0)return"unmatched";n=i}}}if(n>=0){const i=e[n];return i.kind!=="tool"?"unmatched":(i.codexActivity=J6(i.codexActivity,t),i.status=t.terminalStatus??"running",t.terminalStatus&&(i.done=!0),"applied")}return"unmatched"}function $it(e){if(!e||typeof e!="object"||Array.isArray(e))return"completed";const t=e,n=typeof t.status=="string"?t.status.toLowerCase():"";return t.ok===!1||["error","failed","denied","declined","cancelled","timeout"].includes(n)?"failed":"completed"}function zY(e){if(!e||typeof e!="object"||Array.isArray(e))return"";const t=e;return t.ok!==!0||typeof t.message!="string"?"":t.message.trim()}const iF=e=>e.functionCall??e.function_call,US=e=>e.functionResponse??e.function_response;function Fit(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Bit(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function nP(e){const t=[];for(const[n,i]of e.entries()){const r=i.partMetadata??i.part_metadata,s=r==null?void 0:r.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const o=r==null?void 0:r.veadkMedia;if(typeof(o==null?void 0:o.uri)=="string"){t.push({id:String(o.id??o.uri),mimeType:typeof o.mimeType=="string"?o.mimeType:void 0,uri:o.uri,name:typeof o.name=="string"?o.name:void 0,sizeBytes:typeof o.sizeBytes=="number"?o.sizeBytes:void 0});continue}const l=i.inlineData??i.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:Bit(l.data),name:l.displayName??l.display_name});continue}const c=i.fileData??i.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function QS(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const Uit=new Set(["llm","sequential","parallel","loop","a2a"]);function Qit(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const r=i,s=Array.isArray(r.skills)?r.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let o;const l=r.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Uit.has(u)&&Array.isArray(c.path)&&(o={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||o)return{skills:s,targetAgent:o}}}function zit(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function Vit(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(r=>r.filename===i.filename&&r.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function HL(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function OA(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function FAe(e,t){var d,f,h,m,g,b;const n=e.blocks.map(v=>({...v}));let i=e.liveStart,r=e.pendingCodexProgress.slice();const s=((d=t.content)==null?void 0:d.parts)??[],o=s.flatMap(v=>{const y=Rit(v.partMetadata??v.part_metadata);return y?[y]:[]}),l=s.flatMap(v=>{const y=Dit(v.partMetadata??v.part_metadata);return y?[y]:[]});if(o.length>0||l.length>0){for(const v of o)for(let y=n.length-1;y>=0;y-=1){const x=n[y];if(!(x.kind!=="tool"||x.done||x.name!==v.toolName||v.requestId&&x.callId&&x.callId!==v.requestId)){x.response=Iit(x.args,x.response,v),x.status="running";break}}for(const v of l)QY(n,v)==="unmatched"&&(r=[...r,v].slice(-64));return{blocks:n,liveStart:i,pendingCodexProgress:r}}const c=s.some(v=>iF(v)||US(v));if(t.partial&&!c){for(const v of s){const y=QS(v);typeof y=="string"&&y&&HL(n,v.thought?"thinking":"text",y)}return{blocks:n,liveStart:i,pendingCodexProgress:r}}n.length=i;for(const v of s){const y=iF(v),x=US(v),w=nP([v]),O=QS(v);if(typeof O=="string"&&O)HL(n,v.thought?"thinking":"text",O);else if(w.length)OA(n),zit(n,w);else if(y)if(OA(n),y.name===UY){const S=Fit(y.args)||((f=t.actions)==null?void 0:f.transferToAgent)||((h=t.actions)==null?void 0:h.transfer_to_agent)||mn.t("app:common.unknownAgent");n.push({kind:"agent-transfer",agentName:S,done:!1})}else if(y.name===tF){const S=y.args??{},k=S.authConfig??S.auth_config??S,E=String(S.functionCallId??S.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:y.id??"",label:E,authUri:Lit(k),authConfig:k,done:!1})}else{const S={kind:"tool",name:y.name??"",callId:y.id,args:y.args,done:!1};if(n.push(S),S.callId){const k=[];for(const C of r)C.toolName===S.name&&C.requestId===S.callId?QY(n,C):k.push(C);r=k}}else if(x){if(OA(n),x.name===UY)for(let S=n.length-1;S>=0;S--){const k=n[S];if(k.kind==="agent-transfer"&&!k.done){k.done=!0;break}}if(x.name===tF)for(let S=n.length-1;S>=0;S--){const k=n[S];if(k.kind==="auth"&&!k.done){k.done=!0;break}}for(let S=n.length-1;S>=0;S--){const k=n[S],C=k.kind==="tool"&&k.name==="delegate_to_codex_sandbox";if(k.kind==="tool"&&(!k.done||C)&&k.name===x.name&&(!x.id||!k.callId||k.callId===x.id)){const E=C?zY(k.response):"";if(k.done=!0,k.response=x.response,C){k.codexActivity=Mit(k.codexActivity,x.response),k.status=$it(x.response);const R=zY(x.response);R&&R!==E&&HL(n,"text",R)}break}}if(x.name===$Ae){const S=((m=x.response)==null?void 0:m[eF])??[];if(S.length){const k=n[n.length-1];k&&k.kind==="a2ui"?k.messages.push(...S):n.push({kind:"a2ui",messages:S})}}}}const u=((g=t.actions)==null?void 0:g.artifactDelta)??((b=t.actions)==null?void 0:b.artifact_delta);return u&&Vit(n,Object.entries(u).map(([v,y])=>({filename:v,version:y}))),OA(n),i=n.length,{blocks:n,liveStart:i,pendingCodexProgress:r}}function Hit(e,t){var u,d,f,h,m,g;if(e.partial===!0)return!1;const n=((u=e.content)==null?void 0:u.parts)??[],i=n.some(b=>{const v=QS(b);return!b.thought&&typeof v=="string"&&v.trim().length>0||nP([b]).length>0}),r=n.some(b=>{var y;const v=US(b);return(v==null?void 0:v.name)===$Ae&&Array.isArray((y=v.response)==null?void 0:y[eF])&&v.response[eF].length>0}),s=((d=e.actions)==null?void 0:d.artifactDelta)??((f=e.actions)==null?void 0:f.artifact_delta),o=!!(s&&Object.keys(s).length>0),l=!!(((h=e.actions)==null?void 0:h.endOfAgent)??((m=e.actions)==null?void 0:m.end_of_agent)??((g=e.actions)==null?void 0:g.escalate)),c=t.some(b=>b.kind==="text"||b.kind==="attachment"||b.kind==="artifact"||b.kind==="a2ui"||b.kind==="delivery");return i||r||o||l&&c}function qit(e){var n,i,r;const t=((n=e.actions)==null?void 0:n.artifactDelta)??((i=e.actions)==null?void 0:i.artifact_delta);return t&&Object.keys(t).length>0?!0:(((r=e.content)==null?void 0:r.parts)??[]).some(s=>!!(QS(s)||nP([s]).length>0||iF(s)||US(s)))}function rF(e="adk-stream",t){var o,l,c;let n=0;const i=new Map;let r;const s=(u,d)=>`${d}\0${u}`;if((t==null?void 0:t.role)==="assistant"){const u=((o=t.meta)==null?void 0:o.author)??"",d=((l=t.meta)==null?void 0:l.invocationId)??"",f=((c=t.meta)==null?void 0:c.localId)??`${e}-${n++}`,h=nF();h.blocks=t.blocks,h.liveStart=t.blocks.length,r=s(u,d),i.set(r,{acc:h,localId:f,meta:{...t.meta,localId:f,streaming:!0,eventId:void 0}})}return{project(u){const d=u.author&&u.author!=="user"?u.author:"",f=u.invocationId??u.invocation_id??"",h=s(d,f);let m=i.get(h);if(!m&&r){const y=i.get(r);y&&(!y.meta.author||y.meta.author===d)&&(i.delete(r),r=void 0,m=y)}if(!m&&!qit(u))return{turn:{role:"assistant",blocks:[]},completed:!1,ignored:!0};if(!m){const y=`${e}-${n++}`;m={acc:nF(),localId:y,meta:{author:d||void 0,invocationId:f||void 0}}}m.acc=FAe(m.acc,u);const g=u.usageMetadata??u.usage_metadata,b=Hit(u,m.acc.blocks);m.meta={...m.meta,author:d||m.meta.author,localId:m.localId,streaming:!b,tokens:(g==null?void 0:g.totalTokenCount)||m.meta.tokens,ts:u.timestamp||m.meta.ts,invocationId:f||m.meta.invocationId,eventId:b&&u.id?u.id:m.meta.eventId};const v={role:"assistant",blocks:m.acc.blocks,meta:m.meta};return b?(i.delete(h),r=void 0):i.set(h,m),{turn:v,completed:b}},finish(){const u=[...i.values()].map(d=>({role:"assistant",blocks:d.acc.blocks,meta:{...d.meta,streaming:!1}}));return i.clear(),u}}}function Nb(e,t){var s;const n=(s=t.meta)==null?void 0:s.localId;if(!n)return[...e,t];const i=e.findIndex(o=>{var l;return((l=o.meta)==null?void 0:l.localId)===n});if(i<0)return[...e,t];const r=e.slice();return r[i]=t,r}function Wit(e,t={}){var r;let n=[],i=rF("adk-history");for(const s of e)if(s.author==="user"){const l=((r=s.content)==null?void 0:r.parts)??[];if(l.some(h=>{var m;return((m=US(h))==null?void 0:m.name)===tF})){for(let h=n.length-1;h>=0;h--)if(n[h].role==="assistant"){for(let m=n[h].blocks.length-1;m>=0;m--){const g=n[h].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const c=l.map(QS).filter(h=>!!h).join(""),u=nP(l),d=Qit(l);if(!c&&!u.length&&!d)continue;for(const h of i.finish())n=Nb(n,h);const f=[];d&&f.push({kind:"invocation",value:d}),u.length&&f.push({kind:"attachment",files:u}),c&&f.push({kind:"text",text:c}),n.push({role:"user",blocks:f,meta:{ts:s.timestamp}})}else{const l=i.project(s);l.ignored||(n=Nb(n,l.turn))}for(const s of i.finish())n=Nb(n,s);for(const s of n){const o=s.meta,l=o==null?void 0:o.eventId;if(!l)continue;const c=t[`veadk_feedback:${l}`];if(!c||typeof c!="object")continue;const u=c;u.rating!=="good"&&u.rating!=="bad"||(o.feedback=c)}return n}function iP(e,t=mn.t("app:titles.newConversation")){var n,i;for(const r of e??[])if(r.author==="user"||((n=r.content)==null?void 0:n.role)==="user"){const s=(((i=r.content)==null?void 0:i.parts)??[]).map(o=>o.text).find(Boolean);if(s)return s}return t}function BAe(e,t,n){if(e.name===t||e.id===t)return(n==null?void 0:n.type)==="parallel"?n:void 0;for(const i of e.children){const r=BAe(i,t,e);if(r)return r}}function Kit(e,t){var o,l;if(e.role!=="assistant"||!t)return;const n=(o=e.meta)==null?void 0:o.author;if(!n)return;const i=BAe(t,n);if(!i)return;const r=i.id||i.path.join("/")||i.name;return{key:`${((l=e.meta)==null?void 0:l.invocationId)??""}::${r}`,parent:i.name}}function Git(e,t){const n=[];return e.forEach((i,r)=>{const s=Kit(i,t),o=n[n.length-1];if(s&&(o==null?void 0:o.groupKey)===s.key){o.turnIndexes.push(r);return}n.push({key:s?`parallel-${s.key}-${r}`:`turn-${r}`,turnIndexes:[r],parallelParent:s==null?void 0:s.parent,groupKey:s==null?void 0:s.key})}),n.map(({groupKey:i,...r})=>r)}function Xit(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"9",cy:"8",r:"3.25"}),a.jsx("path",{d:"M2.75 20v-1.5a6.25 6.25 0 0 1 12.5 0V20M16 5.25a3.25 3.25 0 0 1 0 6.5M18 14a5.5 5.5 0 0 1 3.25 5V20"})]})}function UAe(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t{const t=p.Children.toArray(e),n=[];let i="";const r=()=>{i!==""&&(n.push(i),i="")};for(const s of t)if(!(s==null||typeof s=="boolean")){if(typeof s=="string"||typeof s=="number"){i+=String(s);continue}r(),n.push(s)}return r(),n},iQ=e=>{const t=Yit(e),n=p.Children.count(t);return p.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:a.jsx("span",{children:i});if(p.isValidElement(i)){const r=i,{children:s,...o}=r.props;return s!=null?p.cloneElement(r,o,iQ(s)):r}return i})},Zit="_Badge_1viyg_1",Jit={Badge:Zit},Io=({children:e,className:t,variant:n="soft",color:i="secondary",size:r="sm",pill:s,...o})=>a.jsx("div",{className:Ti(Jit.Badge,t),"data-color":i,"data-size":r,"data-pill":s?"":void 0,"data-variant":n,...o,children:iQ(e)});var ert=typeof ym=="object"&&ym&&ym.Object===Object&&ym,trt=typeof self=="object"&&self&&self.Object===Object&&self;ert||trt||Function("return this")();var nrt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function irt(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var VY={width:void 0,height:void 0};function QAe(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:r},s]=p.useState(VY),o=irt(),l=p.useRef({...VY}),c=p.useRef(void 0);return c.current=e.onResize,p.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=HY(d,f,"inlineSize"),m=HY(d,f,"blockSize");if(l.current.width!==h||l.current.height!==m){const b={width:h,height:m};l.current.width=h,l.current.height=m,c.current?c.current(b):o()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,o]),{width:i,height:r}}function HY(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function rQ(e,t){const n=p.useRef(e);nrt(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const rrt={DEV:!1,MODE:"production"},ix=typeof import.meta<"u"?rrt:void 0,srt=!!(ix!=null&&ix.DEV),ort=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",zAe=(ix==null?void 0:ix.MODE)==="test"||ort,art=typeof window<"u",VAe=typeof document<"u",lrt=art&&VAe,sQ=e=>{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let i=.985;n<=80?i=.96:n<=150?i=.97:n<=220?i=.98:n>600&&(i=.995),t.style.setProperty("--scale",i.toString())},xN=(e,t)=>{const n=()=>{const o=setTimeout(e);return()=>{clearTimeout(o)}};if(!lrt||typeof window.requestAnimationFrame!="function"||VAe&&document.visibilityState==="hidden")return n();let r=2,s=window.requestAnimationFrame(function o(){r-=1,r===0?e():s=window.requestAnimationFrame(o)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},zy=e=>Object.keys(e).reduce((n,i)=>{const r=e[i];if(r||r===0){const s=i.startsWith("--")?"":"--",o=typeof r=="number"?`${r}px`:r;n[`${s}${i}`]=o}return n},{}),qL=e=>typeof e=="number"?`${e}deg`:e,WL=e=>String(e),kA=e=>`${e}ms`,KL=({x:e,y:t,scale:n,rotate:i,skewX:r,skewY:s}={})=>{const o=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,i==null?null:`rotate(${qL(i)})`,r==null?null:`skewX(${qL(r)})`,s==null?null:`skewY(${qL(s)})`].filter(Boolean);return o.length?o.join(" "):"none"},GL=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Kh=e=>{e.preventDefault()},HAe=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),crt="_LoadingIndicator_7yl6f_1",urt={LoadingIndicator:crt},yC=({className:e,size:t,strokeWidth:n,style:i,...r})=>a.jsx("div",{...r,className:Ti(urt.LoadingIndicator,e),style:i||zy({"indicator-size":t,"indicator-stroke":n})});var drt=Object.defineProperty,oQ=(e,t)=>drt(e,"name",{value:t,configurable:!0});function sF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}oQ(sF,"setRef");function qAe(...e){return t=>{let n=!1;const i=e.map(r=>{const s=sF(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;rfrt(e,"name",{value:t,configurable:!0});function cp(e){const t=p.forwardRef((n,i)=>{let{children:r,...s}=n,o=null,l=!1;const c=[];oF(r)&&typeof SA=="function"&&(r=SA(r._payload)),p.Children.forEach(r,h=>{var m;if(ZAe(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;oF(b)&&typeof SA=="function"&&(b=SA(b._payload)),o=hrt(g,b),c.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else c.push(h)}),o?o=p.cloneElement(o,void 0,c):!l&&p.Children.count(r)===1&&p.isValidElement(r)&&(o=r);const u=o?YAe(o):void 0,d=pr(i,u);if(!o){if(r||r===0)throw new Error(l?grt(e):mrt(e));return r}const f=XAe(s,o.props??{});return o.type!==p.Fragment&&(f.ref=i?d:u),p.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}Ld(cp,"createSlot");var WAe=cp("Slot"),KAe=Symbol.for("radix.slottable");function GAe(e){const t=Ld(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=KAe,t}Ld(GAe,"createSlottable");var hrt=Ld((e,t)=>{if("child"in e.props){const n=e.props.child;return p.isValidElement(n)?p.cloneElement(n,void 0,e.props.children(n.props.children)):null}return p.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function XAe(e,t){const n={...t};for(const i in t){const r=e[i],s=t[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...l)=>{const c=s(...l);return r(...l),c}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}Ld(XAe,"mergeProps");function YAe(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ld(YAe,"getElementRef");function ZAe(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KAe}Ld(ZAe,"isSlottable");var prt=Symbol.for("react.lazy");function oF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===prt&&"_payload"in e&&JAe(e._payload)}Ld(oF,"isLazyComponent");function JAe(e){return typeof e=="object"&&e!==null&&"then"in e}Ld(JAe,"isPromiseLike");var mrt=Ld(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),grt=Ld(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),SA=Py[" use ".trim().toString()],brt=Object.defineProperty,yrt=(e,t)=>brt(e,"name",{value:t,configurable:!0}),vrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mr=vrt.reduce((e,t)=>{const n=cp(`Primitive.${t}`),i=p.forwardRef((r,s)=>{const{asChild:o,...l}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function aQ(e,t){e&&ri.flushSync(()=>e.dispatchEvent(t))}yrt(aQ,"dispatchDiscreteCustomEvent");var xrt=Object.defineProperty,wrt=(e,t)=>xrt(e,"name",{value:t,configurable:!0}),Ort=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),krt=p.forwardRef(wrt(function(t,n){return a.jsx(Mr.span,{...t,ref:n,style:{...Ort,...t.style}})},"VisuallyHidden")),Srt=krt,Ert=Object.defineProperty,_u=(e,t)=>Ert(e,"name",{value:t,configurable:!0});function Crt(e,t){const n=p.createContext(t);n.displayName=e+"Context";const i=_u(s=>{const{children:o,...l}=s,c=p.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})},"Provider");i.displayName=e+"Provider";function r(s,o={}){const{optional:l=!1}=o,c=p.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return _u(r,"useContext"),[i,r]}_u(Crt,"createContext");function hc(e,t=[]){let n=[];function i(s,o){const l=p.createContext(o);l.displayName=s+"Context";const c=n.length;n=[...n,o];const u=_u(f=>{var y;const{scope:h,children:m,...g}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=p.useMemo(()=>g,Object.values(g));return a.jsx(b.Provider,{value:v,children:m})},"Provider");u.displayName=s+"Provider";function d(f,h,m={}){var y;const{optional:g=!1}=m,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=p.useContext(b);if(v)return v;if(o!==void 0)return o;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return _u(d,"useContext"),[u,d]}_u(i,"createContext");const r=_u(()=>{const s=n.map(o=>p.createContext(o));return _u(function(l){const c=(l==null?void 0:l[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return r.scopeName=e,[i,e2e(r,...t)]}_u(hc,"createContextScope");function e2e(...e){const t=e[0];if(e.length===1)return t;const n=_u(()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return _u(function(s){const o=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}_u(e2e,"composeContextScopes");var Trt=Object.defineProperty,ha=(e,t)=>Trt(e,"name",{value:t,configurable:!0});function lQ(e){const t=e+"CollectionProvider",[n,i]=hc(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=ha(b=>{const{scope:v,children:y}=b,x=p.useRef(null),w=p.useRef(new Map).current;return a.jsx(r,{scope:v,itemMap:w,collectionRef:x,children:y})},"CollectionProvider");o.displayName=t;const l=e+"CollectionSlot",c=cp(l),u=p.forwardRef((b,v)=>{const{scope:y,children:x}=b,w=s(l,y),O=pr(v,w.collectionRef);return a.jsx(c,{ref:O,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=cp(d),m=p.forwardRef((b,v)=>{const{scope:y,children:x,...w}=b,O=p.useRef(null),S=pr(v,O),k=s(d,y);return p.useEffect(()=>(k.itemMap.set(O,{ref:O,...w}),()=>void k.itemMap.delete(O))),a.jsx(h,{[f]:"",ref:S,children:x})});m.displayName=d;function g(b){const v=s(e+"CollectionConsumer",b);return p.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((k,C)=>w.indexOf(k.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return ha(g,"useCollection"),[{Provider:o,Slot:u,ItemSlot:m},g,i]}ha(lQ,"createCollection");var qY=new WeakMap,Co,$c,XL=($c=class extends Map{constructor(n){super(n);OW(this,Co);SM(this,Co,[...super.keys()]),qY.set(this,!0)}set(n,i){return qY.get(this)&&(this.has(n)?Za(this,Co)[Za(this,Co).indexOf(n)]=n:Za(this,Co).push(n)),super.set(n,i),this}insert(n,i,r){const s=this.has(i),o=Za(this,Co).length,l=cQ(n);let c=l>=0?l:o+l;const u=c<0||c>=o?-1:c;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(i,r),this;const d=this.size+(s?0:1);l<0&&c++;const f=[...Za(this,Co)];let h,m=!1;for(let g=c;g=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,i){const r=this.indexOf(n);if(r===-1)return;let s=r+i;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return s;r++}}findIndex(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return r;r++}return-1}filter(n,i){const r=[];let s=0;for(const o of this)Reflect.apply(n,i,[o,s,this])&&r.push(o),s++;return new $c(r)}map(n,i){const r=[];let s=0;for(const o of this)r.push([o[0],Reflect.apply(n,i,[o,s,this])]),s++;return new $c(r)}reduce(...n){const[i,r]=n;let s=0,o=r??this.at(0);for(const l of this)s===0&&n.length===1?o=l:o=Reflect.apply(i,this,[o,l,s,this]),s++;return o}reduceRight(...n){const[i,r]=n;let s=r??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,o,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new $c(i)}toReversed(){const n=new $c;for(let i=this.size-1;i>=0;i--){const r=this.keyAt(i),s=this.get(r);n.set(r,s)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new $c(i)}slice(n,i){const r=new $c;let s=this.size-1;if(n===void 0)return r;n<0&&(n=n+this.size),i!==void 0&&i>0&&(s=i-1);for(let o=n;o<=s;o++){const l=this.keyAt(o),c=this.get(l);r.set(l,c)}return r}every(n,i){let r=0;for(const s of this){if(!Reflect.apply(n,i,[s,r,this]))return!1;r++}return!0}some(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return!0;r++}return!1}},Co=new WeakMap,ha($c,"OrderedDict"),$c);function P_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=t2e(e,t);return n===-1?void 0:e[n]}ha(P_,"at");function t2e(e,t){const n=e.length,i=cQ(t),r=i>=0?i:n+i;return r<0||r>=n?-1:r}ha(t2e,"toSafeIndex");function cQ(e){return e!==e||e===0?0:Math.trunc(e)}ha(cQ,"toSafeInteger");function Art(e){const t=e+"CollectionProvider",[n,i]=hc(t),[r,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new XL,setItemMap:ha(()=>{},"setItemMap")}),o=ha(({state:w,...O})=>w?a.jsx(c,{...O,state:w}):a.jsx(l,{...O}),"CollectionProvider");o.displayName=t;const l=ha(w=>{const O=v();return a.jsx(c,{...w,state:O})},"CollectionInit");l.displayName=t+"Init";const c=ha(w=>{const{scope:O,children:S,state:k}=w,C=p.useRef(null),[E,R]=p.useState(null),_=pr(C,R),[j,T]=k;return p.useEffect(()=>{if(!E)return;const N=r2e(()=>{});return N.observe(E,{childList:!0,subtree:!0}),()=>{N.disconnect()}},[E]),a.jsx(r,{scope:O,itemMap:j,setItemMap:T,collectionRef:_,collectionRefObject:C,collectionElement:E,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=cp(u),f=p.forwardRef((w,O)=>{const{scope:S,children:k}=w,C=s(u,S),E=pr(O,C.collectionRef);return a.jsx(d,{ref:E,children:k})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=cp(h),b=p.forwardRef((w,O)=>{const{scope:S,children:k,...C}=w,E=p.useRef(null),[R,_]=p.useState(null),j=pr(O,E,_),T=s(h,S),{setItemMap:N}=T,A=p.useRef(C);n2e(A.current,C)||(A.current=C);const P=A.current;return p.useEffect(()=>{const D=P;return N(M=>R?M.has(R)?M.set(R,{...D,element:R}).toSorted(aF):(M.set(R,{...D,element:R}),M.toSorted(aF)):M),()=>{N(M=>!R||!M.has(R)?M:(M.delete(R),new XL(M)))}},[R,P,N]),a.jsx(g,{[m]:"",ref:j,children:k})});b.displayName=h;function v(){return p.useState(new XL)}ha(v,"useInitCollection");function y(w){const{itemMap:O}=s(e+"CollectionConsumer",w);return O}return ha(y,"useCollection"),[{Provider:o,Slot:f,ItemSlot:b},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}ha(Art,"createCollection");function n2e(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}ha(n2e,"shallowEqual");function i2e(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ha(i2e,"isElementPreceding");function aF(e,t){return!e[1].element||!t[1].element?0:i2e(e[1].element,t[1].element)?-1:1}ha(aF,"sortByDocumentPosition");function r2e(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}ha(r2e,"getChildListObserver");var _rt=Object.defineProperty,Qw=(e,t)=>_rt(e,"name",{value:t,configurable:!0}),s2e=!!(typeof window<"u"&&window.document&&window.document.createElement);function An(e,t,{checkForDefaultPrevented:n=!0}={}){return Qw(function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)},"handleEvent")}Qw(An,"composeEventHandlers");function jrt(e){var t;if(!s2e)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Qw(jrt,"getOwnerWindow");function lF(e){if(!s2e)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Qw(lF,"getOwnerDocument");function o2e(e,t=!1){const{activeElement:n}=lF(e);if(!(n!=null&&n.nodeName))return null;if(a2e(n)&&n.contentDocument)return o2e(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const r=lF(n).getElementById(i);if(r)return r}}return n}Qw(o2e,"getActiveElement");function a2e(e){return e.tagName==="IFRAME"}Qw(a2e,"isFrame");var zu=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Nrt=Object.defineProperty,Rrt=(e,t)=>Nrt(e,"name",{value:t,configurable:!0}),WY=Py[" useEffectEvent ".trim().toString()],KY=Py[" useInsertionEffect ".trim().toString()];function l2e(e){if(typeof WY=="function")return WY(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof KY=="function"?KY(()=>{t.current=e}):zu(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Rrt(l2e,"useEffectEvent");var Irt=Object.defineProperty,vC=(e,t)=>Irt(e,"name",{value:t,configurable:!0}),Prt=Py[" useInsertionEffect ".trim().toString()]||zu;function Ju({prop:e,defaultProp:t,onChange:n=vC(()=>{},"onChange"),caller:i}){const[r,s,o]=c2e({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:r,u=p.useCallback(d=>{var f;if(l){const h=u2e(d)?d(e):d;h!==e&&((f=o.current)==null||f.call(o,h))}else s(d)},[l,e,s,o]);return[c,u]}vC(Ju,"useControllableState");function c2e({defaultProp:e,onChange:t}){const[n,i]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Prt(()=>{s.current=t},[t]),p.useEffect(()=>{var o;r.current!==n&&((o=s.current)==null||o.call(s,n),r.current=n)},[n,r]),[n,i,s]}vC(c2e,"useUncontrolledState");function u2e(e){return typeof e=="function"}vC(u2e,"isFunction");var GY=Symbol("RADIX:SYNC_STATE");function Drt(e,t,n,i){const{prop:r,defaultProp:s,onChange:o,caller:l}=t,c=r!==void 0,u=l2e(o),d=[{...n,state:s}];i&&d.push(i);const[f,h]=p.useReducer((v,y)=>{if(y.type===GY)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),m=f.state,g=p.useRef(m);p.useEffect(()=>{g.current!==m&&(g.current=m,c||u(m))},[m,g,c]);const b=p.useMemo(()=>r!==void 0?{...f,state:r}:f,[f,r]);return p.useEffect(()=>{c&&!Object.is(r,f.state)&&h({type:GY,state:r})},[r,f.state,c]),[b,h]}vC(Drt,"useControllableStateReducer");var Mrt=Object.defineProperty,up=(e,t)=>Mrt(e,"name",{value:t,configurable:!0});function d2e(e,t){return p.useReducer((n,i)=>t[n][i]??n,e)}up(d2e,"useStateMachine");var Qf=up(e=>{const{present:t,children:n}=e,i=f2e(t),r=typeof n=="function"?n({present:i.isPresent}):p.Children.only(n),s=h2e(i.ref,p2e(r));return typeof n=="function"||i.isPresent?p.cloneElement(r,{ref:s}):null},"Presence");function f2e(e){const[t,n]=p.useState(),i=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),o=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=d2e(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=o.current??sv(i.current),o.current=void 0):s.current="none"},[c]),zu(()=>{const d=i.current,f=r.current;if(f!==e){const m=s.current,g=sv(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),zu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=up(g=>{const v=sv(i.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(u("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),m=up(g=>{g.target===t&&(s.current=sv(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:p.useCallback(d=>{if(d){const f=getComputedStyle(d);i.current=f,o.current=sv(f)}else i.current=null;n(d)},[])}}up(f2e,"usePresence");function cF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}up(cF,"setRef");function h2e(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const i=t.current;let r=!1;const s=i.map(o=>{const l=cF(o,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;oLrt(e,"name",{value:t,configurable:!0}),Frt=Py[" useId ".trim().toString()]||(()=>{}),Brt=0;function sg(e){const[t,n]=p.useState(Frt());return zu(()=>{e||n(i=>i??String(Brt++))},[e]),e||(t?`radix-${t}`:"")}$rt(sg,"useId");var Urt=Object.defineProperty,Qrt=(e,t)=>Urt(e,"name",{value:t,configurable:!0}),zrt=p.createContext(void 0);function xC(e){const t=p.useContext(zrt);return e||t||"ltr"}Qrt(xC,"useDirection");var Vrt=Object.defineProperty,Hrt=(e,t)=>Vrt(e,"name",{value:t,configurable:!0});function Nd(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Hrt(Nd,"useCallbackRef");var qrt=Object.defineProperty,da=(e,t)=>qrt(e,"name",{value:t,configurable:!0}),uF="dismissableLayer.update",Wrt="dismissableLayer.pointerDownOutside",Krt="dismissableLayer.focusOutside",XY,m2e=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),uQ=p.forwardRef(da(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(m2e),[h,m]=p.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),v=pr(n,m),y=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=x?y.indexOf(x):-1,O=h?y.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,k=O>=w,C=p.useRef(!1),E=g2e(T=>{o==null||o(T),c==null||c(T),T.defaultPrevented||u==null||u()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(T=>{if(!(T instanceof Node))return!1;const N=[...f.branches].some(A=>A.contains(T));return k&&!N},[f.branches,k])}),R=b2e(T=>{if(r&&C.current)return;const N=T.target;[...f.branches].some(P=>P.contains(N))||(l==null||l(T),c==null||c(T),T.defaultPrevented||u==null||u())},g),_=h?O===y.length-1:!1,j=Nd(T=>{T.key==="Escape"&&(s==null||s(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))});return p.useEffect(()=>{if(_)return g.addEventListener("keydown",j,{capture:!0}),()=>g.removeEventListener("keydown",j,{capture:!0})},[g,_,j]),p.useEffect(()=>{if(h)return i&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(XY=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),dF(),()=>{i&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=XY))}},[h,g,i,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),dF())},[h,f]),p.useEffect(()=>{const T=da(()=>b({}),"handleUpdate");return document.addEventListener(uF,T),()=>document.removeEventListener(uF,T)},[]),a.jsx(Mr.div,{...d,ref:v,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:An(t.onFocusCapture,R.onFocusCapture),onBlurCapture:An(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:An(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function Grt(){const e=p.useContext(m2e),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}da(Grt,"useDismissableLayerSurface");var Xrt=da(()=>!0,"IS_TRUE");function g2e(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=Xrt}=t,l=Nd(e),c=p.useRef(!1),u=p.useRef(!1),d=p.useRef(new Map),f=p.useRef(()=>{});return p.useEffect(()=>{function h(){u.current=!1,r.current=!1,d.current.clear()}da(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}da(m,"isOutsideInteractionIntercepted");function g(w){if(!u.current)return;const O=w.target;O instanceof Node&&[...s].some(k=>k.contains(O))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}da(g,"handleInteractionCapture");function b(w){u.current&&d.current.set(w.type,!1)}da(b,"handleInteractionBubble");const v=da(w=>{if(w.target&&!c.current){let O=function(){n.removeEventListener("click",f.current);const k=m();h(),k||dQ(Wrt,l,S,{discrete:!0})};if(da(O,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",f.current),h(),c.current=!1;return}const S={originalEvent:w};u.current=!0,r.current=i&&w.button===0,d.current.clear(),!i||w.button!==0?O():(n.removeEventListener("click",f.current),f.current=O,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),h();c.current=!1},"handlePointerDown"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of y)n.addEventListener(w,g,!0),n.addEventListener(w,b);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",f.current);for(const w of y)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,l,i,r,s,o]),{onPointerDownCapture:da(()=>c.current=!0,"onPointerDownCapture")}}da(g2e,"usePointerDownOutside");function b2e(e,t=globalThis==null?void 0:globalThis.document){const n=Nd(e),i=p.useRef(!1);return p.useEffect(()=>{const r=da(s=>{s.target&&!i.current&&dQ(Krt,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:da(()=>i.current=!0,"onFocusCapture"),onBlurCapture:da(()=>i.current=!1,"onBlurCapture")}}da(b2e,"useFocusOutside");function dF(){const e=new CustomEvent(uF);document.dispatchEvent(e)}da(dF,"dispatchUpdate");function dQ(e,t,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),i?aQ(r,s):r.dispatchEvent(s)}da(dQ,"handleAndDispatchCustomEvent");var Yrt=Object.defineProperty,Al=(e,t)=>Yrt(e,"name",{value:t,configurable:!0}),YL="focusScope.autoFocusOnMount",ZL="focusScope.autoFocusOnUnmount",YY={bubbles:!1,cancelable:!0},y2e=p.forwardRef(Al(function(t,n){const{loop:i=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...l}=t,[c,u]=p.useState(null),d=Nd(s),f=Nd(o),h=p.useRef(null),m=pr(n,u),g=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(O){if(g.paused||!c)return;const S=O.target;c.contains(S)?h.current=S:Oh(h.current,{select:!0})},y=function(O){if(g.paused||!c)return;const S=O.relatedTarget;S!==null&&(c.contains(S)||Oh(h.current,{select:!0}))},x=function(O){if(document.activeElement===document.body)for(const k of O)k.removedNodes.length>0&&Oh(c)};Al(v,"handleFocusIn"),Al(y,"handleFocusOut"),Al(x,"handleMutations"),document.addEventListener("focusin",v),document.addEventListener("focusout",y);const w=new MutationObserver(x);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),w.disconnect()}}},[r,c,g.paused]),p.useEffect(()=>{if(c){ZY.add(g);const v=document.activeElement;if(!c.contains(v)){const x=new CustomEvent(YL,YY);c.addEventListener(YL,d),c.dispatchEvent(x),x.defaultPrevented||(v2e(S2e(fQ(c)),{select:!0}),document.activeElement===v&&Oh(c))}return()=>{c.removeEventListener(YL,d),setTimeout(()=>{const x=new CustomEvent(ZL,YY);c.addEventListener(ZL,f),c.dispatchEvent(x),x.defaultPrevented||Oh(v??document.body,{select:!0}),c.removeEventListener(ZL,f),ZY.remove(g)},0)}}},[c,d,f,g]);const b=p.useCallback(v=>{if(!i&&!r||g.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(y&&x){const w=v.currentTarget,[O,S]=x2e(w);O&&S?!v.shiftKey&&x===S?(v.preventDefault(),i&&Oh(O,{select:!0})):v.shiftKey&&x===O&&(v.preventDefault(),i&&Oh(S,{select:!0})):x===w&&v.preventDefault()}},[i,r,g.paused]);return a.jsx(Mr.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function v2e(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(Oh(i,{select:t}),document.activeElement!==n)return}Al(v2e,"focusFirst");function x2e(e){const t=fQ(e),n=fF(t,e),i=fF(t.reverse(),e);return[n,i]}Al(x2e,"getTabbableEdges");function fQ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Al(i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Al(fQ,"getTabbableCandidates");function fF(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):w2e(i,{upTo:t})))return i}Al(fF,"findVisible");function w2e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Al(w2e,"isHidden");function O2e(e){return e instanceof HTMLInputElement&&"select"in e}Al(O2e,"isSelectableInput");function Oh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&O2e(e)&&t&&e.select()}}Al(Oh,"focus");var ZY=k2e();function k2e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=hF(e,t),e.unshift(t)},remove(t){var n;e=hF(e,t),(n=e[0])==null||n.resume()}}}Al(k2e,"createFocusScopesStack");function hF(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}Al(hF,"arrayRemove");function S2e(e){return e.filter(t=>t.tagName!=="A")}Al(S2e,"removeLinks");var Zrt=Object.defineProperty,Jrt=(e,t)=>Zrt(e,"name",{value:t,configurable:!0}),hQ=p.forwardRef(Jrt(function(t,n){var c;const{container:i,...r}=t,[s,o]=p.useState(!1);zu(()=>o(!0),[]);const l=i||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?ri.createPortal(a.jsx(Mr.div,{...r,ref:n}),l):null},"Portal")),est=Object.defineProperty,pQ=(e,t)=>est(e,"name",{value:t,configurable:!0}),EA=0,Zd=null;function tst(e){return rP(),e.children}pQ(tst,"FocusGuards");function rP(){p.useEffect(()=>{Zd||(Zd={start:pF(),end:pF()});const{start:e,end:t}=Zd;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),EA++,()=>{EA===1&&(Zd==null||Zd.start.remove(),Zd==null||Zd.end.remove(),Zd=null),EA=Math.max(0,EA-1)}},[])}pQ(rP,"useFocusGuards");function pF(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}pQ(pF,"createFocusGuard");var df=function(){return df=Object.assign||function(t){for(var n,i=1,r=arguments.length;i"u")return yst;var t=vst(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},wst=A2e(),rx="data-scroll-locked",Ost=function(e,t,n,i){var r=e.left,s=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` - .`.concat(ist,` { + */const xa=wn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),LY=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),I_=Object.freeze({modelName:"",current:LY,cumulative:LY}),wit={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},Oit=24,kit=64,Sit=16;function wA(e){var l,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,i=((l=t.match(n))==null?void 0:l.length)??0,r=t.replace(n," "),s=(r.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),o=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+o}function Eit(e){var l,c,u;const t=((l=e.instruction)==null?void 0:l.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],i=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],r=wA(t),s=n.reduce((d,f)=>d+kit+wA(f),0),o=i.reduce((d,f)=>d+Sit+wA(f.name)+wA(f.description??""),0);return Oit+r+s+o}function Cit({usage:e,contextWindow:t,estimatedSystemTokens:n}){const i=Math.max(1,Math.round(t)),r=Math.max(0,e.current.promptTokenCount),s=Math.max(r,e.current.totalTokenCount),o=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,r-o),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:o+c;return{systemTokens:o,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function Tit(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let i=0;const r=t.map(s=>{const o=i;return i+=s.tokens,{...s,start:o,end:i}});return Array.from({length:100},(s,o)=>{const l=o*n,c=l+n,u=r.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(l,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:o,slices:u}})}function J1(e,t){const n=e,i=n[t]??n[wit[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function Ait(e){const t=J1(e,"promptTokenCount"),n=J1(e,"candidatesTokenCount"),i=J1(e,"thoughtsTokenCount");return{totalTokenCount:J1(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:J1(e,"cachedContentTokenCount")}}function _it(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function jAe(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",i=typeof t.model_version=="string"?t.model_version.trim():"",r=n||i||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return r===e.modelName?e:{...e,modelName:r};const o=Ait(s);return o.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:o,cumulative:_it(e.cumulative,o)}}function $Y(e){return e.reduce((t,n)=>jAe(t,n),I_)}function FY(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function jit(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function Nit(e,t){if(!t)return e;const n=new Set(e.filter(r=>jit(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function gy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Em(e){return typeof e=="string"?e:""}function NAe(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function Rit(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=gy(t)??{};return gy(n.result)??n}function Iit(e){var n;const t=(n=gy(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(i=>{var r;return Em((r=gy(i))==null?void 0:r.label)}):[]}function RAe(e,t,n){const i=Iit(e),r=Rit(t),s=Array.isArray(r.branches)?r.branches:[],o=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=gy(s[c])??{};return{label:Em(u.label)||i[c]||`方向 ${c+1}`,content:Em(u.content),status:NAe(u.status,o),error:Em(u.error)}})}}function Pit(e){const t=gy(e),n=gy(t==null?void 0:t.veadkStudioToolProgress);return!n||n.toolName!=="branch_compare"||typeof n.branchIndex!="number"||n.branchIndex<0||n.branchIndex>1?null:{toolName:"branch_compare",requestId:Em(n.requestId),branchIndex:n.branchIndex,label:Em(n.label),delta:Em(n.delta),status:NAe(n.status,"running"),error:Em(n.error)||void 0}}function Dit(e,t,n){return{branches:RAe(e,t,"running").branches.map((s,o)=>o===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}function Ca(e,t){return mn.t(`blocks.codexProgress.${e}`,{ns:"conversation",...t})}const IAe=28e4;function BY(e){try{return JSON.stringify(e).length}catch{return IAe}}function Mit(e){const t=e.slice(-200);let n=t.reduce((i,r)=>i+BY(r),0);for(;t.length>1&&n>IAe;)n-=BY(t.shift());return t}function Hc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Bi(e){return typeof e=="string"?e:""}function nQ(e,t=""){const n=Bi(e).toLowerCase();return t.endsWith(".failed")||["failed","error","declined","cancelled"].includes(n)?"failed":t.endsWith(".completed")||["completed","done","success"].includes(n)?"completed":"running"}function PAe(e){if(e.response!==void 0)return e.response;if(e.result!==void 0)return e.result;const t=e.aggregatedOutput??e.aggregated_output??e.output,n=e.exitCode??e.exit_code;if(!(t===void 0&&n===void 0))return{...t!==void 0?{output:t}:{},...n!==void 0?{exitCode:n}:{}}}function DAe(e){if(e.args!==void 0)return e.args;if(e.arguments!==void 0)return e.arguments;if(e.input!==void 0)return e.input;const t=Bi(e.command),n=Bi(e.cwd);if(t||n)return{...t?{command:t}:{},...n?{cwd:n}:{}};if(e.changes!==void 0)return{changes:e.changes};if(e.approval!==void 0)return e.approval}function bb(e,t,n,i,r){return{kind:"tool",name:e,callId:t,args:i,response:r,done:n!=="running",status:n,...n==="failed"?{defaultOpen:!0}:{}}}function MAe(e){const t=Bi(e.id||e.itemId||e.item_id),n=Bi(e.kind);if(!t||!n)return null;const i=nQ(e.status),r=Bi(e.text||e.detail||e.delta),s=!Bi(e.text||e.detail)&&typeof e.delta=="string";if(n==="thinking"||n==="reasoning")return r?{id:t,block:{kind:"thinking",text:r,done:i!=="running"},appendText:s}:null;if(n==="commentary")return r?{id:t,block:{kind:"text",text:r},appendText:s}:null;if(["message","text","assistant_final","final"].includes(n))return r?{id:t,block:{kind:"text",text:r},appendText:s,finalAnswer:!0}:null;if(n==="plan"){const o=Array.isArray(e.plan)?e.plan:[];return{id:t,block:{kind:"plan",title:Bi(e.title)||Ca("planTitle"),summary:r||void 0,items:o.flatMap(l=>{const c=Hc(l),u=Bi(c==null?void 0:c.text);if(!u)return[];const d=Bi(c==null?void 0:c.status);return[{text:u,status:["pending","in_progress","completed","failed"].includes(d)?d:"pending"}]}),done:i!=="running"}}}if(["tool","command","command_execution","commandExecution","file_change","fileChange","mcp_tool_call","mcpToolCall","collab_tool_call","web_search","approval","status"].includes(n)){const o=Ca(n==="file_change"||n==="fileChange"?"fallback.fileChange":n==="approval"?"fallback.approval":n==="status"?"fallback.status":"fallback.command"),l=DAe(e),c=PAe(e)??(n==="status"&&r||void 0);return{id:t,block:bb(Bi(e.name||e.title)||o,t,i,l,c)}}return null}function LAe(e){const t=Bi(e.type),n=Hc(e.item),i=Bi(n==null?void 0:n.type),r=Bi((n==null?void 0:n.id)||e.id)||(t==="turn.failed"?"turn":"");if(!r)return null;const s=nQ(n==null?void 0:n.status,t);if(i==="reasoning"||i==="agent_message"){const o=Bi(n==null?void 0:n.text);return o?{id:r,block:i==="reasoning"?{kind:"thinking",text:o,done:s!=="running"}:{kind:"text",text:o},...i==="agent_message"&&(n==null?void 0:n.phase)!=="commentary"?{finalAnswer:!0}:{}}:null}if(i==="todo_list"){const l=(Array.isArray(n==null?void 0:n.items)?n.items:[]).flatMap(c=>{const u=Hc(c),d=Bi(u==null?void 0:u.text);if(!d)return[];const f=Bi(u==null?void 0:u.status).toLowerCase(),h=(u==null?void 0:u.completed)===!0||["completed","done"].includes(f)?"completed":["failed","error"].includes(f)?"failed":["in_progress","running"].includes(f)?"in_progress":"pending";return[{text:d,status:h}]});return l.length?{id:r,block:{kind:"plan",title:Ca("planTitle"),summary:Ca("planSummary",{completed:l.filter(c=>c.status==="completed").length,total:l.length}),items:l,done:s!=="running"}}:null}if(i==="command_execution"){const o=Ca(`command.${s}`);return{id:r,block:bb(o,r,s,DAe(n??{}),PAe(n??{}))}}if(i==="file_change"){const o=Array.isArray(n==null?void 0:n.changes)?n.changes:[],l=o.length?Ca("projectFiles",{count:o.length}):Ca("projectFile"),c=Ca(`fileChange.${s}`,{subject:l});return{id:r,block:bb(c,r,s,o.length?{changes:o}:void 0)}}if(i==="mcp_tool_call"){const o=[Bi(n==null?void 0:n.server),Bi(n==null?void 0:n.tool)].filter(Boolean).join("/")||Ca("externalTool"),l=Ca(`mcp.${s}`,{tool:o}),c=Hc(n==null?void 0:n.error),u=(n==null?void 0:n.result)!==void 0?n.result:Bi(c==null?void 0:c.message)||void 0;return{id:r,block:bb(l,r,s,n==null?void 0:n.arguments,u)}}if(i==="collab_tool_call"){const o=Bi(n==null?void 0:n.tool),l=["spawn_agent","send_input","wait","close_agent"].includes(o)?o:"default",c=Ca(`collaboration.${l}.${s}`),u=Object.fromEntries(["tool","receiver_thread_ids","prompt"].filter(d=>(n==null?void 0:n[d])!==void 0).map(d=>[d,n==null?void 0:n[d]]));return{id:r,block:bb(c,r,s,Object.keys(u).length?u:void 0,n==null?void 0:n.agents_states)}}if(i==="web_search"){const o=Ca(`webSearch.${s}`),l=Object.fromEntries(["query","action"].filter(c=>(n==null?void 0:n[c])!==void 0).map(c=>[c,n==null?void 0:n[c]]));return{id:r,block:bb(o,r,s,Object.keys(l).length?l:void 0)}}if(i==="error"||t==="error"||t==="turn.failed"){const o=Hc(e.error),l=Bi((n==null?void 0:n.message)||e.message||(o==null?void 0:o.message))||Ca("errorDetail");return{id:r,block:bb(Ca("errorTitle"),r,"failed",void 0,l)}}return null}function Lit(e){const t=Hc(e),n=Hc(t==null?void 0:t.veadkStudioToolProgress);if(!n||n.kind!=="codex")return null;const i=Bi(n.toolName),r=Bi(n.requestId);if(!i||!r)return null;const s=Hc(n.event??n.activity);if(!s)return null;const o=Hc(s.item)||Bi(s.type)?LAe(s):MAe(s);if(!o)return null;const l=Bi(n.title||n.label),c=Bi(s.agentSessionId??s.agent_session_id),u=Bi(s.sandboxSessionId??s.sandbox_session_id),d=Bi(s.threadId??s.thread_id),f=nQ(s.status,Bi(s.type)),m=Bi(s.kind)==="status"&&f!=="running"?f:void 0;return{toolName:i,requestId:r,...l?{title:l}:{},...c?{agentSessionId:c}:{},...u?{sandboxSessionId:u}:{},...d?{threadId:d}:{},...m?{terminalStatus:m}:{},event:o}}function $it(e,t){const n=Hc(t),i=Hc((n==null?void 0:n.codexActivity)??(n==null?void 0:n.codex_activity));if(!i)return e;const r=Bi(i.title)||(e==null?void 0:e.title)||"Codex Sandbox",s=Bi(i.agentSessionId??i.agent_session_id)||(e==null?void 0:e.agentSessionId),o=Bi(i.sandboxSessionId??i.sandbox_session_id)||(e==null?void 0:e.sandboxSessionId),l=Bi(i.threadId??i.thread_id)||(e==null?void 0:e.threadId);let c={title:r,...s?{agentSessionId:s}:{},...o?{sandboxSessionId:o}:{},...l?{threadId:l}:{},items:(e==null?void 0:e.items.slice())??[]};const u=Array.isArray(i.events)?i.events:[];for(const d of u){const f=Hc(d);if(!f)continue;const h=Hc(f.item)||Bi(f.type)?LAe(f):MAe(f);h&&(h.finalAnswer||(c=J6(c,{title:r,...s?{agentSessionId:s}:{},...o?{sandboxSessionId:o}:{},...l?{threadId:l}:{},event:h})))}return c}function J6(e,t){const n=(e==null?void 0:e.items.slice())??[],i=n.findIndex(r=>r.id===t.event.id);if(i>=0){const r=n[i].block,s=t.event.block;t.event.appendText&&r.kind==="text"&&s.kind==="text"?n[i]={id:t.event.id,block:{...s,text:r.text+s.text}}:t.event.appendText&&r.kind==="thinking"&&s.kind==="thinking"?n[i]={id:t.event.id,block:{...s,text:r.text+s.text}}:n[i]={id:t.event.id,block:s}}else n.push({id:t.event.id,block:t.event.block});return{title:t.title||(e==null?void 0:e.title)||"Codex Sandbox",...t.agentSessionId||e!=null&&e.agentSessionId?{agentSessionId:t.agentSessionId||(e==null?void 0:e.agentSessionId)}:{},...t.sandboxSessionId||e!=null&&e.sandboxSessionId?{sandboxSessionId:t.sandboxSessionId||(e==null?void 0:e.sandboxSessionId)}:{},...t.threadId||e!=null&&e.threadId?{threadId:t.threadId||(e==null?void 0:e.threadId)}:{},items:Mit(n)}}const $Ae="send_a2ui_json_to_client",eF="validated_a2ui_json",tF="adk_request_credential",UY="transfer_to_agent";function Fit(e){var i,r,s,o;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.exchanged_auth_credential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.oauth2)??((o=t==null?void 0:t.raw_auth_credential)==null?void 0:o.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function nF(){return{blocks:[],liveStart:0,pendingCodexProgress:[]}}function QY(e,t){if(t.event.finalAnswer)return"applied";let n=-1;for(let i=e.length-1;i>=0;i-=1){const r=e[i];if(!(r.kind!=="tool"||r.name!==t.toolName)){if(r.callId===t.requestId)return r.done?"completed":(r.codexActivity=J6(r.codexActivity,t),r.status=t.terminalStatus??"running",t.terminalStatus&&(r.done=!0),"applied");if(!r.done){if(n>=0)return"unmatched";n=i}}}if(n>=0){const i=e[n];return i.kind!=="tool"?"unmatched":(i.codexActivity=J6(i.codexActivity,t),i.status=t.terminalStatus??"running",t.terminalStatus&&(i.done=!0),"applied")}return"unmatched"}function Bit(e){if(!e||typeof e!="object"||Array.isArray(e))return"completed";const t=e,n=typeof t.status=="string"?t.status.toLowerCase():"";return t.ok===!1||["error","failed","denied","declined","cancelled","timeout"].includes(n)?"failed":"completed"}function zY(e){if(!e||typeof e!="object"||Array.isArray(e))return"";const t=e;return t.ok!==!0||typeof t.message!="string"?"":t.message.trim()}const iF=e=>e.functionCall??e.function_call,US=e=>e.functionResponse??e.function_response;function Uit(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Qit(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function nP(e){const t=[];for(const[n,i]of e.entries()){const r=i.partMetadata??i.part_metadata,s=r==null?void 0:r.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const o=r==null?void 0:r.veadkMedia;if(typeof(o==null?void 0:o.uri)=="string"){t.push({id:String(o.id??o.uri),mimeType:typeof o.mimeType=="string"?o.mimeType:void 0,uri:o.uri,name:typeof o.name=="string"?o.name:void 0,sizeBytes:typeof o.sizeBytes=="number"?o.sizeBytes:void 0});continue}const l=i.inlineData??i.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:Qit(l.data),name:l.displayName??l.display_name});continue}const c=i.fileData??i.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function QS(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const zit=new Set(["llm","sequential","parallel","loop","a2a"]);function Vit(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const r=i,s=Array.isArray(r.skills)?r.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let o;const l=r.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&zit.has(u)&&Array.isArray(c.path)&&(o={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||o)return{skills:s,targetAgent:o}}}function Hit(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function qit(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(r=>r.filename===i.filename&&r.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function HL(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function OA(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function FAe(e,t){var d,f,h,m,g,b;const n=e.blocks.map(v=>({...v}));let i=e.liveStart,r=e.pendingCodexProgress.slice();const s=((d=t.content)==null?void 0:d.parts)??[],o=s.flatMap(v=>{const y=Pit(v.partMetadata??v.part_metadata);return y?[y]:[]}),l=s.flatMap(v=>{const y=Lit(v.partMetadata??v.part_metadata);return y?[y]:[]});if(o.length>0||l.length>0){for(const v of o)for(let y=n.length-1;y>=0;y-=1){const x=n[y];if(!(x.kind!=="tool"||x.done||x.name!==v.toolName||v.requestId&&x.callId&&x.callId!==v.requestId)){x.response=Dit(x.args,x.response,v),x.status="running";break}}for(const v of l)QY(n,v)==="unmatched"&&(r=[...r,v].slice(-64));return{blocks:n,liveStart:i,pendingCodexProgress:r}}const c=s.some(v=>iF(v)||US(v));if(t.partial&&!c){for(const v of s){const y=QS(v);typeof y=="string"&&y&&HL(n,v.thought?"thinking":"text",y)}return{blocks:n,liveStart:i,pendingCodexProgress:r}}n.length=i;for(const v of s){const y=iF(v),x=US(v),w=nP([v]),O=QS(v);if(typeof O=="string"&&O)HL(n,v.thought?"thinking":"text",O);else if(w.length)OA(n),Hit(n,w);else if(y)if(OA(n),y.name===UY){const S=Uit(y.args)||((f=t.actions)==null?void 0:f.transferToAgent)||((h=t.actions)==null?void 0:h.transfer_to_agent)||mn.t("app:common.unknownAgent");n.push({kind:"agent-transfer",agentName:S,done:!1})}else if(y.name===tF){const S=y.args??{},k=S.authConfig??S.auth_config??S,E=String(S.functionCallId??S.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:y.id??"",label:E,authUri:Fit(k),authConfig:k,done:!1})}else{const S={kind:"tool",name:y.name??"",callId:y.id,args:y.args,done:!1};if(n.push(S),S.callId){const k=[];for(const C of r)C.toolName===S.name&&C.requestId===S.callId?QY(n,C):k.push(C);r=k}}else if(x){if(OA(n),x.name===UY)for(let S=n.length-1;S>=0;S--){const k=n[S];if(k.kind==="agent-transfer"&&!k.done){k.done=!0;break}}if(x.name===tF)for(let S=n.length-1;S>=0;S--){const k=n[S];if(k.kind==="auth"&&!k.done){k.done=!0;break}}for(let S=n.length-1;S>=0;S--){const k=n[S],C=k.kind==="tool"&&k.name==="delegate_to_codex_sandbox";if(k.kind==="tool"&&(!k.done||C)&&k.name===x.name&&(!x.id||!k.callId||k.callId===x.id)){const E=C?zY(k.response):"";if(k.done=!0,k.response=x.response,C){k.codexActivity=$it(k.codexActivity,x.response),k.status=Bit(x.response);const R=zY(x.response);R&&R!==E&&HL(n,"text",R)}break}}if(x.name===$Ae){const S=((m=x.response)==null?void 0:m[eF])??[];if(S.length){const k=n[n.length-1];k&&k.kind==="a2ui"?k.messages.push(...S):n.push({kind:"a2ui",messages:S})}}}}const u=((g=t.actions)==null?void 0:g.artifactDelta)??((b=t.actions)==null?void 0:b.artifact_delta);return u&&qit(n,Object.entries(u).map(([v,y])=>({filename:v,version:y}))),OA(n),i=n.length,{blocks:n,liveStart:i,pendingCodexProgress:r}}function Wit(e,t){var u,d,f,h,m,g;if(e.partial===!0)return!1;const n=((u=e.content)==null?void 0:u.parts)??[],i=n.some(b=>{const v=QS(b);return!b.thought&&typeof v=="string"&&v.trim().length>0||nP([b]).length>0}),r=n.some(b=>{var y;const v=US(b);return(v==null?void 0:v.name)===$Ae&&Array.isArray((y=v.response)==null?void 0:y[eF])&&v.response[eF].length>0}),s=((d=e.actions)==null?void 0:d.artifactDelta)??((f=e.actions)==null?void 0:f.artifact_delta),o=!!(s&&Object.keys(s).length>0),l=!!(((h=e.actions)==null?void 0:h.endOfAgent)??((m=e.actions)==null?void 0:m.end_of_agent)??((g=e.actions)==null?void 0:g.escalate)),c=t.some(b=>b.kind==="text"||b.kind==="attachment"||b.kind==="artifact"||b.kind==="a2ui"||b.kind==="delivery");return i||r||o||l&&c}function Kit(e){var n,i,r;const t=((n=e.actions)==null?void 0:n.artifactDelta)??((i=e.actions)==null?void 0:i.artifact_delta);return t&&Object.keys(t).length>0?!0:(((r=e.content)==null?void 0:r.parts)??[]).some(s=>!!(QS(s)||nP([s]).length>0||iF(s)||US(s)))}function rF(e="adk-stream",t){var o,l,c;let n=0;const i=new Map;let r;const s=(u,d)=>`${d}\0${u}`;if((t==null?void 0:t.role)==="assistant"){const u=((o=t.meta)==null?void 0:o.author)??"",d=((l=t.meta)==null?void 0:l.invocationId)??"",f=((c=t.meta)==null?void 0:c.localId)??`${e}-${n++}`,h=nF();h.blocks=t.blocks,h.liveStart=t.blocks.length,r=s(u,d),i.set(r,{acc:h,localId:f,meta:{...t.meta,localId:f,streaming:!0,eventId:void 0}})}return{project(u){const d=u.author&&u.author!=="user"?u.author:"",f=u.invocationId??u.invocation_id??"",h=s(d,f);let m=i.get(h);if(!m&&r){const y=i.get(r);y&&(!y.meta.author||y.meta.author===d)&&(i.delete(r),r=void 0,m=y)}if(!m&&!Kit(u))return{turn:{role:"assistant",blocks:[]},completed:!1,ignored:!0};if(!m){const y=`${e}-${n++}`;m={acc:nF(),localId:y,meta:{author:d||void 0,invocationId:f||void 0}}}m.acc=FAe(m.acc,u);const g=u.usageMetadata??u.usage_metadata,b=Wit(u,m.acc.blocks);m.meta={...m.meta,author:d||m.meta.author,localId:m.localId,streaming:!b,tokens:(g==null?void 0:g.totalTokenCount)||m.meta.tokens,ts:u.timestamp||m.meta.ts,invocationId:f||m.meta.invocationId,eventId:b&&u.id?u.id:m.meta.eventId};const v={role:"assistant",blocks:m.acc.blocks,meta:m.meta};return b?(i.delete(h),r=void 0):i.set(h,m),{turn:v,completed:b}},finish(){const u=[...i.values()].map(d=>({role:"assistant",blocks:d.acc.blocks,meta:{...d.meta,streaming:!1}}));return i.clear(),u}}}function Nb(e,t){var s;const n=(s=t.meta)==null?void 0:s.localId;if(!n)return[...e,t];const i=e.findIndex(o=>{var l;return((l=o.meta)==null?void 0:l.localId)===n});if(i<0)return[...e,t];const r=e.slice();return r[i]=t,r}function Git(e,t={}){var r;let n=[],i=rF("adk-history");for(const s of e)if(s.author==="user"){const l=((r=s.content)==null?void 0:r.parts)??[];if(l.some(h=>{var m;return((m=US(h))==null?void 0:m.name)===tF})){for(let h=n.length-1;h>=0;h--)if(n[h].role==="assistant"){for(let m=n[h].blocks.length-1;m>=0;m--){const g=n[h].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const c=l.map(QS).filter(h=>!!h).join(""),u=nP(l),d=Vit(l);if(!c&&!u.length&&!d)continue;for(const h of i.finish())n=Nb(n,h);const f=[];d&&f.push({kind:"invocation",value:d}),u.length&&f.push({kind:"attachment",files:u}),c&&f.push({kind:"text",text:c}),n.push({role:"user",blocks:f,meta:{ts:s.timestamp}})}else{const l=i.project(s);l.ignored||(n=Nb(n,l.turn))}for(const s of i.finish())n=Nb(n,s);for(const s of n){const o=s.meta,l=o==null?void 0:o.eventId;if(!l)continue;const c=t[`veadk_feedback:${l}`];if(!c||typeof c!="object")continue;const u=c;u.rating!=="good"&&u.rating!=="bad"||(o.feedback=c)}return n}function iP(e,t=mn.t("app:titles.newConversation")){var n,i;for(const r of e??[])if(r.author==="user"||((n=r.content)==null?void 0:n.role)==="user"){const s=(((i=r.content)==null?void 0:i.parts)??[]).map(o=>o.text).find(Boolean);if(s)return s}return t}function BAe(e,t,n){if(e.name===t||e.id===t)return(n==null?void 0:n.type)==="parallel"?n:void 0;for(const i of e.children){const r=BAe(i,t,e);if(r)return r}}function Xit(e,t){var o,l;if(e.role!=="assistant"||!t)return;const n=(o=e.meta)==null?void 0:o.author;if(!n)return;const i=BAe(t,n);if(!i)return;const r=i.id||i.path.join("/")||i.name;return{key:`${((l=e.meta)==null?void 0:l.invocationId)??""}::${r}`,parent:i.name}}function Yit(e,t){const n=[];return e.forEach((i,r)=>{const s=Xit(i,t),o=n[n.length-1];if(s&&(o==null?void 0:o.groupKey)===s.key){o.turnIndexes.push(r);return}n.push({key:s?`parallel-${s.key}-${r}`:`turn-${r}`,turnIndexes:[r],parallelParent:s==null?void 0:s.parent,groupKey:s==null?void 0:s.key})}),n.map(({groupKey:i,...r})=>r)}function Zit(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"9",cy:"8",r:"3.25"}),a.jsx("path",{d:"M2.75 20v-1.5a6.25 6.25 0 0 1 12.5 0V20M16 5.25a3.25 3.25 0 0 1 0 6.5M18 14a5.5 5.5 0 0 1 3.25 5V20"})]})}function UAe(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t{const t=p.Children.toArray(e),n=[];let i="";const r=()=>{i!==""&&(n.push(i),i="")};for(const s of t)if(!(s==null||typeof s=="boolean")){if(typeof s=="string"||typeof s=="number"){i+=String(s);continue}r(),n.push(s)}return r(),n},iQ=e=>{const t=Jit(e),n=p.Children.count(t);return p.Children.map(t,i=>{if(typeof i=="string"&&i.trim())return n<=1?i:a.jsx("span",{children:i});if(p.isValidElement(i)){const r=i,{children:s,...o}=r.props;return s!=null?p.cloneElement(r,o,iQ(s)):r}return i})},ert="_Badge_1viyg_1",trt={Badge:ert},Io=({children:e,className:t,variant:n="soft",color:i="secondary",size:r="sm",pill:s,...o})=>a.jsx("div",{className:Ti(trt.Badge,t),"data-color":i,"data-size":r,"data-pill":s?"":void 0,"data-variant":n,...o,children:iQ(e)});var nrt=typeof ym=="object"&&ym&&ym.Object===Object&&ym,irt=typeof self=="object"&&self&&self.Object===Object&&self;nrt||irt||Function("return this")();var rrt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function srt(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var VY={width:void 0,height:void 0};function QAe(e){const{ref:t,box:n="content-box"}=e,[{width:i,height:r},s]=p.useState(VY),o=srt(),l=p.useRef({...VY}),c=p.useRef(void 0);return c.current=e.onResize,p.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=HY(d,f,"inlineSize"),m=HY(d,f,"blockSize");if(l.current.width!==h||l.current.height!==m){const b={width:h,height:m};l.current.width=h,l.current.height=m,c.current?c.current(b):o()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,o]),{width:i,height:r}}function HY(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function rQ(e,t){const n=p.useRef(e);rrt(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const i=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(i)}},[t])}const ort={DEV:!1,MODE:"production"},ix=typeof import.meta<"u"?ort:void 0,art=!!(ix!=null&&ix.DEV),lrt=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",zAe=(ix==null?void 0:ix.MODE)==="test"||lrt,crt=typeof window<"u",VAe=typeof document<"u",urt=crt&&VAe,sQ=e=>{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let i=.985;n<=80?i=.96:n<=150?i=.97:n<=220?i=.98:n>600&&(i=.995),t.style.setProperty("--scale",i.toString())},xN=(e,t)=>{const n=()=>{const o=setTimeout(e);return()=>{clearTimeout(o)}};if(!urt||typeof window.requestAnimationFrame!="function"||VAe&&document.visibilityState==="hidden")return n();let r=2,s=window.requestAnimationFrame(function o(){r-=1,r===0?e():s=window.requestAnimationFrame(o)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},zy=e=>Object.keys(e).reduce((n,i)=>{const r=e[i];if(r||r===0){const s=i.startsWith("--")?"":"--",o=typeof r=="number"?`${r}px`:r;n[`${s}${i}`]=o}return n},{}),qL=e=>typeof e=="number"?`${e}deg`:e,WL=e=>String(e),kA=e=>`${e}ms`,KL=({x:e,y:t,scale:n,rotate:i,skewX:r,skewY:s}={})=>{const o=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,i==null?null:`rotate(${qL(i)})`,r==null?null:`skewX(${qL(r)})`,s==null?null:`skewY(${qL(s)})`].filter(Boolean);return o.length?o.join(" "):"none"},GL=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Kh=e=>{e.preventDefault()},HAe=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),drt="_LoadingIndicator_7yl6f_1",frt={LoadingIndicator:drt},yC=({className:e,size:t,strokeWidth:n,style:i,...r})=>a.jsx("div",{...r,className:Ti(frt.LoadingIndicator,e),style:i||zy({"indicator-size":t,"indicator-stroke":n})});var hrt=Object.defineProperty,oQ=(e,t)=>hrt(e,"name",{value:t,configurable:!0});function sF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}oQ(sF,"setRef");function qAe(...e){return t=>{let n=!1;const i=e.map(r=>{const s=sF(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;rprt(e,"name",{value:t,configurable:!0});function cp(e){const t=p.forwardRef((n,i)=>{let{children:r,...s}=n,o=null,l=!1;const c=[];oF(r)&&typeof SA=="function"&&(r=SA(r._payload)),p.Children.forEach(r,h=>{var m;if(ZAe(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;oF(b)&&typeof SA=="function"&&(b=SA(b._payload)),o=mrt(g,b),c.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else c.push(h)}),o?o=p.cloneElement(o,void 0,c):!l&&p.Children.count(r)===1&&p.isValidElement(r)&&(o=r);const u=o?YAe(o):void 0,d=pr(i,u);if(!o){if(r||r===0)throw new Error(l?yrt(e):brt(e));return r}const f=XAe(s,o.props??{});return o.type!==p.Fragment&&(f.ref=i?d:u),p.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}Ld(cp,"createSlot");var WAe=cp("Slot"),KAe=Symbol.for("radix.slottable");function GAe(e){const t=Ld(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=KAe,t}Ld(GAe,"createSlottable");var mrt=Ld((e,t)=>{if("child"in e.props){const n=e.props.child;return p.isValidElement(n)?p.cloneElement(n,void 0,e.props.children(n.props.children)):null}return p.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function XAe(e,t){const n={...t};for(const i in t){const r=e[i],s=t[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...l)=>{const c=s(...l);return r(...l),c}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}Ld(XAe,"mergeProps");function YAe(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ld(YAe,"getElementRef");function ZAe(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KAe}Ld(ZAe,"isSlottable");var grt=Symbol.for("react.lazy");function oF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===grt&&"_payload"in e&&JAe(e._payload)}Ld(oF,"isLazyComponent");function JAe(e){return typeof e=="object"&&e!==null&&"then"in e}Ld(JAe,"isPromiseLike");var brt=Ld(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),yrt=Ld(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),SA=Py[" use ".trim().toString()],vrt=Object.defineProperty,xrt=(e,t)=>vrt(e,"name",{value:t,configurable:!0}),wrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mr=wrt.reduce((e,t)=>{const n=cp(`Primitive.${t}`),i=p.forwardRef((r,s)=>{const{asChild:o,...l}=r,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function aQ(e,t){e&&ri.flushSync(()=>e.dispatchEvent(t))}xrt(aQ,"dispatchDiscreteCustomEvent");var Ort=Object.defineProperty,krt=(e,t)=>Ort(e,"name",{value:t,configurable:!0}),Srt=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ert=p.forwardRef(krt(function(t,n){return a.jsx(Mr.span,{...t,ref:n,style:{...Srt,...t.style}})},"VisuallyHidden")),Crt=Ert,Trt=Object.defineProperty,_u=(e,t)=>Trt(e,"name",{value:t,configurable:!0});function Art(e,t){const n=p.createContext(t);n.displayName=e+"Context";const i=_u(s=>{const{children:o,...l}=s,c=p.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})},"Provider");i.displayName=e+"Provider";function r(s,o={}){const{optional:l=!1}=o,c=p.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return _u(r,"useContext"),[i,r]}_u(Art,"createContext");function hc(e,t=[]){let n=[];function i(s,o){const l=p.createContext(o);l.displayName=s+"Context";const c=n.length;n=[...n,o];const u=_u(f=>{var y;const{scope:h,children:m,...g}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=p.useMemo(()=>g,Object.values(g));return a.jsx(b.Provider,{value:v,children:m})},"Provider");u.displayName=s+"Provider";function d(f,h,m={}){var y;const{optional:g=!1}=m,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=p.useContext(b);if(v)return v;if(o!==void 0)return o;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return _u(d,"useContext"),[u,d]}_u(i,"createContext");const r=_u(()=>{const s=n.map(o=>p.createContext(o));return _u(function(l){const c=(l==null?void 0:l[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return r.scopeName=e,[i,e2e(r,...t)]}_u(hc,"createContextScope");function e2e(...e){const t=e[0];if(e.length===1)return t;const n=_u(()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return _u(function(s){const o=i.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}_u(e2e,"composeContextScopes");var _rt=Object.defineProperty,ha=(e,t)=>_rt(e,"name",{value:t,configurable:!0});function lQ(e){const t=e+"CollectionProvider",[n,i]=hc(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=ha(b=>{const{scope:v,children:y}=b,x=p.useRef(null),w=p.useRef(new Map).current;return a.jsx(r,{scope:v,itemMap:w,collectionRef:x,children:y})},"CollectionProvider");o.displayName=t;const l=e+"CollectionSlot",c=cp(l),u=p.forwardRef((b,v)=>{const{scope:y,children:x}=b,w=s(l,y),O=pr(v,w.collectionRef);return a.jsx(c,{ref:O,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=cp(d),m=p.forwardRef((b,v)=>{const{scope:y,children:x,...w}=b,O=p.useRef(null),S=pr(v,O),k=s(d,y);return p.useEffect(()=>(k.itemMap.set(O,{ref:O,...w}),()=>void k.itemMap.delete(O))),a.jsx(h,{[f]:"",ref:S,children:x})});m.displayName=d;function g(b){const v=s(e+"CollectionConsumer",b);return p.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((k,C)=>w.indexOf(k.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return ha(g,"useCollection"),[{Provider:o,Slot:u,ItemSlot:m},g,i]}ha(lQ,"createCollection");var qY=new WeakMap,Co,$c,XL=($c=class extends Map{constructor(n){super(n);OW(this,Co);SM(this,Co,[...super.keys()]),qY.set(this,!0)}set(n,i){return qY.get(this)&&(this.has(n)?Za(this,Co)[Za(this,Co).indexOf(n)]=n:Za(this,Co).push(n)),super.set(n,i),this}insert(n,i,r){const s=this.has(i),o=Za(this,Co).length,l=cQ(n);let c=l>=0?l:o+l;const u=c<0||c>=o?-1:c;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(i,r),this;const d=this.size+(s?0:1);l<0&&c++;const f=[...Za(this,Co)];let h,m=!1;for(let g=c;g=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,i){const r=this.indexOf(n);if(r===-1)return;let s=r+i;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return s;r++}}findIndex(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return r;r++}return-1}filter(n,i){const r=[];let s=0;for(const o of this)Reflect.apply(n,i,[o,s,this])&&r.push(o),s++;return new $c(r)}map(n,i){const r=[];let s=0;for(const o of this)r.push([o[0],Reflect.apply(n,i,[o,s,this])]),s++;return new $c(r)}reduce(...n){const[i,r]=n;let s=0,o=r??this.at(0);for(const l of this)s===0&&n.length===1?o=l:o=Reflect.apply(i,this,[o,l,s,this]),s++;return o}reduceRight(...n){const[i,r]=n;let s=r??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,o,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new $c(i)}toReversed(){const n=new $c;for(let i=this.size-1;i>=0;i--){const r=this.keyAt(i),s=this.get(r);n.set(r,s)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new $c(i)}slice(n,i){const r=new $c;let s=this.size-1;if(n===void 0)return r;n<0&&(n=n+this.size),i!==void 0&&i>0&&(s=i-1);for(let o=n;o<=s;o++){const l=this.keyAt(o),c=this.get(l);r.set(l,c)}return r}every(n,i){let r=0;for(const s of this){if(!Reflect.apply(n,i,[s,r,this]))return!1;r++}return!0}some(n,i){let r=0;for(const s of this){if(Reflect.apply(n,i,[s,r,this]))return!0;r++}return!1}},Co=new WeakMap,ha($c,"OrderedDict"),$c);function P_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=t2e(e,t);return n===-1?void 0:e[n]}ha(P_,"at");function t2e(e,t){const n=e.length,i=cQ(t),r=i>=0?i:n+i;return r<0||r>=n?-1:r}ha(t2e,"toSafeIndex");function cQ(e){return e!==e||e===0?0:Math.trunc(e)}ha(cQ,"toSafeInteger");function jrt(e){const t=e+"CollectionProvider",[n,i]=hc(t),[r,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new XL,setItemMap:ha(()=>{},"setItemMap")}),o=ha(({state:w,...O})=>w?a.jsx(c,{...O,state:w}):a.jsx(l,{...O}),"CollectionProvider");o.displayName=t;const l=ha(w=>{const O=v();return a.jsx(c,{...w,state:O})},"CollectionInit");l.displayName=t+"Init";const c=ha(w=>{const{scope:O,children:S,state:k}=w,C=p.useRef(null),[E,R]=p.useState(null),_=pr(C,R),[j,T]=k;return p.useEffect(()=>{if(!E)return;const N=r2e(()=>{});return N.observe(E,{childList:!0,subtree:!0}),()=>{N.disconnect()}},[E]),a.jsx(r,{scope:O,itemMap:j,setItemMap:T,collectionRef:_,collectionRefObject:C,collectionElement:E,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=cp(u),f=p.forwardRef((w,O)=>{const{scope:S,children:k}=w,C=s(u,S),E=pr(O,C.collectionRef);return a.jsx(d,{ref:E,children:k})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=cp(h),b=p.forwardRef((w,O)=>{const{scope:S,children:k,...C}=w,E=p.useRef(null),[R,_]=p.useState(null),j=pr(O,E,_),T=s(h,S),{setItemMap:N}=T,A=p.useRef(C);n2e(A.current,C)||(A.current=C);const P=A.current;return p.useEffect(()=>{const D=P;return N(M=>R?M.has(R)?M.set(R,{...D,element:R}).toSorted(aF):(M.set(R,{...D,element:R}),M.toSorted(aF)):M),()=>{N(M=>!R||!M.has(R)?M:(M.delete(R),new XL(M)))}},[R,P,N]),a.jsx(g,{[m]:"",ref:j,children:k})});b.displayName=h;function v(){return p.useState(new XL)}ha(v,"useInitCollection");function y(w){const{itemMap:O}=s(e+"CollectionConsumer",w);return O}return ha(y,"useCollection"),[{Provider:o,Slot:f,ItemSlot:b},{createCollectionScope:i,useCollection:y,useInitCollection:v}]}ha(jrt,"createCollection");function n2e(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}ha(n2e,"shallowEqual");function i2e(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ha(i2e,"isElementPreceding");function aF(e,t){return!e[1].element||!t[1].element?0:i2e(e[1].element,t[1].element)?-1:1}ha(aF,"sortByDocumentPosition");function r2e(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}ha(r2e,"getChildListObserver");var Nrt=Object.defineProperty,Qw=(e,t)=>Nrt(e,"name",{value:t,configurable:!0}),s2e=!!(typeof window<"u"&&window.document&&window.document.createElement);function An(e,t,{checkForDefaultPrevented:n=!0}={}){return Qw(function(r){if(e==null||e(r),n===!1||!r||!r.defaultPrevented)return t==null?void 0:t(r)},"handleEvent")}Qw(An,"composeEventHandlers");function Rrt(e){var t;if(!s2e)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Qw(Rrt,"getOwnerWindow");function lF(e){if(!s2e)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Qw(lF,"getOwnerDocument");function o2e(e,t=!1){const{activeElement:n}=lF(e);if(!(n!=null&&n.nodeName))return null;if(a2e(n)&&n.contentDocument)return o2e(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const r=lF(n).getElementById(i);if(r)return r}}return n}Qw(o2e,"getActiveElement");function a2e(e){return e.tagName==="IFRAME"}Qw(a2e,"isFrame");var zu=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Irt=Object.defineProperty,Prt=(e,t)=>Irt(e,"name",{value:t,configurable:!0}),WY=Py[" useEffectEvent ".trim().toString()],KY=Py[" useInsertionEffect ".trim().toString()];function l2e(e){if(typeof WY=="function")return WY(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof KY=="function"?KY(()=>{t.current=e}):zu(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Prt(l2e,"useEffectEvent");var Drt=Object.defineProperty,vC=(e,t)=>Drt(e,"name",{value:t,configurable:!0}),Mrt=Py[" useInsertionEffect ".trim().toString()]||zu;function Ju({prop:e,defaultProp:t,onChange:n=vC(()=>{},"onChange"),caller:i}){const[r,s,o]=c2e({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:r,u=p.useCallback(d=>{var f;if(l){const h=u2e(d)?d(e):d;h!==e&&((f=o.current)==null||f.call(o,h))}else s(d)},[l,e,s,o]);return[c,u]}vC(Ju,"useControllableState");function c2e({defaultProp:e,onChange:t}){const[n,i]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Mrt(()=>{s.current=t},[t]),p.useEffect(()=>{var o;r.current!==n&&((o=s.current)==null||o.call(s,n),r.current=n)},[n,r]),[n,i,s]}vC(c2e,"useUncontrolledState");function u2e(e){return typeof e=="function"}vC(u2e,"isFunction");var GY=Symbol("RADIX:SYNC_STATE");function Lrt(e,t,n,i){const{prop:r,defaultProp:s,onChange:o,caller:l}=t,c=r!==void 0,u=l2e(o),d=[{...n,state:s}];i&&d.push(i);const[f,h]=p.useReducer((v,y)=>{if(y.type===GY)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),m=f.state,g=p.useRef(m);p.useEffect(()=>{g.current!==m&&(g.current=m,c||u(m))},[m,g,c]);const b=p.useMemo(()=>r!==void 0?{...f,state:r}:f,[f,r]);return p.useEffect(()=>{c&&!Object.is(r,f.state)&&h({type:GY,state:r})},[r,f.state,c]),[b,h]}vC(Lrt,"useControllableStateReducer");var $rt=Object.defineProperty,up=(e,t)=>$rt(e,"name",{value:t,configurable:!0});function d2e(e,t){return p.useReducer((n,i)=>t[n][i]??n,e)}up(d2e,"useStateMachine");var Qf=up(e=>{const{present:t,children:n}=e,i=f2e(t),r=typeof n=="function"?n({present:i.isPresent}):p.Children.only(n),s=h2e(i.ref,p2e(r));return typeof n=="function"||i.isPresent?p.cloneElement(r,{ref:s}):null},"Presence");function f2e(e){const[t,n]=p.useState(),i=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),o=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=d2e(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=o.current??sv(i.current),o.current=void 0):s.current="none"},[c]),zu(()=>{const d=i.current,f=r.current;if(f!==e){const m=s.current,g=sv(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),zu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=up(g=>{const v=sv(i.current).includes(CSS.escape(g.animationName));if(g.target===t&&v&&(u("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),m=up(g=>{g.target===t&&(s.current=sv(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:p.useCallback(d=>{if(d){const f=getComputedStyle(d);i.current=f,o.current=sv(f)}else i.current=null;n(d)},[])}}up(f2e,"usePresence");function cF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}up(cF,"setRef");function h2e(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const i=t.current;let r=!1;const s=i.map(o=>{const l=cF(o,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;oFrt(e,"name",{value:t,configurable:!0}),Urt=Py[" useId ".trim().toString()]||(()=>{}),Qrt=0;function sg(e){const[t,n]=p.useState(Urt());return zu(()=>{e||n(i=>i??String(Qrt++))},[e]),e||(t?`radix-${t}`:"")}Brt(sg,"useId");var zrt=Object.defineProperty,Vrt=(e,t)=>zrt(e,"name",{value:t,configurable:!0}),Hrt=p.createContext(void 0);function xC(e){const t=p.useContext(Hrt);return e||t||"ltr"}Vrt(xC,"useDirection");var qrt=Object.defineProperty,Wrt=(e,t)=>qrt(e,"name",{value:t,configurable:!0});function Nd(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}Wrt(Nd,"useCallbackRef");var Krt=Object.defineProperty,da=(e,t)=>Krt(e,"name",{value:t,configurable:!0}),uF="dismissableLayer.update",Grt="dismissableLayer.pointerDownOutside",Xrt="dismissableLayer.focusOutside",XY,m2e=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),uQ=p.forwardRef(da(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(m2e),[h,m]=p.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),v=pr(n,m),y=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=x?y.indexOf(x):-1,O=h?y.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,k=O>=w,C=p.useRef(!1),E=g2e(T=>{o==null||o(T),c==null||c(T),T.defaultPrevented||u==null||u()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(T=>{if(!(T instanceof Node))return!1;const N=[...f.branches].some(A=>A.contains(T));return k&&!N},[f.branches,k])}),R=b2e(T=>{if(r&&C.current)return;const N=T.target;[...f.branches].some(P=>P.contains(N))||(l==null||l(T),c==null||c(T),T.defaultPrevented||u==null||u())},g),_=h?O===y.length-1:!1,j=Nd(T=>{T.key==="Escape"&&(s==null||s(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))});return p.useEffect(()=>{if(_)return g.addEventListener("keydown",j,{capture:!0}),()=>g.removeEventListener("keydown",j,{capture:!0})},[g,_,j]),p.useEffect(()=>{if(h)return i&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(XY=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),dF(),()=>{i&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=XY))}},[h,g,i,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),dF())},[h,f]),p.useEffect(()=>{const T=da(()=>b({}),"handleUpdate");return document.addEventListener(uF,T),()=>document.removeEventListener(uF,T)},[]),a.jsx(Mr.div,{...d,ref:v,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:An(t.onFocusCapture,R.onFocusCapture),onBlurCapture:An(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:An(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function Yrt(){const e=p.useContext(m2e),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}da(Yrt,"useDismissableLayerSurface");var Zrt=da(()=>!0,"IS_TRUE");function g2e(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=Zrt}=t,l=Nd(e),c=p.useRef(!1),u=p.useRef(!1),d=p.useRef(new Map),f=p.useRef(()=>{});return p.useEffect(()=>{function h(){u.current=!1,r.current=!1,d.current.clear()}da(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}da(m,"isOutsideInteractionIntercepted");function g(w){if(!u.current)return;const O=w.target;O instanceof Node&&[...s].some(k=>k.contains(O))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}da(g,"handleInteractionCapture");function b(w){u.current&&d.current.set(w.type,!1)}da(b,"handleInteractionBubble");const v=da(w=>{if(w.target&&!c.current){let O=function(){n.removeEventListener("click",f.current);const k=m();h(),k||dQ(Grt,l,S,{discrete:!0})};if(da(O,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",f.current),h(),c.current=!1;return}const S={originalEvent:w};u.current=!0,r.current=i&&w.button===0,d.current.clear(),!i||w.button!==0?O():(n.removeEventListener("click",f.current),f.current=O,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),h();c.current=!1},"handlePointerDown"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of y)n.addEventListener(w,g,!0),n.addEventListener(w,b);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",f.current);for(const w of y)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,l,i,r,s,o]),{onPointerDownCapture:da(()=>c.current=!0,"onPointerDownCapture")}}da(g2e,"usePointerDownOutside");function b2e(e,t=globalThis==null?void 0:globalThis.document){const n=Nd(e),i=p.useRef(!1);return p.useEffect(()=>{const r=da(s=>{s.target&&!i.current&&dQ(Xrt,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:da(()=>i.current=!0,"onFocusCapture"),onBlurCapture:da(()=>i.current=!1,"onBlurCapture")}}da(b2e,"useFocusOutside");function dF(){const e=new CustomEvent(uF);document.dispatchEvent(e)}da(dF,"dispatchUpdate");function dQ(e,t,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),i?aQ(r,s):r.dispatchEvent(s)}da(dQ,"handleAndDispatchCustomEvent");var Jrt=Object.defineProperty,Al=(e,t)=>Jrt(e,"name",{value:t,configurable:!0}),YL="focusScope.autoFocusOnMount",ZL="focusScope.autoFocusOnUnmount",YY={bubbles:!1,cancelable:!0},y2e=p.forwardRef(Al(function(t,n){const{loop:i=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...l}=t,[c,u]=p.useState(null),d=Nd(s),f=Nd(o),h=p.useRef(null),m=pr(n,u),g=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(O){if(g.paused||!c)return;const S=O.target;c.contains(S)?h.current=S:Oh(h.current,{select:!0})},y=function(O){if(g.paused||!c)return;const S=O.relatedTarget;S!==null&&(c.contains(S)||Oh(h.current,{select:!0}))},x=function(O){if(document.activeElement===document.body)for(const k of O)k.removedNodes.length>0&&Oh(c)};Al(v,"handleFocusIn"),Al(y,"handleFocusOut"),Al(x,"handleMutations"),document.addEventListener("focusin",v),document.addEventListener("focusout",y);const w=new MutationObserver(x);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),w.disconnect()}}},[r,c,g.paused]),p.useEffect(()=>{if(c){ZY.add(g);const v=document.activeElement;if(!c.contains(v)){const x=new CustomEvent(YL,YY);c.addEventListener(YL,d),c.dispatchEvent(x),x.defaultPrevented||(v2e(S2e(fQ(c)),{select:!0}),document.activeElement===v&&Oh(c))}return()=>{c.removeEventListener(YL,d),setTimeout(()=>{const x=new CustomEvent(ZL,YY);c.addEventListener(ZL,f),c.dispatchEvent(x),x.defaultPrevented||Oh(v??document.body,{select:!0}),c.removeEventListener(ZL,f),ZY.remove(g)},0)}}},[c,d,f,g]);const b=p.useCallback(v=>{if(!i&&!r||g.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(y&&x){const w=v.currentTarget,[O,S]=x2e(w);O&&S?!v.shiftKey&&x===S?(v.preventDefault(),i&&Oh(O,{select:!0})):v.shiftKey&&x===O&&(v.preventDefault(),i&&Oh(S,{select:!0})):x===w&&v.preventDefault()}},[i,r,g.paused]);return a.jsx(Mr.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function v2e(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(Oh(i,{select:t}),document.activeElement!==n)return}Al(v2e,"focusFirst");function x2e(e){const t=fQ(e),n=fF(t,e),i=fF(t.reverse(),e);return[n,i]}Al(x2e,"getTabbableEdges");function fQ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Al(i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Al(fQ,"getTabbableCandidates");function fF(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):w2e(i,{upTo:t})))return i}Al(fF,"findVisible");function w2e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Al(w2e,"isHidden");function O2e(e){return e instanceof HTMLInputElement&&"select"in e}Al(O2e,"isSelectableInput");function Oh(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&O2e(e)&&t&&e.select()}}Al(Oh,"focus");var ZY=k2e();function k2e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=hF(e,t),e.unshift(t)},remove(t){var n;e=hF(e,t),(n=e[0])==null||n.resume()}}}Al(k2e,"createFocusScopesStack");function hF(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}Al(hF,"arrayRemove");function S2e(e){return e.filter(t=>t.tagName!=="A")}Al(S2e,"removeLinks");var est=Object.defineProperty,tst=(e,t)=>est(e,"name",{value:t,configurable:!0}),hQ=p.forwardRef(tst(function(t,n){var c;const{container:i,...r}=t,[s,o]=p.useState(!1);zu(()=>o(!0),[]);const l=i||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?ri.createPortal(a.jsx(Mr.div,{...r,ref:n}),l):null},"Portal")),nst=Object.defineProperty,pQ=(e,t)=>nst(e,"name",{value:t,configurable:!0}),EA=0,Zd=null;function ist(e){return rP(),e.children}pQ(ist,"FocusGuards");function rP(){p.useEffect(()=>{Zd||(Zd={start:pF(),end:pF()});const{start:e,end:t}=Zd;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),EA++,()=>{EA===1&&(Zd==null||Zd.start.remove(),Zd==null||Zd.end.remove(),Zd=null),EA=Math.max(0,EA-1)}},[])}pQ(rP,"useFocusGuards");function pF(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}pQ(pF,"createFocusGuard");var df=function(){return df=Object.assign||function(t){for(var n,i=1,r=arguments.length;i"u")return xst;var t=wst(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},kst=A2e(),rx="data-scroll-locked",Sst=function(e,t,n,i){var r=e.left,s=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(sst,` { overflow: hidden `).concat(i,`; padding-right: `).concat(l,"px ").concat(i,`; } @@ -498,87 +498,87 @@ data: ${JSON.stringify({...n,...r?{id:r}:{},...o?{snapshot:!0}:{}})}`)}(t.type== } body[`).concat(rx,`] { - `).concat(rst,": ").concat(l,`px; + `).concat(ost,": ").concat(l,`px; } -`)},eZ=function(){var e=parseInt(document.body.getAttribute(rx)||"0",10);return isFinite(e)?e:0},kst=function(){p.useEffect(function(){return document.body.setAttribute(rx,(eZ()+1).toString()),function(){var e=eZ()-1;e<=0?document.body.removeAttribute(rx):document.body.setAttribute(rx,e.toString())}},[])},Sst=function(e){var t=e.noRelative,n=e.noImportant,i=e.gapMode,r=i===void 0?"margin":i;kst();var s=p.useMemo(function(){return xst(r)},[r]);return p.createElement(wst,{styles:Ost(s,!t,r,n?"":"!important")})},mF=!1;if(typeof window<"u")try{var CA=Object.defineProperty({},"passive",{get:function(){return mF=!0,!0}});window.addEventListener("test",CA,CA),window.removeEventListener("test",CA,CA)}catch{mF=!1}var D0=mF?{passive:!1}:!1,Est=function(e){return e.tagName==="TEXTAREA"},_2e=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Est(e)&&n[t]==="visible")},Cst=function(e){return _2e(e,"overflowY")},Tst=function(e){return _2e(e,"overflowX")},tZ=function(e,t){var n=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=j2e(e,i);if(r){var s=N2e(e,i),o=s[1],l=s[2];if(o>l)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},Ast=function(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;return[t,n,i]},_st=function(e){var t=e.scrollLeft,n=e.scrollWidth,i=e.clientWidth;return[t,n,i]},j2e=function(e,t){return e==="v"?Cst(t):Tst(t)},N2e=function(e,t){return e==="v"?Ast(t):_st(t)},jst=function(e,t){return e==="h"&&t==="rtl"?-1:1},Nst=function(e,t,n,i,r){var s=jst(e,window.getComputedStyle(t).direction),o=s*i,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{if(!l)break;var m=N2e(e,l),g=m[0],b=m[1],v=m[2],y=b-v-s*g;(g||y)&&j2e(e,l)&&(f+=y,h+=g);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},TA=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nZ=function(e){return[e.deltaX,e.deltaY]},iZ=function(e){return e&&"current"in e?e.current:e},Rst=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ist=function(e){return` +`)},eZ=function(){var e=parseInt(document.body.getAttribute(rx)||"0",10);return isFinite(e)?e:0},Est=function(){p.useEffect(function(){return document.body.setAttribute(rx,(eZ()+1).toString()),function(){var e=eZ()-1;e<=0?document.body.removeAttribute(rx):document.body.setAttribute(rx,e.toString())}},[])},Cst=function(e){var t=e.noRelative,n=e.noImportant,i=e.gapMode,r=i===void 0?"margin":i;Est();var s=p.useMemo(function(){return Ost(r)},[r]);return p.createElement(kst,{styles:Sst(s,!t,r,n?"":"!important")})},mF=!1;if(typeof window<"u")try{var CA=Object.defineProperty({},"passive",{get:function(){return mF=!0,!0}});window.addEventListener("test",CA,CA),window.removeEventListener("test",CA,CA)}catch{mF=!1}var D0=mF?{passive:!1}:!1,Tst=function(e){return e.tagName==="TEXTAREA"},_2e=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Tst(e)&&n[t]==="visible")},Ast=function(e){return _2e(e,"overflowY")},_st=function(e){return _2e(e,"overflowX")},tZ=function(e,t){var n=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=j2e(e,i);if(r){var s=N2e(e,i),o=s[1],l=s[2];if(o>l)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},jst=function(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;return[t,n,i]},Nst=function(e){var t=e.scrollLeft,n=e.scrollWidth,i=e.clientWidth;return[t,n,i]},j2e=function(e,t){return e==="v"?Ast(t):_st(t)},N2e=function(e,t){return e==="v"?jst(t):Nst(t)},Rst=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ist=function(e,t,n,i,r){var s=Rst(e,window.getComputedStyle(t).direction),o=s*i,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{if(!l)break;var m=N2e(e,l),g=m[0],b=m[1],v=m[2],y=b-v-s*g;(g||y)&&j2e(e,l)&&(f+=y,h+=g);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},TA=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nZ=function(e){return[e.deltaX,e.deltaY]},iZ=function(e){return e&&"current"in e?e.current:e},Pst=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Dst=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Pst=0,M0=[];function Dst(e){var t=p.useRef([]),n=p.useRef([0,0]),i=p.useRef(),r=p.useState(Pst++)[0],s=p.useState(A2e)[0],o=p.useRef(e);p.useEffect(function(){o.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=nst([e.lockRef.current],(e.shards||[]).map(iZ),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=TA(b),x=n.current,w="deltaX"in b?b.deltaX:x[0]-y[0],O="deltaY"in b?b.deltaY:x[1]-y[1],S,k=b.target,C=Math.abs(w)>Math.abs(O)?"h":"v";if("touches"in b&&C==="h"&&k.type==="range")return!1;var E=window.getSelection(),R=E&&E.anchorNode,_=R?R===k||R.contains(k):!1;if(_)return!1;var j=tZ(C,k);if(!j)return!0;if(j?S=C:(S=C==="v"?"h":"v",j=tZ(C,k)),!j)return!1;if(!i.current&&"changedTouches"in b&&(w||O)&&(i.current=S),!S)return!0;var T=i.current||S;return Nst(T,v,b,T==="h"?w:O)},[]),c=p.useCallback(function(b){var v=b;if(!(!M0.length||M0[M0.length-1]!==s)){var y="deltaY"in v?nZ(v):TA(v),x=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Rst(S.delta,y)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(iZ).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=w.length>0?l(v,w[0]):!o.current.noIsolation;O&&v.cancelable&&v.preventDefault()}}},[]),u=p.useCallback(function(b,v,y,x){var w={name:b,delta:v,target:y,should:x,shadowParent:Mst(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(O){return O!==w})},1)},[]),d=p.useCallback(function(b){n.current=TA(b),i.current=void 0},[]),f=p.useCallback(function(b){u(b.type,nZ(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,TA(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return M0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,D0),document.addEventListener("touchmove",c,D0),document.addEventListener("touchstart",d,D0),function(){M0=M0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,D0),document.removeEventListener("touchmove",c,D0),document.removeEventListener("touchstart",d,D0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:Ist(r)}):null,m?p.createElement(Sst,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Mst(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Lst=dst(T2e,Dst);var mQ=p.forwardRef(function(e,t){return p.createElement(sP,df({},e,{ref:t,sideCar:Lst}))});mQ.classNames=sP.classNames;var $st=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},L0=new WeakMap,AA=new WeakMap,_A={},n5=0,R2e=function(e){return e&&(e.host||R2e(e.parentNode))},Fst=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=R2e(n);return i&&e.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Bst=function(e,t,n,i){var r=Fst(t,Array.isArray(e)?e:[e]);_A[n]||(_A[n]=new WeakMap);var s=_A[n],o=[],l=new Set,c=new Set(r),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var m=h.getAttribute(i),g=m!==null&&m!=="false",b=(L0.get(h)||0)+1,v=(s.get(h)||0)+1;L0.set(h,b),s.set(h,v),o.push(h),b===1&&g&&AA.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(i,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),l.clear(),n5++,function(){o.forEach(function(f){var h=L0.get(f)-1,m=s.get(f)-1;L0.set(f,h),s.set(f,m),h||(AA.has(f)||f.removeAttribute(i),AA.delete(f)),m||f.removeAttribute(n)}),n5--,n5||(L0=new WeakMap,L0=new WeakMap,AA=new WeakMap,_A={})}},I2e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),r=$st(e);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),Bst(i,r,n,"aria-hidden")):function(){return null}},Ust=Object.defineProperty,Qst=(e,t)=>Ust(e,"name",{value:t,configurable:!0});function wC(e){const[t,n]=p.useState(void 0);return zu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}Qst(wC,"useSize");var zst=Object.defineProperty,dp=(e,t)=>zst(e,"name",{value:t,configurable:!0}),gQ="Checkbox",[Vst,man]=hc(gQ),[Hst,bQ]=Vst(gQ);function P2e(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:r,disabled:s,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Ju({prop:n,defaultProp:r??!1,onChange:c,caller:gQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!o||!!g.closest("form"):!0,k={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:Gh(r)?!1:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return a.jsx(Hst,{scope:t,...k,children:D2e(f)?f(k):i})}dp(P2e,"CheckboxProvider");var qst="CheckboxTrigger",Wst=p.forwardRef(dp(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...r},s){const{control:o,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=bQ(qst,t),y=pr(s,f),x=p.useRef(u);return p.useEffect(()=>{const w=o==null?void 0:o.form;if(w){const O=dp(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[o,h]),a.jsx(Mr.button,{type:"button",role:"checkbox","aria-checked":Gh(u)?"mixed":u,"aria-required":d,"data-state":yQ(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onKeyDown:An(n,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:An(i,w=>{g(),h(O=>Gh(O)?!0:!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"CheckboxTrigger")),Kst=p.forwardRef(dp(function(t,n){const{__scopeCheckbox:i,name:r,checked:s,defaultChecked:o,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return a.jsx(P2e,{__scopeCheckbox:i,checked:s,defaultChecked:o,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Wst,{...h,ref:n,__scopeCheckbox:i}),m&&a.jsx(Zst,{__scopeCheckbox:i})]})})},"Checkbox")),Gst="CheckboxIndicator",Xst=p.forwardRef(dp(function(t,n){const{__scopeCheckbox:i,forceMount:r,...s}=t,o=bQ(Gst,i);return a.jsx(Qf,{present:r||Gh(o.checked)||o.checked===!0,children:a.jsx(Mr.span,{"data-state":yQ(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),Yst="CheckboxBubbleInput",Zst=p.forwardRef(dp(function({__scopeCheckbox:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=bQ(Yst,t),y=pr(r,v),x=wC(s),w=p.useRef(!1),O=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const C=b;if(!C)return;const E=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const N=!(j&&o.current);if(T&&_){w.current=!j;const A=new Event("click",{bubbles:N});C.indeterminate=Gh(c),_.call(C,Gh(c)?!1:c),C.dispatchEvent(A),w.current=!1}},[b,c,o,l]);const k=p.useRef(Gh(c)?!1:c);return a.jsx(Mr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??k.current,required:d,disabled:f,name:h,value:m,form:g,...i,tabIndex:-1,ref:y,onClick:An(n,C=>{w.current&&C.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function D2e(e){return typeof e=="function"}dp(D2e,"isFunction");function Gh(e){return e==="indeterminate"}dp(Gh,"isIndeterminate");function yQ(e){return Gh(e)?"indeterminate":e?"checked":"unchecked"}dp(yQ,"getState");var Jst=Object.defineProperty,Um=(e,t)=>Jst(e,"name",{value:t,configurable:!0}),M2e="Popper",[L2e,zw]=hc(M2e),[eot,$2e]=L2e(M2e),tot=Um(e=>{const{__scopePopper:t,children:n}=e,[i,r]=p.useState(null),[s,o]=p.useState(void 0);return a.jsx(eot,{scope:t,anchor:i,onAnchorChange:r,placementState:s,setPlacementState:o,children:n})},"Popper"),not="PopperAnchor",iot=p.forwardRef(Um(function(t,n){const{__scopePopper:i,virtualRef:r,...s}=t,o=$2e(not,i),l=p.useRef(null),c=o.onAnchorChange,u=p.useCallback(b=>{l.current=b,b&&c(b)},[c]),d=pr(n,u),f=p.useRef(null);p.useEffect(()=>{if(!r)return;const b=f.current;f.current=r.current,b!==f.current&&c(f.current)});const h=o.placementState&&oP(o.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return r?null:a.jsx(Mr.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),F2e="PopperContent",[rot,gan]=L2e(F2e),sot=p.forwardRef(Um(function(t,n){var Z,ce,Ee,Y,G,te,ye;const{__scopePopper:i,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...v}=t,y=$2e(F2e,i),[x,w]=p.useState(null),O=pr(n,w),[S,k]=p.useState(null),C=wC(S),E=(C==null?void 0:C.width)??0,R=(C==null?void 0:C.height)??0,_=r+(o!=="center"?"-"+o:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(d)?d:[d],N=T.length>0,A={padding:j,boundary:T.filter(B2e),altBoundary:N},{refs:P,floatingStyles:D,placement:M,isPositioned:L,middlewareData:U}=QTe({strategy:"fixed",placement:_,whileElementsMounted:Um((...Ne)=>Y6(...Ne,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[zTe({mainAxis:s+R,alignmentAxis:l}),u&&VTe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?HTe():void 0,...A}),u&&qTe({...A}),WTe({...A,apply:Um(({elements:Ne,rects:pe,availableWidth:me,availableHeight:se})=>{const{width:Se,height:Le}=pe.reference,be=Ne.floating.style;be.setProperty("--radix-popper-available-width",`${me}px`),be.setProperty("--radix-popper-available-height",`${se}px`),be.setProperty("--radix-popper-anchor-width",`${Se}px`),be.setProperty("--radix-popper-anchor-height",`${Le}px`)},"apply")}),S&&vtt({element:S,padding:c}),oot({arrowWidth:E,arrowHeight:R}),m&&ytt({strategy:"referenceHidden",...A,boundary:N?A.boundary:void 0})]}),I=y.setPlacementState;zu(()=>(I(M),()=>{I(void 0)}),[M,I]);const[H,K]=oP(M),F=Nd(b);zu(()=>{L&&(F==null||F())},[L,F]);const W=(Z=U.arrow)==null?void 0:Z.x,V=(ce=U.arrow)==null?void 0:ce.y,X=((Ee=U.arrow)==null?void 0:Ee.centerOffset)!==0,[ie,Q]=p.useState();return zu(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),a.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:L?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Y=U.transformOrigin)==null?void 0:Y.x,(G=U.transformOrigin)==null?void 0:G.y].join(" "),...((te=U.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(rot,{scope:i,placedSide:H,placedAlign:K,onArrowChange:k,arrowX:W,arrowY:V,shouldHideArrow:X,children:a.jsx(Mr.div,{"data-side":H,"data-align":K,...v,ref:O,style:{...v.style,animation:L?(ye=v.style)==null?void 0:ye.animation:"none"}})})})},"PopperContent"));function B2e(e){return e!==null}Um(B2e,"isNotNull");var oot=Um(e=>({name:"transformOrigin",options:e,fn(t){var v,y,x;const{placement:n,rects:i,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=oP(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((y=r.arrow)==null?void 0:y.x)??0)+l/2,m=(((x=r.arrow)==null?void 0:x.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?f:`${h}px`,b=`${-c}px`):u==="top"?(g=o?f:`${h}px`,b=`${i.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?f:`${m}px`):u==="left"&&(g=`${i.floating.width+c}px`,b=o?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function oP(e){const[t,n="center"]=e.split("-");return[t,n]}Um(oP,"getSideAndAlignFromPlacement");var aP=tot,vQ=iot,xQ=sot,aot=Object.defineProperty,wQ=(e,t)=>aot(e,"name",{value:t,configurable:!0}),i5=!1;function U2e(){const[e,t]=p.useState(i5);return p.useEffect(()=>{i5||(i5=!0,t(!0))},[]),e}wQ(U2e,"useIsHydrated");var Q2e=Py[" useSyncExternalStore ".trim().toString()];function z2e(){return()=>{}}wQ(z2e,"subscribe");function V2e(){return Q2e(z2e,()=>!0,()=>!1)}wQ(V2e,"useIsHydratedModern");var lot=typeof Q2e=="function"?V2e:U2e,cot=Object.defineProperty,Vy=(e,t)=>cot(e,"name",{value:t,configurable:!0}),r5="rovingFocusGroup.onEntryFocus",uot={bubbles:!1,cancelable:!0},lP="RovingFocusGroup",[gF,H2e,dot]=lQ(lP),[fot,Vw]=hc(lP,[dot]),[hot,pot]=fot(lP),mot=p.forwardRef(Vy(function(t,n){return a.jsx(gF.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(gF.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(got,{...t,ref:n})})})},"RovingFocusGroup")),got=p.forwardRef(Vy(function(t,n){const{__scopeRovingFocusGroup:i,orientation:r,loop:s=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=pr(n,m),b=xC(o),[v,y]=Ju({prop:l,defaultProp:c??null,onChange:u,caller:lP}),[x,w]=p.useState(!1),O=Nd(d),S=H2e(i),k=p.useRef(!1),[C,E]=p.useState(0);return p.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(r5,O),()=>R.removeEventListener(r5,O)},[O]),a.jsx(hot,{scope:i,orientation:r,dir:b,loop:s,currentTabStopId:v,onItemFocus:p.useCallback(R=>y(R),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(R=>R+1),[]),onFocusableItemRemove:p.useCallback(()=>E(R=>R-1),[]),children:a.jsx(Mr.div,{tabIndex:x||C===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:An(t.onMouseDown,()=>{k.current=!0}),onFocus:An(t.onFocus,R=>{const _=!k.current;if(R.target===R.currentTarget&&_&&!x){const j=new CustomEvent(r5,uot);if(R.currentTarget.dispatchEvent(j),!j.defaultPrevented){const T=S().filter(M=>M.focusable),N=T.find(M=>M.active),A=T.find(M=>M.id===v),D=[N,A,...T].filter(Boolean).map(M=>M.ref.current);OQ(D,f)}}k.current=!1}),onBlur:An(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),bot="RovingFocusGroupItem",yot=p.forwardRef(Vy(function(t,n){const{__scopeRovingFocusGroup:i,focusable:r=!0,active:s=!1,tabStopId:o,children:l,...c}=t,u=sg(),d=o||u,f=pot(bot,i),h=f.currentTabStopId===d,m=H2e(i),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=f,y=lot();return zu(()=>{if(!(!y||!r))return g(),()=>b()},[y,r,g,b]),p.useEffect(()=>{if(!(y||!r))return g(),()=>b()},[y,r,g,b]),a.jsx(gF.ItemSlot,{scope:i,id:d,focusable:r,active:s,children:a.jsx(Mr.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:An(t.onMouseDown,x=>{r?f.onItemFocus(d):x.preventDefault()}),onFocus:An(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:An(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const w=W2e(x,f.orientation,f.dir);if(w!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=m().filter(k=>k.focusable).map(k=>k.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const k=S.indexOf(x.currentTarget);S=f.loop?K2e(S,k+1):S.slice(k+1)}setTimeout(()=>OQ(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),vot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function q2e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Vy(q2e,"getDirectionAwareKey");function W2e(e,t,n){const i=q2e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return vot[i]}Vy(W2e,"getFocusIntent");function OQ(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Vy(OQ,"focusFirst");function K2e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Vy(K2e,"wrapArray");var kQ=mot,SQ=yot,xot=Object.defineProperty,nr=(e,t)=>xot(e,"name",{value:t,configurable:!0}),bF=["Enter"," "],wot=["ArrowDown","PageUp","Home"],G2e=["ArrowUp","PageDown","End"],Oot=[...wot,...G2e],kot={ltr:[...bF,"ArrowRight"],rtl:[...bF,"ArrowLeft"]},Sot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cP="Menu",[zS,Eot,Cot]=lQ(cP),[Hy,X2e]=hc(cP,[Cot,zw,Vw]),uP=zw(),Y2e=Vw(),[Z2e,_g]=Hy(cP),[Tot,OC]=Hy(cP),Aot=nr(e=>{const{__scopeMenu:t,open:n=!1,children:i,dir:r,onOpenChange:s,modal:o=!0}=e,l=uP(t),[c,u]=p.useState(null),d=p.useRef(!1),f=Nd(s),h=xC(r);return p.useEffect(()=>{const m=nr(()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=nr(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),p.useEffect(()=>{if(!n)return;const m=nr(()=>f(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,f]),a.jsx(aP,{...l,children:a.jsx(Z2e,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(Tot,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:i})})})},"Menu"),J2e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t,s=uP(i);return a.jsx(vQ,{...s,...r,ref:n})},"MenuAnchor")),e_e="MenuPortal",[_ot,t_e]=Hy(e_e,{forceMount:void 0}),jot=nr(e=>{const{__scopeMenu:t,forceMount:n,children:i,container:r}=e,s=_g(e_e,t);return a.jsx(_ot,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"MenuPortal"),Cd="MenuContent",[Not,EQ]=Hy(Cd),Rot=p.forwardRef(nr(function(t,n){const i=t_e(Cd,t.__scopeMenu),{forceMount:r=i.forceMount,...s}=t,o=_g(Cd,t.__scopeMenu),l=OC(Cd,t.__scopeMenu);return a.jsx(zS.Provider,{scope:t.__scopeMenu,children:a.jsx(Qf,{present:r||o.open,children:a.jsx(zS.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Iot,{...s,ref:n}):a.jsx(Pot,{...s,ref:n})})})})},"MenuContent")),Iot=p.forwardRef(nr(function(t,n){const i=_g(Cd,t.__scopeMenu),r=p.useRef(null),s=pr(n,r);return p.useEffect(()=>{const o=r.current;if(o)return I2e(o)},[]),a.jsx(CQ,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:An(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentModal")),Pot=p.forwardRef(nr(function(t,n){const i=_g(Cd,t.__scopeMenu);return a.jsx(CQ,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentNonModal")),Dot=cp("MenuContent.ScrollLock"),CQ=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,y=_g(Cd,i),x=OC(Cd,i),w=uP(i),O=Y2e(i),S=Eot(i),[k,C]=p.useState(null),E=p.useRef(null),R=pr(n,E,y.onContentChange),_=p.useRef(0),j=p.useRef(""),T=p.useRef(0),N=p.useRef(null),A=p.useRef("right"),P=p.useRef(0),D=b?mQ:p.Fragment,M=b?{as:Dot,allowPinchZoom:!0}:void 0,L=nr(I=>{var Q,Z;const H=j.current+I,K=S().filter(ce=>!ce.disabled),F=document.activeElement,W=(Q=K.find(ce=>ce.ref.current===F))==null?void 0:Q.textValue,V=K.map(ce=>ce.textValue),X=c_e(V,H,W),ie=(Z=K.find(ce=>ce.textValue===X))==null?void 0:Z.ref.current;nr(function ce(Ee){j.current=Ee,window.clearTimeout(_.current),Ee!==""&&(_.current=window.setTimeout(()=>ce(""),1e3))},"updateSearch")(H),ie&&setTimeout(()=>ie.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(_.current),[]),rP();const U=p.useCallback(I=>{var K,F;return A.current===((K=N.current)==null?void 0:K.side)&&d_e(I,(F=N.current)==null?void 0:F.area)},[]);return a.jsx(Not,{scope:i,searchRef:j,onItemEnter:p.useCallback(I=>{U(I)&&I.preventDefault()},[U]),onItemLeave:p.useCallback(I=>{var H;U(I)||((H=E.current)==null||H.focus(),C(null))},[U]),onTriggerLeave:p.useCallback(I=>{U(I)&&I.preventDefault()},[U]),pointerGraceTimerRef:T,onPointerGraceIntentChange:p.useCallback(I=>{N.current=I},[]),children:a.jsx(D,{...M,children:a.jsx(y2e,{asChild:!0,trapped:s,onMountAutoFocus:An(o,I=>{var H;I.preventDefault(),(H=E.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:a.jsx(kQ,{asChild:!0,...O,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:An(u,I=>{x.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(xQ,{role:"menu","aria-orientation":"vertical","data-state":AQ(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:R,style:{outline:"none",...v.style},onKeyDown:An(v.onKeyDown,I=>{const K=I.target.closest("[data-radix-menu-content]")===I.currentTarget,F=I.ctrlKey||I.altKey||I.metaKey,W=I.key.length===1;K&&(I.key==="Tab"&&I.preventDefault(),!F&&W&&L(I.key));const V=E.current;if(I.target!==V||!Oot.includes(I.key))return;I.preventDefault();const ie=S().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);G2e.includes(I.key)&&ie.reverse(),a_e(ie)}),onBlur:An(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(_.current),j.current="")}),onPointerMove:An(t.onPointerMove,Xx(I=>{const H=I.target,K=P.current!==I.clientX;if(I.currentTarget.contains(H)&&K){const F=I.clientX>P.current?"right":"left";A.current=F,P.current=I.clientX}}))})})})})})})},"MenuContentImpl")),Mot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return a.jsx(Mr.div,{role:"group",...r,ref:n})},"MenuGroup")),yF="MenuItem",rZ="menu.itemSelect",TQ=p.forwardRef(nr(function(t,n){const{disabled:i=!1,onSelect:r,...s}=t,o=p.useRef(null),l=OC(yF,t.__scopeMenu),c=EQ(yF,t.__scopeMenu),u=pr(n,o),d=p.useRef(!1),f=nr(()=>{const h=o.current;if(!i&&h){const m=new CustomEvent(rZ,{bubbles:!0,cancelable:!0});h.addEventListener(rZ,g=>r==null?void 0:r(g),{once:!0}),aQ(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return a.jsx(n_e,{...s,ref:u,disabled:i,onClick:An(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:An(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:An(t.onKeyDown,h=>{i||h.target!==h.currentTarget||c.searchRef.current!==""&&h.key===" "||bF.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),n_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,disabled:r=!1,textValue:s,...o}=t,l=EQ(yF,i),c=Y2e(i),u=p.useRef(null),d=pr(n,u),[f,h]=p.useState(!1),[m,g]=p.useState("");return p.useEffect(()=>{const b=u.current;b&&g((b.textContent??"").trim())},[o.children]),a.jsx(zS.ItemSlot,{scope:i,disabled:r,textValue:s??m,children:a.jsx(SQ,{asChild:!0,...c,focusable:!r,children:a.jsx(Mr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:An(t.onPointerMove,Xx(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(t.onPointerLeave,Xx(b=>l.onItemLeave(b))),onFocus:An(t.onFocus,()=>h(!0)),onBlur:An(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),Lot=p.forwardRef(nr(function(t,n){const{checked:i=!1,onCheckedChange:r,...s}=t;return a.jsx(r_e,{scope:t.__scopeMenu,checked:i,children:a.jsx(TQ,{role:"menuitemcheckbox","aria-checked":VS(i)?"mixed":i,...s,ref:n,"data-state":dP(i),onSelect:An(s.onSelect,()=>r==null?void 0:r(VS(i)?!0:!i),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),$ot="MenuRadioGroup",[Fot,Bot]=Hy($ot,{value:void 0,onValueChange:nr(()=>{},"onValueChange")}),Uot=p.forwardRef(nr(function(t,n){const{value:i,onValueChange:r,...s}=t,o=Nd(r);return a.jsx(Fot,{scope:t.__scopeMenu,value:i,onValueChange:o,children:a.jsx(Mot,{...s,ref:n})})},"MenuRadioGroup")),Qot="MenuRadioItem",zot=p.forwardRef(nr(function(t,n){const{value:i,...r}=t,s=Bot(Qot,t.__scopeMenu),o=i===s.value;return a.jsx(r_e,{scope:t.__scopeMenu,checked:o,children:a.jsx(TQ,{role:"menuitemradio","aria-checked":o,...r,ref:n,"data-state":dP(o),onSelect:An(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,i)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),i_e="MenuItemIndicator",[r_e,Vot]=Hy(i_e,{checked:!1}),Hot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,forceMount:r,...s}=t,o=Vot(i_e,i);return a.jsx(Qf,{present:r||VS(o.checked)||o.checked===!0,children:a.jsx(Mr.span,{...s,ref:n,"data-state":dP(o.checked)})})},"MenuItemIndicator")),qot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return a.jsx(Mr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})},"MenuSeparator")),s_e="MenuSub",[Wot,o_e]=Hy(s_e),Kot=nr(e=>{const{__scopeMenu:t,children:n,open:i=!1,onOpenChange:r}=e,s=_g(s_e,t),o=uP(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=Nd(r);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),a.jsx(aP,{...o,children:a.jsx(Z2e,{scope:t,open:i,onOpenChange:f,content:u,onContentChange:d,children:a.jsx(Wot,{scope:t,contentId:sg(),triggerId:sg(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),jA="MenuSubTrigger",Got=p.forwardRef(nr(function(t,n){const i=_g(jA,t.__scopeMenu),r=OC(jA,t.__scopeMenu),s=o_e(jA,t.__scopeMenu),o=EQ(jA,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=o,d={__scopeMenu:t.__scopeMenu},f=p.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]);const h=pr(n,s.onTriggerChange);return a.jsx(J2e,{asChild:!0,...d,children:a.jsx(n_e,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?s.contentId:void 0,"data-state":AQ(i.open),...t,ref:h,onClick:m=>{var g;(g=t.onClick)==null||g.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:An(t.onPointerMove,Xx(m=>{o.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!i.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{i.onOpenChange(!0),f()},100))})),onPointerLeave:An(t.onPointerLeave,Xx(m=>{var b,v;f();const g=(b=i.content)==null?void 0:b.getBoundingClientRect();if(g){const y=(v=i.content)==null?void 0:v.dataset.side,x=y==="right",w=x?-5:5,O=g[x?"left":"right"],S=g[x?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:O,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:O,y:g.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:An(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||o.searchRef.current!==""&&m.key===" "||kot[r.dir].includes(m.key)&&(i.onOpenChange(!0),(b=i.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),Xot="MenuSubContent",Yot=p.forwardRef(nr(function(t,n){const i=t_e(Cd,t.__scopeMenu),{forceMount:r=i.forceMount,align:s="start",...o}=t,l=_g(Cd,t.__scopeMenu),c=OC(Cd,t.__scopeMenu),u=o_e(Xot,t.__scopeMenu),d=p.useRef(null),f=pr(n,d);return a.jsx(zS.Provider,{scope:t.__scopeMenu,children:a.jsx(Qf,{present:r||l.open,children:a.jsx(zS.Slot,{scope:t.__scopeMenu,children:a.jsx(CQ,{id:u.contentId,"aria-labelledby":u.triggerId,...o,ref:f,align:s,side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;c.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:An(t.onFocusOutside,h=>{h.target!==u.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:An(t.onEscapeKeyDown,h=>{c.onClose(),h.preventDefault()}),onKeyDown:An(t.onKeyDown,h=>{var b;const m=h.currentTarget.contains(h.target),g=Sot[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function AQ(e){return e?"open":"closed"}nr(AQ,"getOpenState");function VS(e){return e==="indeterminate"}nr(VS,"isIndeterminate");function dP(e){return VS(e)?"indeterminate":e?"checked":"unchecked"}nr(dP,"getCheckedState");function a_e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}nr(a_e,"focusFirst");function l_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}nr(l_e,"wrapArray");function c_e(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=l_e(e,Math.max(s,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}nr(c_e,"getNextMatch");function u_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}nr(u_e,"isPointInPolygon");function d_e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return u_e(n,t)}nr(d_e,"isPointerInGraceArea");function Xx(e){return t=>t.pointerType==="mouse"?e(t):void 0}nr(Xx,"whenMouse");var Zot=Aot,Jot=J2e,eat=jot,tat=Rot,nat=TQ,iat=Lot,rat=Uot,sat=zot,oat=Hot,aat=qot,lat=Kot,cat=Got,uat=Yot,dat=Object.defineProperty,fu=(e,t)=>dat(e,"name",{value:t,configurable:!0}),_Q="DropdownMenu",[fat,ban]=hc(_Q,[X2e]),hu=X2e(),[hat,f_e]=fat(_Q),pat=fu(e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:r,defaultOpen:s,onOpenChange:o,modal:l=!0}=e,c=hu(t),u=p.useRef(null),[d,f]=Ju({prop:r,defaultProp:s??!1,onChange:o,caller:_Q});return a.jsx(hat,{scope:t,triggerId:sg(),triggerRef:u,contentId:sg(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(Zot,{...c,open:d,onOpenChange:f,dir:i,modal:l,children:n})})},"DropdownMenu"),mat="DropdownMenuTrigger",gat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,disabled:r=!1,...s}=t,o=f_e(mat,i),l=hu(i),c=pr(n,o.triggerRef);return a.jsx(Jot,{asChild:!0,...l,children:a.jsx(Mr.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:c,onPointerDown:An(t.onPointerDown,u=>{!r&&u.button===0&&u.ctrlKey===!1&&(o.onOpenToggle(),o.open||u.preventDefault())}),onKeyDown:An(t.onKeyDown,u=>{r||(["Enter"," "].includes(u.key)&&o.onOpenToggle(),u.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),bat=fu(e=>{const{__scopeDropdownMenu:t,...n}=e,i=hu(t);return a.jsx(eat,{...i,...n})},"DropdownMenuPortal"),yat="DropdownMenuContent",vat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=f_e(yat,i),o=hu(i),l=p.useRef(!1);return a.jsx(tat,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:n,onCloseAutoFocus:An(t.onCloseAutoFocus,c=>{var u;l.current||(u=s.triggerRef.current)==null||u.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:An(t.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;(!s.modal||f)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),xat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(nat,{...s,...r,ref:n})},"DropdownMenuItem")),wat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(iat,{...s,...r,ref:n})},"DropdownMenuCheckboxItem")),Oat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(rat,{...s,...r,ref:n})},"DropdownMenuRadioGroup")),kat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(sat,{...s,...r,ref:n})},"DropdownMenuRadioItem")),Sat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(oat,{...s,...r,ref:n})},"DropdownMenuItemIndicator")),Eat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(aat,{...s,...r,ref:n})},"DropdownMenuSeparator")),Cat=fu(e=>{const{__scopeDropdownMenu:t,children:n,open:i,onOpenChange:r,defaultOpen:s}=e,o=hu(t),[l,c]=Ju({prop:i,defaultProp:s??!1,onChange:r,caller:"DropdownMenuSub"});return a.jsx(lat,{...o,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),Tat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(cat,{...s,...r,ref:n})},"DropdownMenuSubTrigger")),Aat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(uat,{...s,...r,ref:n,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),_at=pat,jat=gat,h_e=bat,Nat=vat,p_e=xat,Rat=wat,Iat=Oat,Pat=kat,m_e=Sat,Dat=Eat,Mat=Cat,Lat=Tat,$at=Aat,Fat=Object.defineProperty,jg=(e,t)=>Fat(e,"name",{value:t,configurable:!0}),jQ="Popover",[g_e,yan]=hc(jQ,[zw]),NQ=zw(),[Bat,Hw]=g_e(jQ),Uat=jg(e=>{const{__scopePopover:t,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:o=!1}=e,l=NQ(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=Ju({prop:i,defaultProp:r??!1,onChange:s,caller:jQ});return a.jsx(aP,{...l,children:a.jsx(Bat,{scope:t,contentId:sg(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>d(!0),[]),onCustomAnchorRemove:p.useCallback(()=>d(!1),[]),modal:o,children:n})})},"Popover"),Qat="PopoverTrigger",zat=p.forwardRef(jg(function(t,n){const{__scopePopover:i,...r}=t,s=Hw(Qat,i),o=NQ(i),l=pr(n,s.triggerRef),c=a.jsx(Mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":RQ(s.open),...r,ref:l,onClick:An(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(vQ,{asChild:!0,...o,children:c})},"PopoverTrigger")),b_e="PopoverPortal",[Vat,Hat]=g_e(b_e,{forceMount:void 0}),qat=jg(e=>{const{__scopePopover:t,forceMount:n,children:i,container:r}=e,s=Hw(b_e,t);return a.jsx(Vat,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"PopoverPortal"),HS="PopoverContent",Wat=p.forwardRef(jg(function(t,n){const i=Hat(HS,t.__scopePopover),{forceMount:r=i.forceMount,...s}=t,o=Hw(HS,t.__scopePopover);return a.jsx(Qf,{present:r||o.open,children:o.modal?a.jsx(Gat,{...s,ref:n}):a.jsx(Xat,{...s,ref:n})})},"PopoverContent")),Kat=cp("PopoverContent.RemoveScroll"),Gat=p.forwardRef(jg(function(t,n){const i=Hw(HS,t.__scopePopover),r=p.useRef(null),s=pr(n,r),o=p.useRef(!1);return p.useEffect(()=>{const l=r.current;if(l)return I2e(l)},[]),a.jsx(mQ,{as:Kat,allowPinchZoom:!0,children:a.jsx(y_e,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:An(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=i.triggerRef.current)==null||c.focus()}),onPointerDownOutside:An(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:An(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Xat=p.forwardRef(jg(function(t,n){const i=Hw(HS,t.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return a.jsx(y_e,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(r.current||(c=i.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=i.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})},"PopoverContentNonModal")),y_e=p.forwardRef(jg(function(t,n){const{__scopePopover:i,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Hw(HS,i),g=NQ(i);return rP(),a.jsx(y2e,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:a.jsx(xQ,{"data-state":RQ(m.open),role:"dialog",id:m.contentId,...g,...h,ref:n,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function RQ(e){return e?"open":"closed"}jg(RQ,"getState");var v_e=Uat,x_e=zat,w_e=qat,O_e=Wat,Yat=Object.defineProperty,rl=(e,t)=>Yat(e,"name",{value:t,configurable:!0}),k_e="Radio",[Zat,S_e]=hc(k_e),[Jat,fP]=Zat(k_e);function E_e(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:r,form:s,name:o,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=p.useState(null),[m,g]=p.useState(null),b=p.useRef(!1),[v,y]=p.useReducer(O=>O+1,0),x=f?!!s||!!f.closest("form"):!0,w={checked:n,disabled:r,required:c,name:o,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:m,setBubbleInput:g,onCheck:rl(()=>l==null?void 0:l(),"onCheck")};return a.jsx(Jat,{scope:t,...w,children:C_e(d)?d(w):i})}rl(E_e,"RadioProvider");var elt="RadioTrigger",tlt=p.forwardRef(rl(function({__scopeRadio:t,onClick:n,...i},r){const{checked:s,disabled:o,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=fP(elt,t),g=pr(r,c);return a.jsx(Mr.button,{type:"button",role:"radio","aria-checked":s,"data-state":IQ(s),"data-disabled":o?"":void 0,disabled:o,value:l,...i,ref:g,onClick:An(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),nlt="RadioIndicator",ilt=p.forwardRef(rl(function(t,n){const{__scopeRadio:i,forceMount:r,...s}=t,o=fP(nlt,i);return a.jsx(Qf,{present:r||o.checked,children:a.jsx(Mr.span,{"data-state":IQ(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),rlt="RadioBubbleInput",slt=p.forwardRef(rl(function({__scopeRadio:t,onClick:n,...i},r){const{control:s,checked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=fP(rlt,t),v=pr(r,m),y=wC(s),x=p.useRef(!1),w=p.useRef(o),O=p.useRef(b);p.useEffect(()=>{const k=h;if(!k)return;const C=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(C,"checked").set,_=b!==O.current;O.current=b;const j=w.current!==o;w.current=o;const T=!(_&&g.current);if(j&&R){x.current=!_;const N=new Event("click",{bubbles:T});R.call(k,o),k.dispatchEvent(N),x.current=!1}},[h,o,g,b]);const S=p.useRef(o);return a.jsx(Mr.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...i,tabIndex:-1,ref:v,onClick:An(n,k=>{x.current&&k.stopPropagation()}),style:{...i.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function C_e(e){return typeof e=="function"}rl(C_e,"isFunction");function IQ(e){return e?"checked":"unchecked"}rl(IQ,"getState");var olt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],PQ="RadioGroup",[alt,van]=hc(PQ,[Vw,S_e]),T_e=Vw(),hP=S_e(),[llt,clt]=alt(PQ),ult=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,name:r,form:s,defaultValue:o,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=T_e(i),v=xC(f),[y,x]=Ju({prop:l,defaultProp:o??null,onChange:m,caller:PQ}),[w,O]=p.useState(null),S=pr(n,O),k=p.useRef(y);return p.useEffect(()=>{const C=s?w==null?void 0:w.ownerDocument.getElementById(s):w==null?void 0:w.closest("form");if(C instanceof HTMLFormElement){const E=rl(()=>x(k.current),"reset");return C.addEventListener("reset",E),()=>C.removeEventListener("reset",E)}},[w,s,x]),a.jsx(llt,{scope:i,name:r,form:s,required:c,disabled:u,value:y,onValueChange:x,children:a.jsx(kQ,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:a.jsx(Mr.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),dlt="RadioGroupItemProvider",flt="RadioGroupItemTrigger";function A_e(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:r,internal_do_not_use_render:s}=e,o=clt(dlt,t),l=hP(t),c=o.disabled||i;return a.jsx(E_e,{...l,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:s,children:r})}rl(A_e,"RadioGroupItemProvider");var hlt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=T_e(i),o=hP(i),{checked:l,disabled:c}=fP(flt,o.__scopeRadio),u=p.useRef(null),d=pr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=rl(g=>{olt.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=rl(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),a.jsx(SQ,{asChild:!0,...s,focusable:!c,active:l,children:a.jsx(tlt,{...o,...r,ref:d,onKeyDown:An(r.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:An(r.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),plt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,value:r,disabled:s,...o}=t;return a.jsx(A_e,{__scopeRadioGroup:i,value:r,disabled:s,internal_do_not_use_render:({isFormControl:l})=>a.jsxs(a.Fragment,{children:[a.jsx(hlt,{...o,ref:n,__scopeRadioGroup:i}),l&&a.jsx(mlt,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),mlt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=hP(i);return a.jsx(slt,{...s,...r,ref:n})},"RadioGroupItemBubbleInput")),glt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=hP(i);return a.jsx(ilt,{...s,...r,ref:n})},"RadioGroupIndicator")),blt=Object.defineProperty,og=(e,t)=>blt(e,"name",{value:t,configurable:!0}),DQ="Switch",[ylt,xan]=hc(DQ),[vlt,MQ]=ylt(DQ);function __e(e){const{__scopeSwitch:t,checked:n,children:i,defaultChecked:r,disabled:s,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Ju({prop:n,defaultProp:r??!1,onChange:c,caller:DQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!o||!!g.closest("form"):!0,k={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return a.jsx(vlt,{scope:t,...k,children:j_e(f)?f(k):i})}og(__e,"SwitchProvider");var xlt="SwitchTrigger",wlt=p.forwardRef(og(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,form:o,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=MQ(xlt,t),y=pr(r,f),x=p.useRef(u);return p.useEffect(()=>{const w=o?s==null?void 0:s.ownerDocument.getElementById(o):s==null?void 0:s.form;if(w instanceof HTMLFormElement){const O=og(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[s,o,h]),a.jsx(Mr.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":LQ(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onClick:An(n,w=>{g(),h(O=>!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"SwitchTrigger")),Olt=p.forwardRef(og(function(t,n){const{__scopeSwitch:i,name:r,checked:s,defaultChecked:o,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return a.jsx(__e,{__scopeSwitch:i,checked:s,defaultChecked:o,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(wlt,{...h,ref:n,__scopeSwitch:i}),m&&a.jsx(Clt,{__scopeSwitch:i})]})})},"Switch")),klt="SwitchThumb",Slt=p.forwardRef(og(function(t,n){const{__scopeSwitch:i,...r}=t,s=MQ(klt,i);return a.jsx(Mr.span,{"data-state":LQ(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),Elt="SwitchBubbleInput",Clt=p.forwardRef(og(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=MQ(Elt,t),y=pr(r,v),x=wC(s),w=p.useRef(!1),O=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const C=b;if(!C)return;const E=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const N=!(j&&o.current);if(T&&_){w.current=!j;const A=new Event("click",{bubbles:N});_.call(C,c),C.dispatchEvent(A),w.current=!1}},[b,c,o,l]);const k=p.useRef(c);return a.jsx(Mr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??k.current,required:d,disabled:f,name:h,value:m,form:g,...i,tabIndex:-1,ref:y,onClick:An(n,C=>{w.current&&C.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function j_e(e){return typeof e=="function"}og(j_e,"isFunction");function LQ(e){return e?"checked":"unchecked"}og(LQ,"getState");var Tlt=Object.defineProperty,Alt=(e,t)=>Tlt(e,"name",{value:t,configurable:!0}),_lt="Toggle",jlt=p.forwardRef(Alt(function(t,n){const{pressed:i,defaultPressed:r,onPressedChange:s,...o}=t,[l,c]=Ju({prop:i,onChange:s,defaultProp:r??!1,caller:_lt});return a.jsx(Mr.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...o,ref:n,onClick:An(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),Nlt=Object.defineProperty,ag=(e,t)=>Nlt(e,"name",{value:t,configurable:!0}),qw="ToggleGroup",[N_e,wan]=hc(qw,[Vw]),R_e=Vw(),Rlt=p.forwardRef(ag(function(t,n){const{type:i,...r}=t;if(i==="single"){const s=r;return a.jsx(Ilt,{role:"radiogroup",...s,ref:n})}if(i==="multiple"){const s=r;return a.jsx(Plt,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${qw}\``)},"ToggleGroup")),[I_e,P_e]=N_e(qw),Ilt=p.forwardRef(ag(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ag(()=>{},"onValueChange"),...o}=t,[l,c]=Ju({prop:i,defaultProp:r??"",onChange:s,caller:qw});return a.jsx(I_e,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:a.jsx(D_e,{...o,ref:n})})},"ToggleGroupImplSingle")),Plt=p.forwardRef(ag(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ag(()=>{},"onValueChange"),...o}=t,[l,c]=Ju({prop:i,defaultProp:r??[],onChange:s,caller:qw}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return a.jsx(I_e,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:a.jsx(D_e,{...o,ref:n})})},"ToggleGroupImplMultiple")),[Dlt,Mlt]=N_e(qw),D_e=p.forwardRef(ag(function(t,n){const{__scopeToggleGroup:i,disabled:r=!1,rovingFocus:s=!0,orientation:o,dir:l,loop:c=!0,...u}=t,d=R_e(i),f=xC(l),h={dir:f,...u};return a.jsx(Dlt,{scope:i,rovingFocus:s,disabled:r,children:s?a.jsx(kQ,{asChild:!0,...d,orientation:o,dir:f,loop:c,children:a.jsx(Mr.div,{...h,ref:n})}):a.jsx(Mr.div,{...h,ref:n})})},"ToggleGroupImpl")),vF="ToggleGroupItem",Llt=p.forwardRef(ag(function(t,n){const i=P_e(vF,t.__scopeToggleGroup),r=Mlt(vF,t.__scopeToggleGroup),s=R_e(t.__scopeToggleGroup),o=i.value.includes(t.value),l=r.disabled||t.disabled,c={...t,pressed:o,disabled:l},u=p.useRef(null);return r.rovingFocus?a.jsx(SQ,{asChild:!0,...s,focusable:!l,active:o,ref:u,children:a.jsx(sZ,{...c,ref:n})}):a.jsx(sZ,{...c,ref:n})},"ToggleGroupItem")),sZ=p.forwardRef(ag(function(t,n){const{__scopeToggleGroup:i,value:r,...s}=t,o=P_e(vF,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=o.type==="single"?l:void 0;return a.jsx(jlt,{...c,...s,ref:n,onPressedChange:u=>{u?o.onItemActivate(r):o.onItemDeactivate(r)}})},"ToggleGroupItemImpl")),$lt=Object.defineProperty,ga=(e,t)=>$lt(e,"name",{value:t,configurable:!0}),[$Q,Oan]=hc("Tooltip",[zw]),FQ=zw(),Flt="TooltipProvider",Blt=700,xF="tooltip.open",[Ult,BQ]=$Q(Flt),Qlt=ga(e=>{const{__scopeTooltip:t,delayDuration:n=Blt,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=e,o=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(Ult,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),o.current=!1)},[i]),onClose:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,i))},[i]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})},"TooltipProvider"),wF="Tooltip",[zlt,kC]=$Q(wF),Vlt=ga(e=>{const{__scopeTooltip:t,children:n,open:i,defaultOpen:r,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=BQ(wF,e.__scopeTooltip),u=FQ(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=sg(),b=p.useRef(0),v=o??c.disableHoverableContent,y=l??c.delayDuration,x=p.useRef(!1),[w,O]=Ju({prop:i,defaultProp:r??!1,onChange:ga(_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(xF))):c.onClose(),s==null||s(_)},"onChange"),caller:wF}),S=p.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),k=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,x.current=!1,O(!0)},[O]),C=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,O(!1)},[O]),E=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{x.current=!0,O(!0),b.current=0},y)},[y,O]);p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]);const R=h??g;return a.jsx(aP,{...u,children:a.jsx(zlt,{scope:t,contentId:R,setContentId:m,open:w,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?E():k()},[c.isOpenDelayedRef,E,k]),onTriggerLeave:p.useCallback(()=>{v?C():(window.clearTimeout(b.current),b.current=0)},[C,v]),onOpen:k,onClose:C,disableHoverableContent:v,children:n})})},"Tooltip"),oZ="TooltipTrigger",Hlt=p.forwardRef(ga(function(t,n){const{__scopeTooltip:i,...r}=t,s=kC(oZ,i),o=BQ(oZ,i),l=FQ(i),c=p.useRef(null),u=pr(n,c,s.onTriggerChange),d=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(vQ,{asChild:!0,...l,children:a.jsx(Mr.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:u,onPointerMove:An(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:An(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:An(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:An(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:An(t.onBlur,s.onClose),onClick:An(t.onClick,s.onClose)})})},"TooltipTrigger")),M_e="TooltipPortal",[qlt,Wlt]=$Q(M_e,{forceMount:void 0}),Klt=ga(e=>{const{__scopeTooltip:t,forceMount:n,children:i,container:r}=e,s=kC(M_e,t);return a.jsx(qlt,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"TooltipPortal"),qS="TooltipContent",Glt=p.forwardRef(ga(function(t,n){const i=Wlt(qS,t.__scopeTooltip),{forceMount:r=i.forceMount,side:s="top",...o}=t,l=kC(qS,t.__scopeTooltip);return a.jsx(Qf,{present:r||l.open,children:l.disableHoverableContent?a.jsx(L_e,{side:s,...o,ref:n}):a.jsx(Xlt,{side:s,...o,ref:n})})},"TooltipContent")),Xlt=p.forwardRef(ga(function(t,n){const i=kC(qS,t.__scopeTooltip),r=BQ(qS,t.__scopeTooltip),s=p.useRef(null),o=pr(n,s),[l,c]=p.useState(null),{trigger:u,onClose:d}=i,f=s.current,{onPointerInTransitChange:h}=r,m=p.useCallback(()=>{c(null),h(!1)},[h]),g=p.useCallback((b,v)=>{const y=b.currentTarget,x={x:b.clientX,y:b.clientY},w=$_e(x,y.getBoundingClientRect()),O=F_e(x,w),S=B_e(v.getBoundingClientRect()),k=Q_e([...O,...S]);c(k),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=ga(y=>g(y,f),"handleTriggerLeave"),v=ga(y=>g(y,u),"handleContentLeave");return u.addEventListener("pointerleave",b),f.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",v)}}},[u,f,g,m]),p.useEffect(()=>{if(l){const b=ga(v=>{const y=v.target,x={x:v.clientX,y:v.clientY},w=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),O=!U_e(x,l);w?m():O&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),a.jsx(L_e,{...t,ref:o})},"TooltipContentHoverable")),Ylt=GAe("TooltipContent"),L_e=p.forwardRef(ga(function(t,n){const{__scopeTooltip:i,children:r,"aria-label":s,id:o,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=kC(qS,i),f=FQ(i),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(xF,h),()=>document.removeEventListener(xF,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=ga(b=>{b.target instanceof Node&&b.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]);const{setContentId:m}=d;return zu(()=>(m(o),()=>{m(void 0)}),[o,m]),a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:a.jsxs(xQ,{"data-state":d.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:d.contentId,...f,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(Ylt,{children:r}),s?a.jsx(Srt,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function $_e(e,t){const n=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,i,r,s)){case s:return"left";case r:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}ga($_e,"getExitSideFromRect");function F_e(e,t,n=5){const i=[];switch(t){case"top":i.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":i.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":i.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":i.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return i}ga(F_e,"getPaddedExitPoints");function B_e(e){const{top:t,right:n,bottom:i,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:i},{x:r,y:i}]}ga(B_e,"getPointsFromRect");function U_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}ga(U_e,"isPointInPolygon");function Q_e(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),z_e(t)}ga(Q_e,"getHull");function z_e(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let i=e.length-1;i>=0;i--){const r=e[i];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ga(z_e,"getHullPresorted");var Zlt=Qlt,Jlt=Vlt,V_e=Hlt,ect=Klt,tct=Glt;function lg(e){const t=p.useRef(e);return t.current=e,t}let Yx=[],NA=!1;const aZ=e=>{var t,n;if(e.key==="Escape"){const[i]=Yx;i&&(e.preventDefault(),(n=(t=i.callback).current)==null||n.call(t))}},H_e=()=>{Yx.length>0&&!NA?(document.body.addEventListener("keydown",aZ),NA=!0):Yx.length===0&&NA&&(document.body.removeEventListener("keydown",aZ),NA=!1)},nct=e=>{Yx.unshift(e),H_e()},ict=({id:e})=>{Yx=Yx.filter(t=>t.id!==e),H_e()},SC=(e,t)=>{const n=p.useId(),i=lg(t);p.useEffect(()=>{if(!e)return;const r={id:n,callback:i};return nct(r),()=>ict(r)},[n,e,i])},rct=p.createContext(null);function q_e(){const e=p.useContext(rct);return(e==null?void 0:e.linkComponent)??"a"}function EC(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const sct=()=>zAe,lZ=(e,t=!1,n="TransitionGroup")=>{const i=[];return p.Children.forEach(e,r=>{if(r&&typeof r=="object"&&"key"in r&&r.key)i.push(r);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),i},$0=()=>{},F0=e=>{const t=p.useRef(e);return t.current=e,p.useCallback(n=>t.current(n),[])};function oct(e,t,n,i){const r=e.reduce((c,u)=>({...c,[u.key]:1}),{}),s=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),o=e.filter(c=>!s[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!r[c.component.key]}));return i==="append"?l.concat(o):o.concat(l)}function act(e,t,n){if((zAe||srt)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const lct="_TransitionGroupChild_1hv1z_1",cct={TransitionGroupChild:lct},W_e={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},uct=e=>({...W_e,enter:!e}),dct=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return W_e}},fct=({ref:e,as:t,children:n,className:i,transitionId:r,style:s,preventMountTransition:o,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:m,onExit:g,onExitActive:b,onExitComplete:v})=>{const[y,x]=p.useReducer(dct,uct(o||!1)),w=p.useRef(!1),O=p.useRef(null),S=p.useRef(c);S.current=c;const k=p.useRef(u);k.current=u;const C=p.useRef(null),E=p.useCallback(R=>{const _=O.current;if(!(!_||R===C.current))switch(C.current=R,R){case"enter":f(_);break;case"enter-active":h(_);break;case"enter-complete":m(_);break;case"exit":g(_);break;case"exit-active":b(_);break;case"exit-complete":v(_);break}},[f,h,m,g,b,v]);return pi.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),E("exit");const T=xN(()=>{x({type:"exit-active"}),E("exit-active"),j=window.setTimeout(()=>{E("exit-complete"),d()},k.current)});return()=>{T(),j!==void 0&&clearTimeout(j)}}if(o&&!w.current){w.current=!0;return}let R;x({type:"enter-before"}),E("enter");const _=xN(()=>{x({type:"enter-active"}),E("enter-active"),R=window.setTimeout(()=>{x({type:"done"}),E("enter-complete")},S.current)});return()=>{_(),R!==void 0&&clearTimeout(R)}},[l,o,d,E]),p.useEffect(()=>()=>{w.current=!1},[]),a.jsx(t,{ref:EC([O,e]),className:Ti(i,cct.TransitionGroupChild),"data-transition-id":r,style:s,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},hct=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[r,s]=p.useState(i==null);return rQ(()=>s(!0),r?null:i),r?a.jsx(fct,{...e}):null},Ww=e=>{const{ref:t,as:n="span",children:i,className:r,transitionId:s,style:o,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=sct()}=e,m=F0(e.onEnter??$0),g=F0(e.onEnterActive??$0),b=F0(e.onEnterComplete??$0),v=F0(e.onExit??$0),y=F0(e.onExitActive??$0),x=F0(e.onExitComplete??$0);p.Children.forEach(i,k=>{if(k&&!k.key)throw new Error("Child elements of must include a `key`")});const w=p.useCallback(k=>({component:k,shouldRender:!0,removeChild:()=>{S(C=>C.filter(E=>k.key!==E.component.key))},onEnter:m,onEnterActive:g,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[m,g,b,v,y,x]),[O,S]=p.useState(()=>lZ(i).map(k=>({...w(k),preventMountTransition:u})));return p.useLayoutEffect(()=>{S(k=>{const C=lZ(i);return oct(C,k,w,f)})},[i,f,w]),act("TransitionGroup",t,p.Children.count(i)),h?a.jsx(a.Fragment,{children:p.Children.map(i,k=>a.jsx(n,{ref:t,className:r,style:o,"data-transition-id":s,children:k}))}):a.jsx(a.Fragment,{children:O.map(({component:k,...C})=>a.jsx(hct,{...C,as:n,className:r,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:o,ref:t,children:k},k.key))})},pct="_Button_1864l_1",mct="_ButtonInner_1864l_4",gct="_ButtonLoader_1864l_749",s5={Button:pct,ButtonInner:mct,ButtonLoader:gct},Dt=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:r=!0,uniform:s=!1,size:o="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:m,className:g,onClick:b,disabled:v,disabledTone:y,inert:x=u,...w}=e,O=v||x,S=p.useCallback(k=>{v||b==null||b(k)},[b,v]);return a.jsxs("button",{type:t,className:Ti(s5.Button,g),"data-color":n,"data-variant":i,"data-pill":r?"":void 0,"data-uniform":s?"":void 0,"data-size":o,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:sQ,disabled:O,"aria-disabled":O,tabIndex:O?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:S,...w,children:[a.jsx(Ww,{className:s5.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&a.jsx(yC,{},"loader")}),a.jsx("span",{className:s5.ButtonInner,children:iQ(m)})]})},bct=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function yct(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function vct(e,t=document.body){if(typeof e=="string")return cZ(e,t);try{return bct()?(await navigator.clipboard.write([yct(e)]),!0):e["text/plain"]?cZ(e["text/plain"],t):!1}catch{return!1}}async function cZ(e,t=document.body){if(navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",t.appendChild(n),n.focus(),n.select();let i=!1;try{i=document.execCommand("copy")}catch{}return t.removeChild(n),i}const xct="_TransitionItem_1o7b1_1",wct={TransitionItem:xct},Oct=e=>{const{as:t="span",className:n,children:i,preventInitialTransition:r,insertMethod:s,transitionClassName:o,transitionPosition:l="absolute"}=e,{enterTotalDuration:c,exitTotalDuration:u,variables:d}=Tct(e);return a.jsx(t,{className:Ti("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:a.jsx(Ww,{as:t,className:Ti(wct.TransitionItem,o),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:r,children:i})})},kct=400,Sct=500,Ect=200,Cct=300;function Tct({initial:e,enter:t,exit:n,forceCompositeLayer:i}){const r=KL(e),s=KL(t),o=KL(n),l=[r,o,s].some(b=>b!=="none"),c=(t==null?void 0:t.duration)??(l?Sct:kct),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?Cct:Ect),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=zy({"tg-will-change":i?"transform, opacity":"auto","tg-enter-opacity":WL((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":GL(t),"tg-enter-duration":kA(c),"tg-enter-delay":kA((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":WL((n==null?void 0:n.opacity)??0),"tg-exit-transform":o,"tg-exit-filter":GL(n),"tg-exit-duration":kA(d),"tg-exit-delay":kA((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":WL((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":r==="none"?o:r,"tg-initial-filter":GL(e??n??{})}),m=((t==null?void 0:t.delay)??0)+c,g=((n==null?void 0:n.delay)??0)+d;return{enterTotalDuration:m,exitTotalDuration:g,variables:h}}const UQ=({children:e,copyValue:t,onClick:n,...i})=>{const[r,s]=p.useState(!1),o=p.useRef(null),l=c=>{r||(s(!0),n==null||n(c),vct(typeof t=="function"?t():t),o.current=window.setTimeout(()=>{s(!1)},1300))};return p.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),a.jsxs(Dt,{...i,onClick:l,children:[a.jsx(Oct,{className:"w-[var(--button-icon-size)] h-[var(--button-icon-size)]",initial:{scale:.6},enter:{scale:1,delay:150,duration:300},exit:{scale:.6,duration:150},forceCompositeLayer:!0,children:r?a.jsx(Gx,{},"copied-icon"):a.jsx(YU,{},"copy-icon")}),typeof e=="function"?e({copied:r}):e]})},Act="_Menu_1t4b0_1",_ct="_MenuList_1t4b0_3",jct="_MenuItemContent_1t4b0_53",Nct="_MenuItem_1t4b0_53",Rct="_ItemActions_1t4b0_98",Ict="_PressableInner_1t4b0_117",Pct="_Separator_1t4b0_135",Dct="_SubMenuItem_1t4b0_139",Mct="_SubTriggerIcon_1t4b0_141",Lct="_RadioItem_1t4b0_151",$ct="_RadioIndicatorActive_1t4b0_158",Fct="_RadioIndicator_1t4b0_158",Bct="_CheckboxItem_1t4b0_249",Uct="_CheckboxIndicator_1t4b0_256",Qct="_CheckboxCircle_1t4b0_269",ps={Menu:Act,MenuList:_ct,MenuItemContent:jct,MenuItem:Nct,ItemActions:Rct,PressableInner:Ict,Separator:Pct,SubMenuItem:Dct,SubTriggerIcon:Mct,RadioItem:Lct,RadioIndicatorActive:$ct,RadioIndicator:Fct,CheckboxItem:Bct,CheckboxIndicator:Uct,CheckboxCircle:Qct},K_e=p.createContext(null),CC=()=>{const e=p.useContext(K_e);if(!e)throw new Error("Menu components must be wrapped in ");return e},Pr=({children:e,forceOpen:t,onOpen:n,onClose:i,modal:r=!1})=>{const[s,o]=p.useState(!1),l=t??s,c=lg(n),u=lg(i),d=p.useCallback(h=>{var m,g;o(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);SC(s,()=>{d(!1)});const f=p.useMemo(()=>({open:l,setOpen:d}),[l,d]);return a.jsx(K_e.Provider,{value:f,children:a.jsx(_at,{open:l,onOpenChange:d,modal:r,children:e})})},zct=({className:e,children:t,disabled:n,onSelect:i,onClick:r})=>{const{open:s}=CC(),o=l=>{s||l.preventDefault()};return i?a.jsx(p_e,{className:Ti(ps.MenuItem,e),onSelect:i,onClick:r,disabled:n,onPointerMove:o,onPointerLeave:o,children:a.jsx("div",{className:ps.PressableInner,children:t})}):a.jsx("div",{className:Ti(ps.MenuItemContent,e),children:t})},Vct=({className:e,children:t})=>a.jsx("div",{className:Ti(ps.ItemActions,e),children:t}),Hct=({children:e,onClick:t})=>{const{setOpen:n}=CC();return a.jsx(Dt,{className:"rounded-sm",color:"secondary",size:"xs",uniform:!0,iconSize:"sm",variant:"ghost",onClick:i=>{i.stopPropagation(),n(!1),t(i)},children:e})},qct=e=>{const{className:t,children:n,href:i,to:r,disabled:s,as:o,...l}=e,{open:c}=CC(),u=i||r,d=u?/^https?:\/\//.test(u):!0,f=q_e(),h=o||(d?"a":f),m=b=>{c||b.preventDefault()},g=d?{target:"_blank",rel:"noopener noreferrer",href:i??r}:{href:i,to:r};return a.jsx(p_e,{asChild:!0,className:Ti(ps.MenuItem,t),disabled:s,onPointerMove:d?void 0:m,onPointerLeave:d?void 0:m,children:a.jsx(h,{...g,...l,children:a.jsx("span",{className:ps.PressableInner,children:n})})})},Wct=({className:e})=>a.jsx(Dat,{className:Ti(ps.Separator,e),role:"separator"}),Kct=({children:e,side:t,sideOffset:n=5,align:i,alignOffset:r,width:s,minWidth:o,maxHeight:l})=>{const{open:c}=CC();return a.jsx(h_e,{forceMount:!0,children:a.jsx(Ww,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:c&&a.jsx(Nat,{forceMount:!0,className:ps.MenuList,side:t,sideOffset:n,align:i,alignOffset:r??(i==="center"?0:-5),avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Kh,style:zy({"menu-width":s,"menu-min-width":o,"menu-max-height":l}),children:e},"dropdown")})})},Gct=({children:e,disabled:t})=>a.jsx(jat,{asChild:!0,disabled:t,children:e}),G_e=p.createContext(null),X_e=()=>{const e=p.useContext(G_e);if(!e)throw new Error("Submenu components must be wrapped in ");return e},Xct=({children:e,forceOpen:t,onOpen:n,onClose:i})=>{const[r,s]=p.useState(!1),o=p.useRef(null),l=t??r,c=lg(n),u=lg(i),d=p.useCallback(h=>{var m,g;s(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);SC(r,()=>{var h;d(!1),(h=o.current)==null||h.focus()});const f=p.useMemo(()=>({open:l,setOpen:d,triggerRef:o}),[l,d]);return a.jsx(G_e.Provider,{value:f,children:a.jsx(Mat,{open:l,onOpenChange:d,children:e})})},Yct=({className:e,children:t,disabled:n})=>{const{open:i}=CC(),{triggerRef:r}=X_e(),s=o=>{i||o.preventDefault()};return a.jsx(Lat,{ref:r,className:Ti(ps.MenuItem,ps.SubMenuItem,e),disabled:n,onPointerMove:s,onPointerLeave:s,children:a.jsxs("div",{className:ps.PressableInner,children:[t,a.jsx(bnt,{width:"16",height:"16",className:ps.SubTriggerIcon})]})})},Zct=({children:e,sideOffset:t=4,alignOffset:n=-6,width:i="auto",minWidth:r="auto",maxHeight:s})=>{const{open:o}=X_e();return a.jsx(h_e,{forceMount:!0,children:a.jsx(Ww,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:o&&a.jsx($at,{className:ps.MenuList,sideOffset:t,alignOffset:n,avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Kh,style:zy({"menu-width":i,"menu-min-width":r,"menu-max-height":s}),children:e},"submenu")})})},Jct=({children:e,value:t,onChange:n,indicatorPosition:i="end",...r})=>a.jsx(Iat,{...r,value:t,onValueChange:s=>n(s),"data-indicator-position":i,children:e}),eut=({className:e,children:t,...n})=>a.jsx(Pat,{className:Ti(ps.MenuItem,ps.RadioItem,e),...n,children:a.jsxs("div",{className:ps.PressableInner,children:[a.jsx("div",{className:ps.RadioIndicator,children:a.jsx(m_e,{className:ps.RadioIndicatorActive})}),t]})}),tut=({className:e,children:t,indicatorPosition:n="end",indicatorVariant:i="solid",...r})=>a.jsx(Rat,{className:Ti(ps.MenuItem,ps.CheckboxItem,e),...r,"data-indicator-position":n,"data-indicator-variant":i,children:a.jsxs("div",{className:ps.PressableInner,children:[a.jsx("div",{className:ps.CheckboxIndicator,children:a.jsx(m_e,{children:i==="ghost"?a.jsx(Gx,{className:"size-4"}):a.jsx("div",{className:ps.CheckboxCircle,children:a.jsx(Gx,{className:"size-4"})})})}),t]})});Pr.Content=Kct;Pr.Item=zct;Pr.ItemActions=Vct;Pr.ItemAction=Hct;Pr.Link=qct;Pr.Separator=Wct;Pr.Trigger=Gct;Pr.Sub=Xct;Pr.SubTrigger=Yct;Pr.SubContent=Zct;Pr.CheckboxItem=tut;Pr.RadioGroup=Jct;Pr.RadioItem=eut;const nut="_Tooltip_16g2y_1",iut="_TriggerDecorator_16g2y_73",Y_e={Tooltip:nut,TriggerDecorator:iut},uo=e=>{const{ref:t,children:n,content:i,forceOpen:r=i===null?!1:void 0,maxWidth:s=300,openDelay:o=150,interactive:l=!1,compact:c=!1,preventUnintentionalClickToClose:u,align:d,alignOffset:f=0,side:h,sideOffset:m=5,gutterSize:g="md",contentClassName:b,onPointerDown:v,onClick:y,...x}=e,[w,O]=p.useState(!1),[S,k]=p.useState(!1);rQ(()=>k(!1),S?400:null);const C=r??w,E=_=>{typeof r!="boolean"&&(O(_),u&&k(_))},R=_=>{u&&S&&(_.preventDefault(),_.stopPropagation())};return a.jsxs(Z_e,{open:C,delayDuration:o,onOpenChange:E,disableHoverableContent:!l,children:[a.jsx(V_e,{asChild:!0,children:a.jsx(WAe,{...x,ref:t,onPointerDown:_=>{R(_),v==null||v(_)},onClick:_=>{R(_),y==null||y(_)},children:n})}),a.jsx(J_e,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:i})]})},Z_e=({children:e,open:t,onOpenChange:n,...i})=>(SC(t,()=>{n(!1)}),a.jsx(Zlt,{children:a.jsx(Jlt,{open:t,onOpenChange:n,...i,children:e})})),J_e=({children:e,maxWidth:t=300,compact:n=!1,clickable:i=void 0,alignOffset:r=0,sideOffset:s=5,gutterSize:o="md",className:l,style:c,...u})=>a.jsx(ect,{children:a.jsx(tct,{...u,className:Ti(Y_e.Tooltip,l),"data-compact":n,"data-clickable":i,"data-gutter-size":o,alignOffset:r,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Kh,children:e})}),rut=({children:e,asChild:t=!0,...n})=>a.jsx(V_e,{asChild:t,...n,children:e}),sut=e=>{const{children:t,className:n,focusable:i=!0,ref:r,...s}=e,o=typeof t=="string";return a.jsx(WAe,{ref:r,...s,className:Ti(Y_e.TriggerDecorator,n),tabIndex:i?0:void 0,children:o?a.jsx("span",{children:t}):t})};uo.Root=Z_e;uo.Content=J_e;uo.Trigger=rut;uo.TriggerDecorator=sut;const out=50,uZ=48;function aut(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(o=>typeof o.text=="string"?o.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function lut(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return z("search.untitledSession")}function cut(e,t,n){const i=Math.max(0,t-uZ),r=Math.min(e.length,t+n+uZ);return(i>0?"…":"")+e.slice(i,r).trim()+(r{var c;if((c=l.events)!=null&&c.length)return l;try{return await NI(t,e,l.id)}catch{return l}})),o=[];for(const l of s)for(const{text:c,role:u,ts:d}of aut(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){o.push({type:"session",appId:t,sessionId:l.id,title:lut(l),snippet:cut(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return o.sort((l,c)=>(c.ts??0)-(l.ts??0)),o.slice(0,out)}async function dut(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await xEe(e,t.trim())}catch(o){const l=String(o);return{results:[],note:l.includes("404")?z("search.webUnavailable"):z("search.webFailed",{message:l})}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((o,l)=>({type:"web",index:l,title:o.title,url:o.url,siteName:o.siteName,summary:o.summary}))}:{results:[],note:z("search.webNotMounted")}}async function fut(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await vEe(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:z(e==="knowledge"?"search.knowledgeNotMounted":"search.memoryNotMounted")};if(r.error)return{results:[],note:r.error};const s=r.sourceName??z(e==="knowledge"?"search.knowledge":"search.longTermMemory");return{results:r.results.map((o,l)=>e==="knowledge"?{type:"knowledge",index:l,content:o.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:l,content:o.content,sourceName:s,sourceType:r.sourceType,author:o.author,ts:o.timestamp})}}async function hut(e,t,n){return e==="session"?{results:await uut(n.userId,n.appId,t)}:e==="web"?dut(n.appId,t):fut(e,n.appId,n.userId,t)}function eje({mirrored:e=!1}){return a.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[a.jsx("path",{className:"sidebar-panel-glyph__divider",d:"M5.938 6.833c.11 0 .249.102.249.292v6.042c0 .19-.14.291-.249.291s-.248-.101-.248-.291V7.125c0-.19.139-.292.248-.292Z",strokeWidth:"1.167"}),a.jsx("path",{className:"sidebar-panel-glyph__frame",d:"M14.5 3.75h-9a3 3 0 0 0-3 3v6.857a3 3 0 0 0 3 3h9a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3Z",strokeWidth:"1.667",strokeLinecap:"round",strokeLinejoin:"round"})]})}function put(e){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:a.jsx(eje,{})})}function mut(e){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:a.jsx(eje,{mirrored:!0})})}function gut(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 8.333c.368 0 .667.299.667.667v2h2a.667.667 0 0 1 0 1.333h-2v2a.667.667 0 0 1-1.334 0v-2h-2a.667.667 0 0 1 0-1.333h2V9c0-.368.299-.667.667-.667ZM7.667 1c3.49 0 6.383 2.554 6.913 5.896a.667.667 0 0 1-1.317.208 5.667 5.667 0 1 0-9.708 4.424.67.67 0 0 1 .07.12.667.667 0 0 1-.13.834l-.95.853 4.788-.002a.667.667 0 0 1 0 1.334l-5.657.002c-.917 0-1.35-1.131-.67-1.744l1.163-1.045A6.97 6.97 0 0 1 .667 8c0-3.866 3.134-7 7-7Z",fill:"currentColor"})})}function but(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),a.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function yut(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 0.667c4.05 0 7.334 3.283 7.334 7.333 0 4.05-3.284 7.334-7.334 7.334S0.667 12.05 0.667 8 3.95 0.667 8 0.667Zm0 1.333a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM6.167 6c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.334 0v-2c0-.368.299-.667.667-.667Zm3.666 0c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.333 0v-2c0-.368.298-.667.666-.667Z",fill:"currentColor"})})}function tje(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M7.58 2.6a.667.667 0 0 0-.667-.667h-.666a.667.667 0 0 0-.667.667v10.667c0 .368.299.666.667.666h.666a.667.667 0 0 0 .667-.666V2.6Zm1.333 10.667A2 2 0 0 1 6.913 15.267h-.666a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.666a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"}),a.jsx("path",{d:"M11.88 5.045a.667.667 0 0 0-.801-.514l-.653.136a.667.667 0 0 0-.504.786l1.85 8.092c.081.358.44.589.8.514l.653-.137a.667.667 0 0 0 .504-.786L11.88 5.045Zm3.155 7.82a2 2 0 0 1-1.512 2.358l-.653.136a2 2 0 0 1-2.403-1.541L8.617 5.726a2 2 0 0 1 1.513-2.358l.652-.136a2 2 0 0 1 2.404 1.541l1.849 8.092Z",fill:"currentColor"}),a.jsx("path",{d:"M4.247 2.6a.667.667 0 0 0-.667-.667h-.667a.667.667 0 0 0-.666.667v10.667c0 .368.298.666.666.666h.667a.667.667 0 0 0 .667-.666V2.6ZM5.58 13.267a2 2 0 0 1-2 2h-.667a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.667a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"})]})}function nje(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M3.25 2.25h6l3.5 3.5v8H3.25v-11Z"}),a.jsx("path",{d:"M9.25 2.25v3.5h3.5M5.5 8.25h5M5.5 10.75h4"})]})}function vut({className:e="icon"}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),a.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function xut({open:e}){return a.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:a.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function wut({active:e=!1,onClick:t}){const{t:n}=Ae("workspaceTools");return a.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":n("search.nav"),"aria-current":e?"page":void 0,title:n("search.nav"),children:[a.jsx(but,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:n("search.nav")})]})}function Out(e,t,n,i){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),o=l=>r?n?i("search.checkingCapabilities"):i("search.notMounted",{label:l}):i("search.selectAgent");return[{id:"session",label:i("search.sources.session"),ready:r,unavailableLabel:i("search.selectAgent")},{id:"web",label:i("search.sources.web"),ready:r&&s.has("web"),description:i("search.webDescription"),unavailableLabel:o(" web_search")},{id:"knowledge",label:i("search.sources.knowledge"),ready:r&&s.has("knowledge"),unavailableLabel:o(i("search.sources.knowledge"))},{id:"memory",label:i("search.sources.memory"),ready:r&&s.has("memory"),unavailableLabel:o(i("search.sources.memory"))}]}function wN(e,t){return{context_search:"Context Search",local:t("search.backendLocal"),mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function dZ(e,t){return e?new Date(e*1e3).toLocaleString(t,{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function kut({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var L,U;const{t:o,i18n:l}=Ae("workspaceTools"),c=l.resolvedLanguage||l.language,[u,d]=p.useState("session"),[f,h]=p.useState(""),[m,g]=p.useState([]),[b,v]=p.useState(),[y,x]=p.useState(!1),[w,O]=p.useState(!1),[S,k]=p.useState(!1),C=p.useRef(0),E=p.useRef(null),R=Out(t,n,i,o),_=R.find(I=>I.id===u),j=u==="knowledge"?(L=n==null?void 0:n.components)==null?void 0:L.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):u==="memory"?(U=n==null?void 0:n.components)==null?void 0:U.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;p.useEffect(()=>{C.current+=1,d("session"),g([]),v(void 0),O(!1),x(!1),k(!1)},[t]),p.useEffect(()=>{if(!S)return;function I(H){var K;(K=E.current)!=null&&K.contains(H.target)||k(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[S]);async function T(I,H){var V;const K=I.trim();if(!K||!((V=R.find(X=>X.id===H))!=null&&V.ready))return;const F=++C.current;x(!0),O(!0);let W;try{W=await hut(H,K,{userId:e,appId:t})}catch(X){const ie=X instanceof Error?X.message:String(X);W={results:[],note:o("search.failed",{message:ie})}}F===C.current&&(g(W.results),v(W.note),x(!1))}function N(I){C.current+=1,h(I),g([]),v(void 0),O(!1),x(!1)}function A(I){C.current+=1,d(I),k(!1),g([]),v(void 0),O(!1),x(!1)}const P=!!(_!=null&&_.ready),D=t?u==="web"?o("search.placeholder.web"):u==="knowledge"?o("search.placeholder.knowledge",{name:(j==null?void 0:j.name)??o("search.placeholder.knowledgeFallback")}):u==="memory"?o("search.placeholder.memory",{name:(j==null?void 0:j.name)??o("search.placeholder.memoryFallback")}):o("search.placeholder.session"):o("search.placeholder.selectAgent"),M=j!=null&&j.backend?wN(j.backend,o):"";return a.jsxs("div",{className:"search",children:[a.jsxs("div",{className:"search-box",children:[a.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[a.jsxs("button",{className:"search-source-picker",type:"button","aria-label":o("search.sourceTypeAria",{label:(_==null?void 0:_.label)??o("search.notSelected")}),"aria-haspopup":"listbox","aria-expanded":S,onClick:()=>k(I=>!I),children:[a.jsx("span",{children:(_==null?void 0:_.label)??o("search.sourceType")}),M&&a.jsx("small",{children:M}),a.jsx(xut,{open:S})]}),S&&a.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":o("search.selectSource"),children:R.map(I=>{var F,W;const H=I.id==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(V=>V.source==="knowledgebase"||V.kind==="knowledgebase"):I.id==="memory"?(W=n==null?void 0:n.components)==null?void 0:W.find(V=>V.source==="long_term_memory"||V.kind==="memory"):void 0,K=H?[H.name,H.backend?wN(H.backend,o):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return a.jsxs("button",{type:"button",role:"option","aria-selected":u===I.id,disabled:!I.ready,onClick:()=>A(I.id),children:[a.jsx("span",{children:I.label}),K&&a.jsx("small",{children:K})]},I.id)})})]}),a.jsx("span",{className:"search-box-divider","aria-hidden":!0}),a.jsx("input",{className:"search-input",value:f,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),T(f,u))},placeholder:D,disabled:!P,autoFocus:!0}),a.jsx("button",{className:"search-go",onClick:()=>void T(f,u),disabled:!f.trim()||y,"aria-label":o("search.nav"),children:y?a.jsx(Ei,{className:"icon spin"}):a.jsx(vut,{className:"icon"})})]}),a.jsx("div",{className:"search-results",children:P?w?y?null:b?a.jsx("div",{className:"search-empty",children:b}):m.length===0&&w?a.jsx("div",{className:"search-empty",children:o("search.noResults",{query:f.trim()})}):m.map((I,H)=>a.jsx(Sut,{result:I,agentLabel:r,onOpen:s,locale:c},H)):a.jsx("div",{className:"search-empty",children:o(u==="web"?"search.instructions.web":u==="knowledge"?"search.instructions.knowledge":u==="memory"?"search.instructions.memory":"search.instructions.session")}):a.jsx("div",{className:"search-empty",children:t?i?o("search.loadingCapabilities"):(_==null?void 0:_.unavailableLabel)??o("search.sourceUnavailable"):o("search.noAgentHint")})})]})}function Sut({result:e,agentLabel:t,onOpen:n,locale:i}){const{t:r}=Ae("workspaceTools");switch(e.type){case"session":return a.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[a.jsx(AAe,{className:"search-result-icon"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:e.title}),a.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${dZ(e.ts,i)}`:""]})]}),a.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return a.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[a.jsx(tP,{className:"search-result-icon"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:e.title||e.url}),a.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&a.jsx(my,{className:"search-result-ext"})]})]}),e.summary&&a.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return a.jsxs("div",{className:"search-result search-result-static",children:[a.jsx(fZ,{source:"knowledge"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:r("search.knowledgeFragment",{index:e.index+1})}),a.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${wN(e.sourceType,r)}`:""]})]}),a.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return a.jsxs("div",{className:"search-result search-result-static",children:[a.jsx(fZ,{source:"memory"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:r("search.memoryFragment",{index:e.index+1})}),a.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${wN(e.sourceType,r)}`:"",e.ts?` · ${dZ(e.ts,i)}`:""]})]}),a.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function fZ({source:e,className:t="search-result-icon"}){return e==="knowledge"?a.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[a.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),a.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):a.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[a.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),a.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function Eut({filled:e=!1,...t}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[a.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),a.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Cut({filled:e=!1,...t}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[a.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),a.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function ije(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),a.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),a.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),a.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),a.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const pP="/assets/media/logo-DCsNZy-k.svg",QQ="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e";function Tut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M8.5 4.5H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-13a2 2 0 0 0-2-2h-2.5"}),a.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"4",rx:"1.5"}),a.jsx("path",{d:"m8 13 2.5 2.5L16 10"})]})}const hZ="(max-width: 860px)";function pZ({title:e}){const t=p.useRef(null),n=p.useRef(null),[i,r]=p.useState(0);p.useLayoutEffect(()=>{const l=t.current,c=n.current;if(!l||!c)return;const u=()=>{const f=Math.max(0,Math.ceil(c.scrollWidth-l.clientWidth));r(h=>h===f?h:f)};u();const d=new ResizeObserver(u);return d.observe(l),d.observe(c),()=>d.disconnect()},[e]);const s=Math.min(12,Math.max(4.8,3.6+i/36)),o={"--history-title-translate":`-${i}px`,"--history-title-duration":`${s.toFixed(2)}s`};return a.jsx("span",{ref:t,className:`history-title${i>0?" is-overflowing":""}`,style:o,children:a.jsx("span",{ref:n,className:"history-title-text",children:e})})}function Aut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),a.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),a.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),a.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function _ut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"12",cy:"12",r:"8.25"}),a.jsx("path",{d:"M3.75 12h16.5M12 3.75c2.1 2.2 3.2 4.95 3.2 8.25S14.1 18.05 12 20.25M12 3.75C9.9 5.95 8.8 8.7 8.8 12s1.1 6.05 3.2 8.25"})]})}function jut(e){let t=2166136261;for(const i of e)t^=i.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Nut={super_admin:"account.roles.super_admin",admin:"account.roles.admin",developer:"account.roles.developer",user:"account.roles.user"};function Rut({activePage:e,access:t,userInfo:n,onAgentKitCli:i,onDeveloperResources:r,onSystemInfo:s,onIssueFeedback:o,onLogout:l}){const{t:c,i18n:u}=Ae(["sidebar","common"]),[d,f]=p.useState("");if(!n)return null;const h=FXe(n)||c("sidebar:account.defaultUser"),m=typeof n.email=="string"?n.email.trim():"",g=jut(h),b=BXe(n),v=b===d?"":b,y=WE(u.resolvedLanguage??u.language)??qE;return a.jsx("div",{className:"sidebar-user",children:a.jsxs("div",{className:"sidebar-user-row",children:[a.jsxs(Pr,{modal:!0,children:[a.jsx(Pr.Trigger,{children:a.jsxs("button",{type:"button",className:"sidebar-user-btn",title:h,children:[a.jsx("span",{className:`account-avatar${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?a.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),a.jsx("span",{className:"sidebar-user-identity",children:a.jsx("span",{className:"sidebar-user-name",children:h})})]})}),a.jsxs(Pr.Content,{side:"top",align:"start",sideOffset:4,minWidth:216,children:[a.jsxs("div",{className:"account-menu-head",children:[a.jsx("span",{className:`account-avatar account-avatar--lg${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?a.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),a.jsxs("div",{className:"account-id",children:[a.jsxs("div",{className:"account-name-row",children:[a.jsx("div",{className:"account-name",children:h}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:c(`sidebar:${Nut[t.role]}`)})]}),m&&m!==h&&a.jsx("div",{className:"account-sub",children:m})]})]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:s,children:[a.jsx(Uf,{className:"icon","aria-hidden":"true"}),c("sidebar:account.systemInfo")]}),a.jsxs(Pr.Sub,{children:[a.jsx(Pr.SubTrigger,{className:"account-menu-action",children:a.jsxs("span",{className:"account-menu-action__label",children:[a.jsx(_ut,{className:"icon"}),c("sidebar:account.language")]})}),a.jsx(Pr.SubContent,{sideOffset:6,minWidth:136,children:a.jsx(Pr.RadioGroup,{value:y,onChange:x=>{ZQe(x)},indicatorPosition:"end",children:b9.map(x=>a.jsx(Pr.RadioItem,{value:x,children:c(`common:languageNames.${x}`)},x))})})]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:o,children:[a.jsx(ije,{className:"icon"}),c("sidebar:account.issueFeedback")]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:l,children:[a.jsx(lit,{className:"icon","aria-hidden":"true"}),c("sidebar:account.logout")]})]})]}),a.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":c("sidebar:account.shortcuts"),children:[a.jsx(uo,{compact:!0,content:c("sidebar:account.tryCli"),children:a.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:i,"aria-label":c("sidebar:account.tryCli"),children:a.jsx(Cnt,{className:"icon"})})}),a.jsx(uo,{compact:!0,content:c("sidebar:account.developerResources"),children:a.jsx("button",{type:"button",className:`sidebar-user-shortcut${e==="developer-resources"?" is-active":""}`,onClick:r,"aria-label":c("sidebar:account.developerResources"),"aria-current":e==="developer-resources"?"page":void 0,children:a.jsx(pnt,{className:"icon"})})})]})]})})}function Iut({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:o,streamingSids:l,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:m,onReviewCenter:g,onAddAgent:b,onMyAgents:v,onWorkspace:y,onApplications:x,onCronJobs:w,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onUserManagement:C,onIssueFeedback:E,onPickSession:R,onDeleteSession:_,userInfo:j,onLogout:T}){const{t:N}=Ae("sidebar"),A=V=>(s==null?void 0:s[V])!==!1,P=o.role==="admin"||o.role==="super_admin",D=o.capabilities.manageUsers&&!!C,[M,L]=p.useState(null),U=p.useRef(typeof window<"u"&&window.matchMedia(hZ).matches),[I,H]=p.useState(U.current),K=n.map(V=>({id:V.id,title:iP(V.events,N("history.newConversation")),createdAt:(V.lastUpdateTime??0)*1e3})).sort((V,X)=>X.createdAt-V.createdAt),F=()=>{U.current=!1,H(V=>!V),L(null)};p.useEffect(()=>{const V=window.matchMedia(hZ),X=ie=>{ie.matches?H(Q=>Q||(U.current=!0,!0)):U.current&&(U.current=!1,H(!1))};return V.addEventListener("change",X),()=>V.removeEventListener("change",X)},[]);const W=t==="byteplus"?QQ:pP;return a.jsxs("aside",{className:`sidebar ${I?"is-collapsed":""}`,children:[a.jsxs("div",{className:"sidebar-top",children:[a.jsxs("div",{className:"sidebar-brand-row",children:[a.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":N("navigation.home"),title:N("navigation.home"),children:[a.jsx("img",{className:"brand-logo",src:e.logoUrl||W,width:20,height:20,alt:"","aria-hidden":!0}),a.jsx("span",{className:"brand-title",children:e.title})]}),a.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:F,"aria-label":N(I?"navigation.expand":"navigation.collapse"),title:N(I?"navigation.expand":"navigation.collapse"),children:I?a.jsx(mut,{className:"icon"}):a.jsx(put,{className:"icon"})})]}),a.jsxs("nav",{className:"sidebar-nav","aria-label":N("navigation.label"),children:[A("newChat")&&a.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":N("navigation.newChat"),"aria-current":r==="new-chat"?"page":void 0,title:N("navigation.newChat"),children:[a.jsx(gut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.newChat")})]}),A("search")&&a.jsx(wut,{active:r==="search",onClick:f}),a.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:v,"aria-label":N("navigation.agents"),"aria-current":r==="agents"?"page":void 0,title:N("navigation.agents"),children:[a.jsx(yut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.agents")})]}),a.jsxs("button",{className:`new-chat new-chat--workspaces${r==="workspaces"?" is-active":""}`,onClick:y,"aria-label":N("navigation.workspaces"),"aria-current":r==="workspaces"?"page":void 0,title:N("navigation.workspaces"),children:[a.jsx(Qnt,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.workspaces")})]}),a.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:m,"aria-label":N("navigation.library"),"aria-current":r==="library"?"page":void 0,title:N("navigation.library"),children:[a.jsx(tje,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.library")})]}),a.jsxs("button",{className:`new-chat new-chat--cronjobs${r==="cronjobs"?" is-active":""}`,onClick:w,"aria-label":N("navigation.cronjobs"),"aria-current":r==="cronjobs"?"page":void 0,title:N("navigation.cronjobs"),children:[a.jsx(XU,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.cronjobs")})]}),a.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:x,"aria-label":N("navigation.automations"),"aria-current":r==="applications"?"page":void 0,title:N("navigation.automations"),children:[a.jsx(Aut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.automations")})]})]}),P||D?a.jsxs("nav",{className:"sidebar-nav sidebar-nav--administration","aria-label":N("navigation.administration"),children:[a.jsx("div",{className:"sidebar-nav-group-title","aria-hidden":"true",children:N("navigation.administration")}),P?a.jsxs("button",{type:"button",className:`new-chat new-chat--review-center${r==="review-center"?" is-active":""}`,onClick:g,"aria-label":N("navigation.reviewCenter"),"aria-current":r==="review-center"?"page":void 0,title:N("navigation.reviewCenter"),children:[a.jsx(Tut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.reviewCenter")})]}):null,D?a.jsxs("button",{type:"button",className:`new-chat${r==="users"?" is-active":""}`,onClick:C,"aria-label":N("navigation.users"),"aria-current":r==="users"?"page":void 0,title:N("navigation.users"),children:[a.jsx(Xit,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.users")})]}):null]}):null]}),A("history")&&a.jsxs("div",{className:"sidebar-history",children:[a.jsxs("div",{className:"history-head",children:[a.jsx("span",{children:N("history.title")}),A("newChat")&&a.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":N("history.create"),title:N("history.create"),children:a.jsx(Tl,{className:"icon"})})]}),a.jsx("div",{className:"history-list",children:u?a.jsxs(a.Fragment,{children:[u.loading&&u.threads.length===0?a.jsx("div",{className:"history-empty",role:"status",children:N("history.loading")}):null,u.error?a.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?a.jsx("div",{className:"history-empty",children:N("history.empty")}):null,u.threads.map(V=>{const X=V.id===u.currentThreadId,ie=V.name||V.preview||`Thread ${V.id.slice(0,8)}`,Q=V.id===u.busyThreadId;return a.jsxs("div",{className:`history-item ${X?"active":""}`,children:[a.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(V.id),"aria-current":X?"page":void 0,title:ie,disabled:Q,children:[a.jsx(pZ,{title:ie}),X?a.jsx("span",{className:"history-current-badge",children:N("history.current")}):null]}),a.jsx("button",{type:"button",className:"history-more","aria-label":N("history.manage",{title:ie}),title:N("history.more"),disabled:Q,onClick:()=>L(Z=>Z===V.id?null:V.id),children:a.jsx(DY,{className:"icon"})}),M===V.id?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),a.jsx("div",{className:"history-menu",children:a.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),u.onDelete(V)},children:[a.jsx(rg,{className:"icon"})," ",N("history.delete")]})})]}):null]},V.id)}),u.hasMore?a.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?N("history.loadingMore"):N("history.loadMore")}):null]}):a.jsxs(a.Fragment,{children:[K.length===0?a.jsx("div",{className:"history-empty",children:N("history.empty")}):null,K.map(V=>{const X=V.id===i,ie=(l==null?void 0:l.has(V.id))===!0,Q=!ie&&(c==null?void 0:c.has(V.id))===!0;return a.jsxs("div",{className:`history-item ${X?"active":""}`,children:[a.jsxs("button",{className:"history-item-btn",onClick:()=>R(V.id),"aria-current":X?"page":void 0,title:V.title,children:[a.jsx(pZ,{title:V.title}),Q&&a.jsxs("span",{className:"history-evaluating-status",title:N("history.evaluatingTitle"),children:[a.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),N("history.evaluating")]})]}),a.jsxs("div",{className:"history-action-slot",children:[ie?a.jsx(yC,{className:"history-streaming-indicator",size:12,role:"status","aria-label":N("history.generating")}):null,a.jsx("button",{type:"button",className:"history-more","aria-label":N("history.manage",{title:V.title}),title:N("history.more"),onClick:()=>L(Z=>Z===V.id?null:V.id),children:a.jsx(DY,{className:"icon"})})]}),M===V.id&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),a.jsx("div",{className:"history-menu",children:a.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),_(V.id)},children:[a.jsx(rg,{className:"icon"})," ",N("history.delete")]})})]})]},V.id)})]})})]}),a.jsx("div",{className:"sidebar-footer",children:a.jsx(Rut,{activePage:r,access:o,userInfo:j,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onIssueFeedback:E,onLogout:T})})]})}function Mo(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function mP(){for(var e=0,t=arguments.length,n={},i;e=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}L_.prototype=mP.prototype={constructor:L_,on:function(e,t){var n=this._,i=Dut(e+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s0)for(var n=new Array(r),i=0,r,s;i=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),gZ.hasOwnProperty(t)?{space:gZ[t],local:e}:e}function Lut(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===OF&&t.documentElement.namespaceURI===OF?t.createElement(e):t.createElementNS(n,e)}}function $ut(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rje(e){var t=gP(e);return(t.local?$ut:Lut)(t)}function Fut(){}function zQ(e){return e==null?Fut:function(){return this.querySelector(e)}}function But(e){typeof e!="function"&&(e=zQ(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r=w&&(w=x+1);!(S=v[w])&&++w=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function ddt(e){e||(e=fdt);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,r=new Array(i),s=0;st?1:e>=t?0:NaN}function hdt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pdt(){return Array.from(this)}function mdt(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Cdt:typeof t=="function"?Adt:Tdt)(e,t,n??"")):Zx(this.node(),e)}function Zx(e,t){return e.style.getPropertyValue(t)||cje(e).getComputedStyle(e,null).getPropertyValue(t)}function jdt(e){return function(){delete this[e]}}function Ndt(e,t){return function(){this[e]=t}}function Rdt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Idt(e,t){return arguments.length>1?this.each((t==null?jdt:typeof t=="function"?Rdt:Ndt)(e,t)):this.node()[e]}function uje(e){return e.trim().split(/^|\s+/)}function VQ(e){return e.classList||new dje(e)}function dje(e){this._node=e,this._names=uje(e.getAttribute("class")||"")}dje.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function fje(e,t){for(var n=VQ(e),i=-1,r=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function aft(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n()=>e;function kF(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:o,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}kF.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bft(e){return!e.ctrlKey&&!e.button}function yft(){return this.parentNode}function vft(e,t){return t??{x:e.x,y:e.y}}function xft(){return navigator.maxTouchPoints||"ontouchstart"in this}function yje(){var e=bft,t=yft,n=vft,i=xft,r={},s=mP("start","drag","end"),o=0,l,c,u,d,f=0;function h(O){O.on("mousedown.drag",m).filter(i).on("touchstart.drag",v).on("touchmove.drag",y,gft).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(O,S){if(!(d||!e.call(this,O,S))){var k=w(this,t.call(this,O,S),O,S,"mouse");k&&(zc(O.view).on("mousemove.drag",g,WS).on("mouseup.drag",b,WS),gje(O.view),o5(O),u=!1,l=O.clientX,c=O.clientY,k("start",O))}}function g(O){if(sx(O),!u){var S=O.clientX-l,k=O.clientY-c;u=S*S+k*k>f}r.mouse("drag",O)}function b(O){zc(O.view).on("mousemove.drag mouseup.drag",null),bje(O.view,u),sx(O),r.mouse("end",O)}function v(O,S){if(e.call(this,O,S)){var k=O.changedTouches,C=t.call(this,O,S),E=k.length,R,_;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?IA(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?IA(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Oft.exec(e))?new nc(t[1],t[2],t[3],1):(t=kft.exec(e))?new nc(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sft.exec(e))?IA(t[1],t[2],t[3],t[4]):(t=Eft.exec(e))?IA(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cft.exec(e))?kZ(t[1],t[2]/100,t[3]/100,1):(t=Tft.exec(e))?kZ(t[1],t[2]/100,t[3]/100,t[4]):bZ.hasOwnProperty(e)?xZ(bZ[e]):e==="transparent"?new nc(NaN,NaN,NaN,0):null}function xZ(e){return new nc(e>>16&255,e>>8&255,e&255,1)}function IA(e,t,n,i){return i<=0&&(e=t=n=NaN),new nc(e,t,n,i)}function jft(e){return e instanceof AC||(e=by(e)),e?(e=e.rgb(),new nc(e.r,e.g,e.b,e.opacity)):new nc}function SF(e,t,n,i){return arguments.length===1?jft(e):new nc(e,t,n,i??1)}function nc(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}HQ(nc,SF,vje(AC,{brighter(e){return e=e==null?kN:Math.pow(kN,e),new nc(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?KS:Math.pow(KS,e),new nc(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nc(Zb(this.r),Zb(this.g),Zb(this.b),SN(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wZ,formatHex:wZ,formatHex8:Nft,formatRgb:OZ,toString:OZ}));function wZ(){return`#${Rb(this.r)}${Rb(this.g)}${Rb(this.b)}`}function Nft(){return`#${Rb(this.r)}${Rb(this.g)}${Rb(this.b)}${Rb((isNaN(this.opacity)?1:this.opacity)*255)}`}function OZ(){const e=SN(this.opacity);return`${e===1?"rgb(":"rgba("}${Zb(this.r)}, ${Zb(this.g)}, ${Zb(this.b)}${e===1?")":`, ${e})`}`}function SN(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zb(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Rb(e){return e=Zb(e),(e<16?"0":"")+e.toString(16)}function kZ(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xd(e,t,n,i)}function xje(e){if(e instanceof xd)return new xd(e.h,e.s,e.l,e.opacity);if(e instanceof AC||(e=by(e)),!e)return new xd;if(e instanceof xd)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,l=s-r,c=(s+r)/2;return l?(t===s?o=(n-i)/l+(n0&&c<1?0:o,new xd(o,l,c,e.opacity)}function Rft(e,t,n,i){return arguments.length===1?xje(e):new xd(e,t,n,i??1)}function xd(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}HQ(xd,Rft,vje(AC,{brighter(e){return e=e==null?kN:Math.pow(kN,e),new xd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?KS:Math.pow(KS,e),new xd(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new nc(a5(e>=240?e-240:e+120,r,i),a5(e,r,i),a5(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new xd(SZ(this.h),PA(this.s),PA(this.l),SN(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=SN(this.opacity);return`${e===1?"hsl(":"hsla("}${SZ(this.h)}, ${PA(this.s)*100}%, ${PA(this.l)*100}%${e===1?")":`, ${e})`}`}}));function SZ(e){return e=(e||0)%360,e<0?e+360:e}function PA(e){return Math.max(0,Math.min(1,e||0))}function a5(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bP=e=>()=>e;function wje(e,t){return function(n){return e+n*t}}function Ift(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function kan(e,t){var n=t-e;return n?wje(e,n>180||n<-180?n-360*Math.round(n/360):n):bP(isNaN(e)?t:e)}function Pft(e){return(e=+e)==1?Oje:function(t,n){return n-t?Ift(t,n,e):bP(isNaN(t)?n:t)}}function Oje(e,t){var n=t-e;return n?wje(e,n):bP(isNaN(e)?t:e)}const EN=function e(t){var n=Pft(t);function i(r,s){var o=n((r=SF(r)).r,(s=SF(s)).r),l=n(r.g,s.g),c=n(r.b,s.b),u=Oje(r.opacity,s.opacity);return function(d){return r.r=o(d),r.g=l(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function Dft(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;rn&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(i=i[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,c.push({i:o,x:lf(i,r)})),n=l5.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:lf(u,d)})):d&&f.push(r(f)+"rotate("+d+i)}function l(u,d,f,h){u!==d?h.push({i:f.push(r(f)+"skewX(",null,i)-2,x:lf(u,d)}):d&&f.push(r(f)+"skewX("+d+i)}function c(u,d,f,h,m,g){if(u!==f||d!==h){var b=m.push(r(m)+"scale(",null,",",null,")");g.push({i:b-4,x:lf(u,f)},{i:b-2,x:lf(d,h)})}else(f!==1||h!==1)&&m.push(r(m)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(m){for(var g=-1,b=h.length,v;++g=0&&e._call.call(void 0,t),e=e._next;--Jx}function TZ(){yy=(TN=XS.now())+yP,Jx=HO=0;try{Xft()}finally{Jx=0,Zft(),yy=0}}function Yft(){var e=XS.now(),t=e-TN;t>Cje&&(yP-=t,TN=e)}function Zft(){for(var e,t=CN,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:CN=n);qO=e,TF(i)}function TF(e){if(!Jx){HO&&(HO=clearTimeout(HO));var t=e-yy;t>24?(e<1/0&&(HO=setTimeout(TZ,e-XS.now()-yP)),eO&&(eO=clearInterval(eO))):(eO||(TN=XS.now(),eO=setInterval(Yft,Cje)),Jx=1,Tje(TZ))}}function AZ(e,t,n){var i=new AN;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var Jft=mP("start","end","cancel","interrupt"),eht=[],_je=0,_Z=1,AF=2,F_=3,jZ=4,_F=5,B_=6;function vP(e,t,n,i,r,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;tht(e,n,{name:t,index:i,group:r,on:Jft,tween:eht,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:_je})}function WQ(e,t){var n=$d(e,t);if(n.state>_je)throw new Error("too late; already scheduled");return n}function zf(e,t){var n=$d(e,t);if(n.state>F_)throw new Error("too late; already running");return n}function $d(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tht(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=Aje(s,0,n.time);function s(u){n.state=_Z,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,m;if(n.state!==_Z)return c();for(d in i)if(m=i[d],m.name===n.name){if(m.state===F_)return AZ(o);m.state===jZ?(m.state=B_,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[d]):+dAF&&i.state<_F,i.state=B_,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[o]}s&&delete e.__transition}}function nht(e){return this.each(function(){U_(this,e)})}function iht(e,t){var n,i;return function(){var r=zf(this,e),s=r.tween;if(s!==n){i=n=s;for(var o=0,l=i.length;o=0&&(t=t.slice(0,n)),!t||t==="start"})}function Nht(e,t,n){var i,r,s=jht(t)?WQ:zf;return function(){var o=s(this,e),l=o.on;l!==i&&(r=(i=l).copy()).on(t,n),o.on=r}}function Rht(e,t){var n=this._id;return arguments.length<2?$d(this.node(),n).on.on(e):this.each(Nht(n,e,t))}function Iht(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Pht(){return this.on("end.remove",Iht(this._id))}function Dht(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zQ(e));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o()=>e;function opt(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function $h(e,t,n){this.k=e,this.x=t,this.y=n}$h.prototype={constructor:$h,scale:function(e){return e===1?this:new $h(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $h(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var xP=new $h(1,0,0);Ije.prototype=$h.prototype;function Ije(e){for(;!e.__zoom;)if(!(e=e.parentNode))return xP;return e.__zoom}function c5(e){e.stopImmediatePropagation()}function tO(e){e.preventDefault(),e.stopImmediatePropagation()}function apt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lpt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function NZ(){return this.__zoom||xP}function cpt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function upt(){return navigator.maxTouchPoints||"ontouchstart"in this}function dpt(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function Pje(){var e=apt,t=lpt,n=dpt,i=cpt,r=upt,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=$_,u=mP("start","zoom","end"),d,f,h,m=500,g=150,b=0,v=10;function y(A){A.property("__zoom",NZ).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",_).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(A,P,D,M){var L=A.selection?A.selection():A;L.property("__zoom",NZ),A!==L?S(A,P,D,M):L.interrupt().each(function(){k(this,arguments).event(M).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(A,P,D,M){y.scaleTo(A,function(){var L=this.__zoom.k,U=typeof P=="function"?P.apply(this,arguments):P;return L*U},D,M)},y.scaleTo=function(A,P,D,M){y.transform(A,function(){var L=t.apply(this,arguments),U=this.__zoom,I=D==null?O(L):typeof D=="function"?D.apply(this,arguments):D,H=U.invert(I),K=typeof P=="function"?P.apply(this,arguments):P;return n(w(x(U,K),I,H),L,o)},D,M)},y.translateBy=function(A,P,D,M){y.transform(A,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),o)},null,M)},y.translateTo=function(A,P,D,M,L){y.transform(A,function(){var U=t.apply(this,arguments),I=this.__zoom,H=M==null?O(U):typeof M=="function"?M.apply(this,arguments):M;return n(xP.translate(H[0],H[1]).scale(I.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof D=="function"?-D.apply(this,arguments):-D),U,o)},M,L)};function x(A,P){return P=Math.max(s[0],Math.min(s[1],P)),P===A.k?A:new $h(P,A.x,A.y)}function w(A,P,D){var M=P[0]-D[0]*A.k,L=P[1]-D[1]*A.k;return M===A.x&&L===A.y?A:new $h(A.k,M,L)}function O(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function S(A,P,D,M){A.on("start.zoom",function(){k(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(M).end()}).tween("zoom",function(){var L=this,U=arguments,I=k(L,U).event(M),H=t.apply(L,U),K=D==null?O(H):typeof D=="function"?D.apply(L,U):D,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),W=L.__zoom,V=typeof P=="function"?P.apply(L,U):P,X=c(W.invert(K).concat(F/W.k),V.invert(K).concat(F/V.k));return function(ie){if(ie===1)ie=V;else{var Q=X(ie),Z=F/Q[2];ie=new $h(Z,K[0]-Q[0]*Z,K[1]-Q[1]*Z)}I.zoom(null,ie)}})}function k(A,P,D){return!D&&A.__zooming||new C(A,P)}function C(A,P){this.that=A,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,P),this.taps=0}C.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,P){return this.mouse&&A!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var P=zc(this.that).datum();u.call(A,this.that,new opt(A,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),P)}};function E(A,...P){if(!e.apply(this,arguments))return;var D=k(this,P).event(A),M=this.__zoom,L=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=gd(A);if(D.wheel)(D.mouse[0][0]!==U[0]||D.mouse[0][1]!==U[1])&&(D.mouse[1]=M.invert(D.mouse[0]=U)),clearTimeout(D.wheel);else{if(M.k===L)return;D.mouse=[U,M.invert(U)],U_(this),D.start()}tO(A),D.wheel=setTimeout(I,g),D.zoom("mouse",n(w(x(M,L),D.mouse[0],D.mouse[1]),D.extent,o));function I(){D.wheel=null,D.end()}}function R(A,...P){if(h||!e.apply(this,arguments))return;var D=A.currentTarget,M=k(this,P,!0).event(A),L=zc(A.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",F,!0),U=gd(A,D),I=A.clientX,H=A.clientY;gje(A.view),c5(A),M.mouse=[U,this.__zoom.invert(U)],U_(this),M.start();function K(W){if(tO(W),!M.moved){var V=W.clientX-I,X=W.clientY-H;M.moved=V*V+X*X>b}M.event(W).zoom("mouse",n(w(M.that.__zoom,M.mouse[0]=gd(W,D),M.mouse[1]),M.extent,o))}function F(W){L.on("mousemove.zoom mouseup.zoom",null),bje(W.view,M.moved),tO(W),M.event(W).end()}}function _(A,...P){if(e.apply(this,arguments)){var D=this.__zoom,M=gd(A.changedTouches?A.changedTouches[0]:A,this),L=D.invert(M),U=D.k*(A.shiftKey?.5:2),I=n(w(x(D,U),M,L),t.apply(this,P),o);tO(A),l>0?zc(this).transition().duration(l).call(S,I,M,A):zc(this).call(y.transform,I,M,A)}}function j(A,...P){if(e.apply(this,arguments)){var D=A.touches,M=D.length,L=k(this,P,A.changedTouches.length===M).event(A),U,I,H,K;for(c5(A),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},YS=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Dje=["Enter"," ","Escape"],Mje={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ew;(function(e){e.Strict="strict",e.Loose="loose"})(ew||(ew={}));var Jb;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Jb||(Jb={}));var ZS;(function(e){e.Partial="partial",e.Full="full"})(ZS||(ZS={}));const Lje={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var mm;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(mm||(mm={}));var JS;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(JS||(JS={}));var pn;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(pn||(pn={}));const RZ={[pn.Left]:pn.Right,[pn.Right]:pn.Left,[pn.Top]:pn.Bottom,[pn.Bottom]:pn.Top};function $je(e){return e===null?null:e?"valid":"invalid"}const Fje=e=>"id"in e&&"source"in e&&"target"in e,fpt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),GQ=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_C=(e,t=[0,0])=>{const{width:n,height:i}=Cp(e),r=e.origin??t,s=n*r[0],o=i*r[1];return{x:e.position.x-s,y:e.position.y-o}},hpt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,r)=>{const s=typeof r=="string";let o=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(r):GQ(r)?r:t.nodeLookup.get(r.id));const l=o?_N(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return wP(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return OP(n)},jC=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=wP(n,_N(r)),i=!0)}),i?OP(n):{x:0,y:0,width:0,height:0}},XQ=(e,t,[n,i,r]=[0,0,1],s=!1,o=!1)=>{const l={...Kw(t,[n,i,r]),width:t.width/r,height:t.height/r},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(o&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=eE(l,nw(u)),v=(m??0)*(g??0),y=s&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},ppt=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function mpt(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!i||i.has(r.id))&&n.set(r.id,r)}),n}async function gpt({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},o){if(e.size===0)return!0;const l=mpt(e,o),c=jC(l),u=ZQ(c,t,n,(o==null?void 0:o.minZoom)??r,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await i.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function Bje({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=o.origin??i;let f=o.extent||r;if(o.extent==="parent"&&!o.expandParent)if(!l)s==null||s("005",Rd.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&xy(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=xy(f)?vy(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",Rd.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function bpt({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&o.find(b=>b.id===h.parentId);(m||g)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=ppt(o,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!r)return{edges:d,nodes:o};const f=await r({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const tw=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),vy=(e={x:0,y:0},t,n)=>({x:tw(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:tw(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Uje(e,t,n){const{width:i,height:r}=Cp(n),{x:s,y:o}=n.internals.positionAbsolute;return vy(e,[[s,o],[s+i,o+r]],t)}const IZ=(e,t,n)=>en?-tw(Math.abs(e-n),1,t)/t:0,YQ=(e,t,n=15,i=40)=>{const r=IZ(e.x,i,t.width-i)*n,s=IZ(e.y,i,t.height-i)*n;return[r,s]},wP=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),jF=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),OP=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),nw=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=GQ(e)?e.internals.positionAbsolute:_C(e,t);return{x:n,y:i,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},_N=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=GQ(e)?e.internals.positionAbsolute:_C(e,t);return{x:n,y:i,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:i+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Qje=(e,t)=>OP(wP(jF(e),jF(t))),eE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},PZ=e=>Od(e.width)&&Od(e.height)&&Od(e.x)&&Od(e.y),Od=e=>!isNaN(e)&&isFinite(e),zje=(e,t)=>(n,i)=>{},NC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kw=({x:e,y:t},[n,i,r],s=!1,o=[1,1])=>{const l={x:(e-n)/r,y:(t-i)/r};return s?NC(l,o):l},iw=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function B0(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ypt(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=B0(e,n),r=B0(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=B0(e.top??e.y??0,n),r=B0(e.bottom??e.y??0,n),s=B0(e.left??e.x??0,t),o=B0(e.right??e.x??0,t);return{top:i,right:o,bottom:r,left:s,x:s+o,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vpt(e,t,n,i,r,s){const{x:o,y:l}=iw(e,[t,n,i]),{x:c,y:u}=iw({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const ZQ=(e,t,n,i,r,s)=>{const o=ypt(s,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=tw(u,i,r),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*d,g=n/2-h*d,b=vpt(e,m,g,d,t,n),v={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:d}},tE=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function xy(e){return e!=null&&e!=="parent"}function Cp(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function JQ(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Vje(e,t={width:0,height:0},n,i,r){const s={...e},o=i.get(n);if(o){const l=o.origin||r;s.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function DZ(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xpt(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function wpt(e){return{...Mje,...e||{}}}function Fk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:o}=kd(e),l=Kw({x:s-((r==null?void 0:r.left)??0),y:o-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?NC(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const ez=e=>({width:e.offsetWidth,height:e.offsetHeight}),Hje=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Opt=["INPUT","SELECT","TEXTAREA"];function qje(e){var i,r;const t=((r=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Opt.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Wje=e=>"clientX"in e,kd=(e,t)=>{var s,o;const n=Wje(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},MZ=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:r,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...ez(o)}})};function Kje({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:o,targetControlY:l}){const c=e*.125+r*.375+o*.375+n*.125,u=t*.125+s*.375+l*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function LA(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function LZ({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case pn.Left:return[t-LA(t-i,s),n];case pn.Right:return[t+LA(i-t,s),n];case pn.Top:return[t,n-LA(n-r,s)];case pn.Bottom:return[t,n+LA(r-n,s)]}}function Gje({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top,curvature:o=.25}){const[l,c]=LZ({pos:n,x1:e,y1:t,x2:i,y2:r,c:o}),[u,d]=LZ({pos:s,x1:i,y1:r,x2:e,y2:t,c:o}),[f,h,m,g]=Kje({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${i},${r}`,f,h,m,g]}function Xje({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n0}const Ept=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,Cpt=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Tpt=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Rd.error006()),t;const i=n.getEdgeId||Ept;let r;return Fje(e)?r={...e}:r={...e,id:i(e)},Cpt(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Yje({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,o,l]=Xje({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,o,l]}const $Z={[pn.Left]:{x:-1,y:0},[pn.Right]:{x:1,y:0},[pn.Top]:{x:0,y:-1},[pn.Bottom]:{x:0,y:1}},Apt=({source:e,sourcePosition:t=pn.Bottom,target:n})=>t===pn.Left||t===pn.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function _pt({source:e,sourcePosition:t=pn.Bottom,target:n,targetPosition:i=pn.Top,center:r,offset:s,stepPosition:o}){const l=$Z[t],c=$Z[i],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=Apt({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",m=f[h];let g=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,w,O]=Xje({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=r.x??u.x+(d.x-u.x)*o,v=r.y??(u.y+d.y)/2):(b=r.x??(u.x+d.x)/2,v=r.y??u.y+(d.y-u.y)*o);const E=[{x:b,y:u.y},{x:b,y:d.y}],R=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===m?g=h==="x"?E:R:g=h==="x"?R:E}else{const E=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?R:E:g=l.y===m?E:R,t===i){const A=Math.abs(e[h]-n[h]);if(A<=s){const P=Math.min(s-1,s-A);l[h]===m?y[h]=(u[h]>e[h]?-1:1)*P:x[h]=(d[h]>n[h]?-1:1)*P}}if(t!==i){const A=h==="x"?"y":"x",P=l[h]===c[A],D=u[A]>d[A],M=u[A]=N?(b=(_.x+j.x)/2,v=g[0].y):(b=g[0].x,v=(_.y+j.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},k={x:d.x+x.x,y:d.y+x.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],b,v,w,O]}function jpt(e,t,n,i){const r=Math.min(FZ(e,t)/2,FZ(t,n)/2,i),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const u=e.xn.id===t):e[0])||null}function NF(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function Rpt(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((o,l)=>([l.markerStart||i,l.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=NF(c,t);s.has(u)||(o.push({id:u,color:c.color||n,...c}),s.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const Zje=1e3,Ipt=10,tz={nodeOrigin:[0,0],nodeExtent:YS,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ppt={...tz,checkEquality:!0};function nz(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function Dpt(e,t,n){const i=nz(tz,n);for(const r of e.values())if(r.parentId)rz(r,e,t,i);else{const s=_C(r,i.nodeOrigin),o=xy(r.extent)?r.extent:i.nodeExtent,l=vy(s,o,Cp(r));r.internals.positionAbsolute=l}}function Mpt(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&i.push(s)}return{source:n,target:i}}function iz(e){return e==="manual"}function RF(e,t,n,i={}){var d,f;const r=nz(Ppt,i),s={i:0},o=new Map(t),l=r!=null&&r.elevateNodesOnSelect&&!iz(r.zIndexMode)?Zje:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=o.get(h.id);if(r.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=_C(h,r.nodeOrigin),b=xy(h.extent)?h.extent:r.nodeExtent,v=vy(g,b,Cp(h));m={...r.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:v,handleBounds:Mpt(h,m),z:Jje(h,l,r.zIndexMode),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),h.parentId&&rz(m,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Lpt(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function rz(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=nz(tz,i),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Lpt(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Ipt),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!iz(c)?Zje:0,{x:h,y:m,z:g}=$pt(e,d,o,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||m!==b.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:m}:b,z:g}})}function Jje(e,t,n){const i=Od(e.zIndex)?e.zIndex:0;return iz(n)?i:i+(e.selected?t:0)}function $pt(e,t,n,i,r,s){const{x:o,y:l}=t.internals.positionAbsolute,c=Cp(e),u=_C(e,n),d=xy(e.extent)?vy(u,e.extent,c):u;let f=vy({x:o+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=Uje(f,c,t));const h=Jje(e,r,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function sz(e,t,n,i=[0,0]){var o;const r=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=s.get(l.parentId))==null?void 0:o.expandedRect)??nw(c),d=Qje(u,l.rect);s.set(l.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var w;const d=c.internals.positionAbsolute,f=Cp(c),h=c.origin??i,m=l.x0||g>0||y||x)&&(r.push({id:u,type:"position",position:{x:c.position.x-m+y,y:c.position.y-g+x}}),(w=n.get(u))==null||w.forEach(O=>{e.some(S=>S.id===O.id)||r.push({id:O.id,type:"position",position:{x:O.position.x+m,y:O.position.y+g}})})),(f.width0){const m=sz(h,t,n,r);u.push(...m)}return{changes:u,updatedInternals:c}}async function Bpt({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function zZ(e,t,n,i,r,s){let o=r;const l=i.get(o)||new Map;i.set(o,l.set(n,t)),o=`${r}-${e}`;const c=i.get(o)||new Map;if(i.set(o,c.set(n,t)),s){o=`${r}-${e}-${s}`;const u=i.get(o)||new Map;i.set(o,u.set(n,t))}}function eNe(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:o=null,targetHandle:l=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:o,targetHandle:l},u=`${r}-${o}--${s}-${l}`,d=`${s}-${l}--${r}-${o}`;zZ("source",c,d,e,r,o),zZ("target",c,u,e,s,l),t.set(i.id,i)}}function tNe(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:tNe(n,t):!1}function VZ(e,t,n){var r;let i=e;do{if((r=i==null?void 0:i.matches)!=null&&r.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function Upt(e,t,n,i){const r=new Map;for(const[s,o]of e)if((o.selected||o.id===i)&&(!o.parentId||!tNe(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(s);l&&r.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return r}function u5({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var o,l,c;const r=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&r.push({...f,position:d.position,dragging:i})}if(!e)return[r[0],r];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:i}:r[0],r]}function Qpt({dragItems:e,snapGrid:t,x:n,y:i}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:i-r.distance.y},o=NC(s,t);return{x:o.x-s.x,y:o.y-s.y}}function zpt({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,m=!1,g=!1,b=null;function v({noDragClassName:x,handleSelector:w,domNode:O,isSelectable:S,nodeId:k,nodeClickDistance:C=0}){h=zc(O);function E({x:T,y:N}){const{nodeLookup:A,nodeExtent:P,snapGrid:D,snapToGrid:M,nodeOrigin:L,onNodeDrag:U,onSelectionDrag:I,onError:H,updateNodePositions:K}=t();s={x:T,y:N};let F=!1;const W=l.size>1,V=W&&P?jF(jC(l)):null,X=W&&M?Qpt({dragItems:l,snapGrid:D,x:T,y:N}):null;for(const[ie,Q]of l){if(!A.has(ie))continue;let Z={x:T-Q.distance.x,y:N-Q.distance.y};M&&(Z=X?{x:Math.round(Z.x+X.x),y:Math.round(Z.y+X.y)}:NC(Z,D));let ce=null;if(W&&P&&!Q.extent&&V){const{positionAbsolute:G}=Q.internals,te=G.x-V.x+P[0][0],ye=G.x+Q.measured.width-V.x2+P[1][0],Ne=G.y-V.y+P[0][1],pe=G.y+Q.measured.height-V.y2+P[1][1];ce=[[te,Ne],[ye,pe]]}const{position:Ee,positionAbsolute:Y}=Bje({nodeId:ie,nextPosition:Z,nodeLookup:A,nodeExtent:ce||P,nodeOrigin:L,onError:H});F=F||Q.position.x!==Ee.x||Q.position.y!==Ee.y,Q.position=Ee,Q.internals.positionAbsolute=Y}if(g=g||F,!!F&&(K(l,!0),b&&(i||U||!k&&I))){const[ie,Q]=u5({nodeId:k,dragItems:l,nodeLookup:A});i==null||i(b,l,ie,Q),U==null||U(b,ie,Q),k||I==null||I(b,Q)}}async function R(){if(!d)return;const{transform:T,panBy:N,autoPanSpeed:A,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(o);return}const[D,M]=YQ(u,d,A);(D!==0||M!==0)&&(s.x=(s.x??0)-D/T[2],s.y=(s.y??0)-M/T[2],await N({x:D,y:M})&&E(s)),o=requestAnimationFrame(R)}function _(T){var W;const{nodeLookup:N,multiSelectionActive:A,nodesDraggable:P,transform:D,snapGrid:M,snapToGrid:L,selectNodesOnDrag:U,onNodeDragStart:I,onSelectionDragStart:H,unselectNodesAndEdges:K}=t();f=!0,(!U||!S)&&!A&&k&&((W=N.get(k))!=null&&W.selected||K()),S&&U&&k&&(e==null||e(k));const F=Fk(T.sourceEvent,{transform:D,snapGrid:M,snapToGrid:L,containerBounds:d});if(s=F,l=Upt(N,P,F,k),l.size>0&&(n||I||!k&&H)){const[V,X]=u5({nodeId:k,dragItems:l,nodeLookup:N});n==null||n(T.sourceEvent,l,V,X),I==null||I(T.sourceEvent,V,X),k||H==null||H(T.sourceEvent,X)}}const j=yje().clickDistance(C).on("start",T=>{const{domNode:N,nodeDragThreshold:A,transform:P,snapGrid:D,snapToGrid:M}=t();d=(N==null?void 0:N.getBoundingClientRect())||null,m=!1,g=!1,b=T.sourceEvent,A===0&&_(T),s=Fk(T.sourceEvent,{transform:P,snapGrid:D,snapToGrid:M,containerBounds:d}),u=kd(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:N,transform:A,snapGrid:P,snapToGrid:D,nodeDragThreshold:M,nodeLookup:L}=t(),U=Fk(T.sourceEvent,{transform:A,snapGrid:P,snapToGrid:D,containerBounds:d});if(b=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||k&&!L.has(k))&&(m=!0),!m){if(!c&&N&&f&&(c=!0,R()),!f){const I=kd(T.sourceEvent,d),H=I.x-u.x,K=I.y-u.y;Math.sqrt(H*H+K*K)>M&&_(T)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&f&&(u=kd(T.sourceEvent,d),E(U))}}).on("end",T=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:N,updateNodePositions:A,onNodeDragStop:P,onSelectionDragStop:D}=t();if(g&&(A(l,!1),g=!1),r||P||!k&&D){const[M,L]=u5({nodeId:k,dragItems:l,nodeLookup:N,dragging:!1});r==null||r(T.sourceEvent,l,M,L),P==null||P(T.sourceEvent,M,L),k||D==null||D(T.sourceEvent,L)}}}).filter(T=>{const N=T.target;return!T.button&&(!x||!VZ(N,`.${x}`,O))&&(!w||VZ(N,w,O))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function Vpt(e,t,n){const i=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())eE(r,nw(s))>0&&i.push(s);return i}const Hpt=250;function qpt(e,t,n,i){var l,c;let r=[],s=1/0;const o=Vpt(e,n,t+Hpt);for(const u of o){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:m}=wy(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(m-e.y,2));g>t||(g1){const u=i.type==="source"?"target":"source";return r.find(d=>d.type===u)??r[0]}return r[0]}function nNe(e,t,n,i,r,s=!1){var u,d,f;const o=i.get(e);if(!o)return null;const l=r==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...wy(o,c,c.position,!0)}:c}function iNe(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Wpt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rNe=()=>!0;function Kpt(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:y=rNe,onReconnectEnd:x,updateConnection:w,getTransform:O,getFromHandle:S,autoPanSpeed:k,dragThreshold:C=1,handleDomNode:E}){const R=Hje(e.target);let _=0,j;const{x:T,y:N}=kd(e),A=iNe(s,E),P=l==null?void 0:l.getBoundingClientRect();let D=!1;if(!P||!A)return;const M=nNe(r,A,i,c,t);if(!M)return;let L=kd(e,P),U=!1,I=null,H=!1,K=null;function F(){if(!d||!P)return;const[Ee,Y]=YQ(L,P,k);h({x:Ee,y:Y}),_=requestAnimationFrame(F)}const W={...M,nodeId:r,type:A,position:M.position},V=c.get(r);let ie={inProgress:!0,isValid:null,from:wy(V,W,pn.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:V,to:L,toHandle:null,toPosition:RZ[W.position],toNode:null,pointer:L};function Q(){D=!0,w(ie),g==null||g(e,{nodeId:r,handleId:i,handleType:A})}C===0&&Q();function Z(Ee){if(!D){const{x:pe,y:me}=kd(Ee),se=pe-T,Se=me-N;if(!(se*se+Se*Se>C*C))return;Q()}if(!S()||!W){ce(Ee);return}const Y=O();L=kd(Ee,P),j=qpt(Kw(L,Y,!1,[1,1]),n,c,W),U||(F(),U=!0);const G=sNe(Ee,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:o?"target":"source",isValidConnection:y,doc:R,lib:u,flowId:f,nodeLookup:c});K=G.handleDomNode,I=G.connection,H=Wpt(!!j,G.isValid);const te=c.get(r),ye=te?wy(te,W,pn.Left,!0):ie.from,Ne={...ie,from:ye,isValid:H,to:G.toHandle&&H?iw({x:G.toHandle.x,y:G.toHandle.y},Y):L,toHandle:G.toHandle,toPosition:H&&G.toHandle?G.toHandle.position:RZ[W.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:L};w(Ne),ie=Ne}function ce(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(D){(j||K)&&I&&H&&(b==null||b(I));const{inProgress:Y,...G}=ie,te={...G,toPosition:ie.toHandle?ie.toPosition:null};v==null||v(Ee,te),s&&(x==null||x(Ee,te))}m(),cancelAnimationFrame(_),U=!1,H=!1,I=null,K=null,R.removeEventListener("mousemove",Z),R.removeEventListener("mouseup",ce),R.removeEventListener("touchmove",Z),R.removeEventListener("touchend",ce)}}R.addEventListener("mousemove",Z),R.addEventListener("mouseup",ce),R.addEventListener("touchmove",Z),R.addEventListener("touchend",ce)}function sNe(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:o,lib:l,flowId:c,isValidConnection:u=rNe,nodeLookup:d}){const f=s==="target",h=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y:g}=kd(e),b=o.elementFromPoint(m,g),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=iNe(void 0,v),w=v.getAttribute("data-nodeid"),O=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),k=v.classList.contains("connectableend");if(!w||!x)return y;const C={source:f?w:i,sourceHandle:f?O:r,target:f?i:w,targetHandle:f?r:O};y.connection=C;const R=S&&k&&(n===ew.Strict?f&&x==="source"||!f&&x==="target":w!==i||O!==r);y.isValid=R&&u(C),y.toHandle=nNe(w,x,O,d,n,!0)}return y}const IF={onPointerDown:Kpt,isValid:sNe};function Gpt({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=zc(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:m=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const O=n(),S=w.sourceEvent.ctrlKey&&tE()?10:1,k=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*d,C=O[2]*Math.pow(2,k*S);t.scaleTo(C)};let b=[0,0];const v=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(b=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const O=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const S=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],k=[S[0]-b[0],S[1]-b[1]];b=S;const C=i()*Math.max(O[2],Math.log(O[2]))*(m?-1:1),E={x:O[0]-k[0]*C,y:O[1]-k[1]*C},R=[[0,0],[c,u]];t.setViewportConstrained({x:E.x,y:E.y,zoom:O[2]},R,l)},x=Pje().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?g:null);r.call(x,{})}function o(){r.on("zoom",null)}return{update:s,destroy:o,pointer:gd}}const kP=e=>({x:e.x,y:e.y,zoom:e.k}),d5=({x:e,y:t,zoom:n})=>xP.translate(e,t).scale(n),Rv=(e,t)=>e.target.closest(`.${t}`),oNe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xpt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,f5=(e,t=0,n=Xpt,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},aNe=e=>{const t=e.ctrlKey&&tE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ypt({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Rv(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const v=gd(d),y=aNe(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let m=r===Jb.Vertical?0:d.deltaX*h,g=r===Jb.Horizontal?0:d.deltaY*h;!tE()&&d.shiftKey&&r!==Jb.Vertical&&(m=d.deltaY*h,g=0),i.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=kP(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function Zpt({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",o=!t&&s&&!i.ctrlKey,l=Rv(i,e);if(i.ctrlKey&&s&&l&&i.preventDefault(),o||l)return null;i.preventDefault(),n.call(this,i,r)}}function Jpt({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,o,l;if((s=i.sourceEvent)!=null&&s.internal)return;const r=kP(i.transform);e.mouseButton=((o=i.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,r))}}function emt({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var o,l;e.usedRightMouseButton=!!(n&&oNe(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((l=s.sourceEvent)!=null&&l.internal)&&(r==null||r(s.sourceEvent,kP(s.transform)))}}function tmt({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&oNe(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=kP(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(o.sourceEvent,c)},n?150:0)}}}function nmt({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,m=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Rv(f,`${u}-flow__node`)||Rv(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||o||d&&!g||Rv(f,l)&&g||Rv(f,c)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!r&&!m&&g||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function imt({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Pje().scaleExtent([t,n]).translateExtent(i),h=zc(e).call(f);x({x:r.x,y:r.y,zoom:tw(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(aNe);async function b(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).transform(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:T,onPaneContextMenu:N,userSelectionActive:A,panOnScroll:P,panOnDrag:D,panOnScrollMode:M,panOnScrollSpeed:L,preventScrolling:U,zoomOnPinch:I,zoomOnScroll:H,zoomOnDoubleClick:K,zoomActivationKeyPressed:F,lib:W,onTransformChange:V,connectionInProgress:X,paneClickDistance:ie,selectionOnDrag:Q}){A&&!u.isZoomingOrPanning&&y();const Z=P&&!F&&!A;f.clickDistance(Q?1/0:!Od(ie)||ie<0?0:ie);const ce=Z?Ypt({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:L,zoomOnPinch:I,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:l}):Zpt({noWheelClassName:j,preventScrolling:U,d3ZoomHandler:m});h.on("wheel.zoom",ce,{passive:!1});const Ee=Jpt({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});f.on("start",Ee);const Y=emt({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!N,onPanZoom:s,onTransformChange:V});f.on("zoom",Y);const G=tmt({zoomPanValues:u,panOnDrag:D,panOnScroll:P,onPaneContextMenu:N,onPanZoomEnd:l,onDraggingChange:c});f.on("end",G);const te=nmt({zoomActivationKeyPressed:F,panOnDrag:D,zoomOnScroll:H,panOnScroll:P,zoomOnDoubleClick:K,zoomOnPinch:I,userSelectionActive:A,noPanClassName:T,noWheelClassName:j,lib:W,connectionInProgress:X});f.filter(te),K?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(j,T,N){const A=d5(j),P=f==null?void 0:f.constrain()(A,T,N);return P&&await b(P),P}async function w(j,T){const N=d5(j);return await b(N,T),N}function O(j){if(h){const T=d5(j),N=h.property("__zoom");(N.k!==j.zoom||N.x!==j.x||N.y!==j.y)&&(f==null||f.transform(h,T,null,{sync:!0}))}}function S(){const j=h?Ije(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function k(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).scaleTo(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}async function C(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).scaleBy(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}function E(j){f==null||f.scaleExtent(j)}function R(j){f==null||f.translateExtent(j)}function _(j){const T=!Od(j)||j<0?0:j;f==null||f.clickDistance(T)}return{update:v,destroy:y,setViewport:w,setViewportConstrained:x,getViewport:S,scaleTo:k,scaleBy:C,setScaleExtent:E,setTranslateExtent:R,syncViewport:O,setClickDistance:_}}var rw;(function(e){e.Line="line",e.Handle="handle"})(rw||(rw={}));function rmt({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const o=e-t,l=n-i,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&r&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function HZ(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:r}}function Wp(e,t){return Math.max(0,t-e)}function Kp(e,t){return Math.max(0,e-t)}function $A(e,t,n){return Math.max(0,t-e,e-n)}function qZ(e,t){return e?!t:t}function smt(e,t,n,i,r,s,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=i,{x:w,y:O,width:S,height:k,aspectRatio:C}=e;let E=Math.floor(d?m-e.pointerX:0),R=Math.floor(f?g-e.pointerY:0);const _=S+(c?-E:E),j=k+(u?-R:R),T=-s[0]*S,N=-s[1]*k;let A=$A(_,b,v),P=$A(j,y,x);if(o){let L=0,U=0;c&&E<0?L=Wp(w+E+T,o[0][0]):!c&&E>0&&(L=Kp(w+_+T,o[1][0])),u&&R<0?U=Wp(O+R+N,o[0][1]):!u&&R>0&&(U=Kp(O+j+N,o[1][1])),A=Math.max(A,L),P=Math.max(P,U)}if(l){let L=0,U=0;c&&E>0?L=Kp(w+E,l[0][0]):!c&&E<0&&(L=Wp(w+_,l[1][0])),u&&R>0?U=Kp(O+R,l[0][1]):!u&&R<0&&(U=Wp(O+j,l[1][1])),A=Math.max(A,L),P=Math.max(P,U)}if(r){if(d){const L=$A(_/C,y,x)*C;if(A=Math.max(A,L),o){let U=0;!c&&!u||c&&!u&&h?U=Kp(O+N+_/C,o[1][1])*C:U=Wp(O+N+(c?E:-E)/C,o[0][1])*C,A=Math.max(A,U)}if(l){let U=0;!c&&!u||c&&!u&&h?U=Wp(O+_/C,l[1][1])*C:U=Kp(O+(c?E:-E)/C,l[0][1])*C,A=Math.max(A,U)}}if(f){const L=$A(j*C,b,v)/C;if(P=Math.max(P,L),o){let U=0;!c&&!u||u&&!c&&h?U=Kp(w+j*C+T,o[1][0])/C:U=Wp(w+(u?R:-R)*C+T,o[0][0])/C,P=Math.max(P,U)}if(l){let U=0;!c&&!u||u&&!c&&h?U=Wp(w+j*C,l[1][0])/C:U=Kp(w+(u?R:-R)*C,l[0][0])/C,P=Math.max(P,U)}}}R=R+(R<0?P:-P),E=E+(E<0?A:-A),r&&(h?_>j*C?R=(qZ(c,u)?-E:E)/C:E=(qZ(c,u)?-R:R)*C:d?(R=E/C,u=c):(E=R*C,c=u));const D=c?w+E:w,M=u?O+R:O;return{width:S+(c?-E:E),height:k+(u?-R:R),x:s[0]*E*(c?-1:1)+D,y:s[1]*R*(u?-1:1)+M}}const lNe={width:0,height:0,x:0,y:0},omt={...lNe,pointerX:0,pointerY:0,aspectRatio:1};function amt(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,l=n[0]*s,c=n[1]*o;return[[i-l,r-c],[i+s-l,r+o-c]]}function lmt({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=zc(e);let o={controlDirection:HZ("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:v}){let y={...lNe},x={...omt};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:HZ(u)};let w,O=null,S=[],k,C,E,R=!1;const _=yje().on("start",j=>{const{nodeLookup:T,transform:N,snapGrid:A,snapToGrid:P,nodeOrigin:D,paneDomNode:M}=n();if(w=T.get(t),!w)return;O=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:U}=Fk(j.sourceEvent,{transform:N,snapGrid:A,snapToGrid:P,containerBounds:O});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},x={...y,pointerX:L,pointerY:U,aspectRatio:y.width/y.height},k=void 0,C=xy(w.extent)?w.extent:void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(k=T.get(w.parentId)),k&&w.extent==="parent"&&(C=[[0,0],[k.measured.width,k.measured.height]]),S=[],E=void 0;for(const[I,H]of T)if(H.parentId===t&&(S.push({id:I,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const K=amt(H,w,H.origin??D);E?E=[[Math.min(K[0][0],E[0][0]),Math.min(K[0][1],E[0][1])],[Math.max(K[1][0],E[1][0]),Math.max(K[1][1],E[1][1])]]:E=K}m==null||m(j,{...y})}).on("drag",j=>{const{transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P}=n(),D=Fk(j.sourceEvent,{transform:T,snapGrid:N,snapToGrid:A,containerBounds:O}),M=[];if(!w)return;const{x:L,y:U,width:I,height:H}=y,K={},F=w.origin??P,{width:W,height:V,x:X,y:ie}=smt(x,o.controlDirection,D,o.boundaries,o.keepAspectRatio,F,C,E),Q=W!==I,Z=V!==H,ce=X!==L&&Q,Ee=ie!==U&&Z;if(!ce&&!Ee&&!Q&&!Z)return;if((ce||Ee||F[0]===1||F[1]===1)&&(K.x=ce?X:y.x,K.y=Ee?ie:y.y,y.x=K.x,y.y=K.y,S.length>0)){const ye=X-L,Ne=ie-U;for(const pe of S)pe.position={x:pe.position.x-ye+F[0]*(W-I),y:pe.position.y-Ne+F[1]*(V-H)},M.push(pe)}if((Q||Z)&&(K.width=Q&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:y.width,K.height=Z&&(!o.resizeDirection||o.resizeDirection==="vertical")?V:y.height,y.width=K.width,y.height=K.height),k&&w.expandParent){const ye=F[0]*(K.width??0);K.x&&K.x{R&&(b==null||b(j,{...y}),r==null||r({...y}),R=!1)});s.call(_)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}const cmt={},WZ=e=>{let t;const n=new Set,i=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(cmt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(i,r,c);return c},umt=e=>e?WZ(e):WZ,{useDebugValue:dmt}=pi,{useSyncExternalStoreWithSelector:fmt}=RZe,hmt=e=>e;function cNe(e,t=hmt,n){const i=fmt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dmt(i),i}const KZ=(e,t)=>{const n=umt(e),i=(r,s=t)=>cNe(n,r,s);return Object.assign(i,n),i},pmt=(e,t)=>e?KZ(e,t):KZ;function As(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,r]of e)if(!Object.is(r,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const SP=p.createContext(null),mmt=SP.Provider,uNe=Rd.error001("react");function zi(e,t){const n=p.useContext(SP);if(n===null)throw new Error(uNe);return cNe(n,e,t)}function _s(){const e=p.useContext(SP);if(e===null)throw new Error(uNe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const GZ={display:"none"},gmt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dNe="react-flow__node-desc",fNe="react-flow__edge-desc",bmt="react-flow__aria-live",ymt=e=>e.ariaLiveMessage,vmt=e=>e.ariaLabelConfig;function xmt({rfId:e}){const t=zi(ymt);return a.jsx("div",{id:`${bmt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gmt,children:t})}function wmt({rfId:e,disableKeyboardA11y:t}){const n=zi(vmt);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${dNe}-${e}`,style:GZ,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${fNe}-${e}`,style:GZ,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(xmt,{rfId:e})]})}const EP=p.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const o=`${e}`.split("-");return a.jsx("div",{className:Mo(["react-flow__panel",n,...o]),style:i,ref:s,...r,children:t})});EP.displayName="Panel";function Omt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(EP,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:a.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const kmt=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},FA=e=>e.id;function Smt(e,t){return As(e.selectedNodes.map(FA),t.selectedNodes.map(FA))&&As(e.selectedEdges.map(FA),t.selectedEdges.map(FA))}function Emt({onSelectionChange:e}){const t=_s(),{selectedNodes:n,selectedEdges:i}=zi(kmt,Smt);return p.useEffect(()=>{const r={nodes:n,edges:i};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,i,e]),null}const Cmt=e=>!!e.onSelectionChangeHandlers;function Tmt({onSelectionChange:e}){const t=zi(Cmt);return e||t?a.jsx(Emt,{onSelectionChange:e}):null}const hNe=[0,0],Amt={x:0,y:0,zoom:1},_mt=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],XZ=[..._mt,"rfId"],jmt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),YZ={translateExtent:YS,nodeOrigin:hNe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Nmt(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=zi(jmt,As),u=_s();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=YZ,l()}),[]);const d=p.useRef(YZ);return p.useEffect(()=>{for(const f of XZ){const h=e[f],m=d.current[f];h!==m&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?r(h):f==="translateExtent"?s(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:wpt(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},XZ.map(f=>e[f])),null}function ZZ(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Rmt(e){var i;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const r=ZZ(),s=()=>n(r!=null&&r.matches?"dark":"light");return s(),r==null||r.addEventListener("change",s),()=>{r==null||r.removeEventListener("change",s)}},[e]),t!==null?t:(i=ZZ())!=null&&i.matches?"dark":"light"}const JZ=typeof document<"u"?document:null;function nE(e=null,t={target:JZ,actInsideInputWithModifier:!0}){const[n,i]=p.useState(!1),r=p.useRef(!1),s=p.useRef(new Set([])),[o,l]=p.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` +`)},Mst=0,M0=[];function Lst(e){var t=p.useRef([]),n=p.useRef([0,0]),i=p.useRef(),r=p.useState(Mst++)[0],s=p.useState(A2e)[0],o=p.useRef(e);p.useEffect(function(){o.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=rst([e.lockRef.current],(e.shards||[]).map(iZ),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var y=TA(b),x=n.current,w="deltaX"in b?b.deltaX:x[0]-y[0],O="deltaY"in b?b.deltaY:x[1]-y[1],S,k=b.target,C=Math.abs(w)>Math.abs(O)?"h":"v";if("touches"in b&&C==="h"&&k.type==="range")return!1;var E=window.getSelection(),R=E&&E.anchorNode,_=R?R===k||R.contains(k):!1;if(_)return!1;var j=tZ(C,k);if(!j)return!0;if(j?S=C:(S=C==="v"?"h":"v",j=tZ(C,k)),!j)return!1;if(!i.current&&"changedTouches"in b&&(w||O)&&(i.current=S),!S)return!0;var T=i.current||S;return Ist(T,v,b,T==="h"?w:O)},[]),c=p.useCallback(function(b){var v=b;if(!(!M0.length||M0[M0.length-1]!==s)){var y="deltaY"in v?nZ(v):TA(v),x=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Pst(S.delta,y)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(iZ).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=w.length>0?l(v,w[0]):!o.current.noIsolation;O&&v.cancelable&&v.preventDefault()}}},[]),u=p.useCallback(function(b,v,y,x){var w={name:b,delta:v,target:y,should:x,shadowParent:$st(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(O){return O!==w})},1)},[]),d=p.useCallback(function(b){n.current=TA(b),i.current=void 0},[]),f=p.useCallback(function(b){u(b.type,nZ(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,TA(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return M0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,D0),document.addEventListener("touchmove",c,D0),document.addEventListener("touchstart",d,D0),function(){M0=M0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,D0),document.removeEventListener("touchmove",c,D0),document.removeEventListener("touchstart",d,D0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:Dst(r)}):null,m?p.createElement(Cst,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $st(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Fst=hst(T2e,Lst);var mQ=p.forwardRef(function(e,t){return p.createElement(sP,df({},e,{ref:t,sideCar:Fst}))});mQ.classNames=sP.classNames;var Bst=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},L0=new WeakMap,AA=new WeakMap,_A={},n5=0,R2e=function(e){return e&&(e.host||R2e(e.parentNode))},Ust=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=R2e(n);return i&&e.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Qst=function(e,t,n,i){var r=Ust(t,Array.isArray(e)?e:[e]);_A[n]||(_A[n]=new WeakMap);var s=_A[n],o=[],l=new Set,c=new Set(r),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var m=h.getAttribute(i),g=m!==null&&m!=="false",b=(L0.get(h)||0)+1,v=(s.get(h)||0)+1;L0.set(h,b),s.set(h,v),o.push(h),b===1&&g&&AA.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(i,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),l.clear(),n5++,function(){o.forEach(function(f){var h=L0.get(f)-1,m=s.get(f)-1;L0.set(f,h),s.set(f,m),h||(AA.has(f)||f.removeAttribute(i),AA.delete(f)),m||f.removeAttribute(n)}),n5--,n5||(L0=new WeakMap,L0=new WeakMap,AA=new WeakMap,_A={})}},I2e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),r=Bst(e);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live], script"))),Qst(i,r,n,"aria-hidden")):function(){return null}},zst=Object.defineProperty,Vst=(e,t)=>zst(e,"name",{value:t,configurable:!0});function wC(e){const[t,n]=p.useState(void 0);return zu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}Vst(wC,"useSize");var Hst=Object.defineProperty,dp=(e,t)=>Hst(e,"name",{value:t,configurable:!0}),gQ="Checkbox",[qst,ban]=hc(gQ),[Wst,bQ]=qst(gQ);function P2e(e){const{__scopeCheckbox:t,checked:n,children:i,defaultChecked:r,disabled:s,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Ju({prop:n,defaultProp:r??!1,onChange:c,caller:gQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!o||!!g.closest("form"):!0,k={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:Gh(r)?!1:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return a.jsx(Wst,{scope:t,...k,children:D2e(f)?f(k):i})}dp(P2e,"CheckboxProvider");var Kst="CheckboxTrigger",Gst=p.forwardRef(dp(function({__scopeCheckbox:t,onKeyDown:n,onClick:i,...r},s){const{control:o,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=bQ(Kst,t),y=pr(s,f),x=p.useRef(u);return p.useEffect(()=>{const w=o==null?void 0:o.form;if(w){const O=dp(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[o,h]),a.jsx(Mr.button,{type:"button",role:"checkbox","aria-checked":Gh(u)?"mixed":u,"aria-required":d,"data-state":yQ(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onKeyDown:An(n,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:An(i,w=>{g(),h(O=>Gh(O)?!0:!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"CheckboxTrigger")),Xst=p.forwardRef(dp(function(t,n){const{__scopeCheckbox:i,name:r,checked:s,defaultChecked:o,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return a.jsx(P2e,{__scopeCheckbox:i,checked:s,defaultChecked:o,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Gst,{...h,ref:n,__scopeCheckbox:i}),m&&a.jsx(eot,{__scopeCheckbox:i})]})})},"Checkbox")),Yst="CheckboxIndicator",Zst=p.forwardRef(dp(function(t,n){const{__scopeCheckbox:i,forceMount:r,...s}=t,o=bQ(Yst,i);return a.jsx(Qf,{present:r||Gh(o.checked)||o.checked===!0,children:a.jsx(Mr.span,{"data-state":yQ(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),Jst="CheckboxBubbleInput",eot=p.forwardRef(dp(function({__scopeCheckbox:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=bQ(Jst,t),y=pr(r,v),x=wC(s),w=p.useRef(!1),O=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const C=b;if(!C)return;const E=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const N=!(j&&o.current);if(T&&_){w.current=!j;const A=new Event("click",{bubbles:N});C.indeterminate=Gh(c),_.call(C,Gh(c)?!1:c),C.dispatchEvent(A),w.current=!1}},[b,c,o,l]);const k=p.useRef(Gh(c)?!1:c);return a.jsx(Mr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??k.current,required:d,disabled:f,name:h,value:m,form:g,...i,tabIndex:-1,ref:y,onClick:An(n,C=>{w.current&&C.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function D2e(e){return typeof e=="function"}dp(D2e,"isFunction");function Gh(e){return e==="indeterminate"}dp(Gh,"isIndeterminate");function yQ(e){return Gh(e)?"indeterminate":e?"checked":"unchecked"}dp(yQ,"getState");var tot=Object.defineProperty,Um=(e,t)=>tot(e,"name",{value:t,configurable:!0}),M2e="Popper",[L2e,zw]=hc(M2e),[not,$2e]=L2e(M2e),iot=Um(e=>{const{__scopePopper:t,children:n}=e,[i,r]=p.useState(null),[s,o]=p.useState(void 0);return a.jsx(not,{scope:t,anchor:i,onAnchorChange:r,placementState:s,setPlacementState:o,children:n})},"Popper"),rot="PopperAnchor",sot=p.forwardRef(Um(function(t,n){const{__scopePopper:i,virtualRef:r,...s}=t,o=$2e(rot,i),l=p.useRef(null),c=o.onAnchorChange,u=p.useCallback(b=>{l.current=b,b&&c(b)},[c]),d=pr(n,u),f=p.useRef(null);p.useEffect(()=>{if(!r)return;const b=f.current;f.current=r.current,b!==f.current&&c(f.current)});const h=o.placementState&&oP(o.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return r?null:a.jsx(Mr.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),F2e="PopperContent",[oot,yan]=L2e(F2e),aot=p.forwardRef(Um(function(t,n){var Z,ce,Ee,Y,G,te,ye;const{__scopePopper:i,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...v}=t,y=$2e(F2e,i),[x,w]=p.useState(null),O=pr(n,w),[S,k]=p.useState(null),C=wC(S),E=(C==null?void 0:C.width)??0,R=(C==null?void 0:C.height)??0,_=r+(o!=="center"?"-"+o:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(d)?d:[d],N=T.length>0,A={padding:j,boundary:T.filter(B2e),altBoundary:N},{refs:P,floatingStyles:D,placement:M,isPositioned:L,middlewareData:U}=QTe({strategy:"fixed",placement:_,whileElementsMounted:Um((...Ne)=>Y6(...Ne,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[zTe({mainAxis:s+R,alignmentAxis:l}),u&&VTe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?HTe():void 0,...A}),u&&qTe({...A}),WTe({...A,apply:Um(({elements:Ne,rects:pe,availableWidth:me,availableHeight:se})=>{const{width:Se,height:Le}=pe.reference,be=Ne.floating.style;be.setProperty("--radix-popper-available-width",`${me}px`),be.setProperty("--radix-popper-available-height",`${se}px`),be.setProperty("--radix-popper-anchor-width",`${Se}px`),be.setProperty("--radix-popper-anchor-height",`${Le}px`)},"apply")}),S&&wtt({element:S,padding:c}),lot({arrowWidth:E,arrowHeight:R}),m&&xtt({strategy:"referenceHidden",...A,boundary:N?A.boundary:void 0})]}),I=y.setPlacementState;zu(()=>(I(M),()=>{I(void 0)}),[M,I]);const[H,K]=oP(M),F=Nd(b);zu(()=>{L&&(F==null||F())},[L,F]);const W=(Z=U.arrow)==null?void 0:Z.x,V=(ce=U.arrow)==null?void 0:ce.y,X=((Ee=U.arrow)==null?void 0:Ee.centerOffset)!==0,[ie,Q]=p.useState();return zu(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),a.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:L?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Y=U.transformOrigin)==null?void 0:Y.x,(G=U.transformOrigin)==null?void 0:G.y].join(" "),...((te=U.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(oot,{scope:i,placedSide:H,placedAlign:K,onArrowChange:k,arrowX:W,arrowY:V,shouldHideArrow:X,children:a.jsx(Mr.div,{"data-side":H,"data-align":K,...v,ref:O,style:{...v.style,animation:L?(ye=v.style)==null?void 0:ye.animation:"none"}})})})},"PopperContent"));function B2e(e){return e!==null}Um(B2e,"isNotNull");var lot=Um(e=>({name:"transformOrigin",options:e,fn(t){var v,y,x;const{placement:n,rects:i,middlewareData:r}=t,o=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=oP(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((y=r.arrow)==null?void 0:y.x)??0)+l/2,m=(((x=r.arrow)==null?void 0:x.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=o?f:`${h}px`,b=`${-c}px`):u==="top"?(g=o?f:`${h}px`,b=`${i.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=o?f:`${m}px`):u==="left"&&(g=`${i.floating.width+c}px`,b=o?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function oP(e){const[t,n="center"]=e.split("-");return[t,n]}Um(oP,"getSideAndAlignFromPlacement");var aP=iot,vQ=sot,xQ=aot,cot=Object.defineProperty,wQ=(e,t)=>cot(e,"name",{value:t,configurable:!0}),i5=!1;function U2e(){const[e,t]=p.useState(i5);return p.useEffect(()=>{i5||(i5=!0,t(!0))},[]),e}wQ(U2e,"useIsHydrated");var Q2e=Py[" useSyncExternalStore ".trim().toString()];function z2e(){return()=>{}}wQ(z2e,"subscribe");function V2e(){return Q2e(z2e,()=>!0,()=>!1)}wQ(V2e,"useIsHydratedModern");var uot=typeof Q2e=="function"?V2e:U2e,dot=Object.defineProperty,Vy=(e,t)=>dot(e,"name",{value:t,configurable:!0}),r5="rovingFocusGroup.onEntryFocus",fot={bubbles:!1,cancelable:!0},lP="RovingFocusGroup",[gF,H2e,hot]=lQ(lP),[pot,Vw]=hc(lP,[hot]),[mot,got]=pot(lP),bot=p.forwardRef(Vy(function(t,n){return a.jsx(gF.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(gF.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(yot,{...t,ref:n})})})},"RovingFocusGroup")),yot=p.forwardRef(Vy(function(t,n){const{__scopeRovingFocusGroup:i,orientation:r,loop:s=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=pr(n,m),b=xC(o),[v,y]=Ju({prop:l,defaultProp:c??null,onChange:u,caller:lP}),[x,w]=p.useState(!1),O=Nd(d),S=H2e(i),k=p.useRef(!1),[C,E]=p.useState(0);return p.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(r5,O),()=>R.removeEventListener(r5,O)},[O]),a.jsx(mot,{scope:i,orientation:r,dir:b,loop:s,currentTabStopId:v,onItemFocus:p.useCallback(R=>y(R),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(R=>R+1),[]),onFocusableItemRemove:p.useCallback(()=>E(R=>R-1),[]),children:a.jsx(Mr.div,{tabIndex:x||C===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:An(t.onMouseDown,()=>{k.current=!0}),onFocus:An(t.onFocus,R=>{const _=!k.current;if(R.target===R.currentTarget&&_&&!x){const j=new CustomEvent(r5,fot);if(R.currentTarget.dispatchEvent(j),!j.defaultPrevented){const T=S().filter(M=>M.focusable),N=T.find(M=>M.active),A=T.find(M=>M.id===v),D=[N,A,...T].filter(Boolean).map(M=>M.ref.current);OQ(D,f)}}k.current=!1}),onBlur:An(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),vot="RovingFocusGroupItem",xot=p.forwardRef(Vy(function(t,n){const{__scopeRovingFocusGroup:i,focusable:r=!0,active:s=!1,tabStopId:o,children:l,...c}=t,u=sg(),d=o||u,f=got(vot,i),h=f.currentTabStopId===d,m=H2e(i),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=f,y=uot();return zu(()=>{if(!(!y||!r))return g(),()=>b()},[y,r,g,b]),p.useEffect(()=>{if(!(y||!r))return g(),()=>b()},[y,r,g,b]),a.jsx(gF.ItemSlot,{scope:i,id:d,focusable:r,active:s,children:a.jsx(Mr.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:An(t.onMouseDown,x=>{r?f.onItemFocus(d):x.preventDefault()}),onFocus:An(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:An(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const w=W2e(x,f.orientation,f.dir);if(w!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=m().filter(k=>k.focusable).map(k=>k.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const k=S.indexOf(x.currentTarget);S=f.loop?K2e(S,k+1):S.slice(k+1)}setTimeout(()=>OQ(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),wot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function q2e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Vy(q2e,"getDirectionAwareKey");function W2e(e,t,n){const i=q2e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return wot[i]}Vy(W2e,"getFocusIntent");function OQ(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}Vy(OQ,"focusFirst");function K2e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}Vy(K2e,"wrapArray");var kQ=bot,SQ=xot,Oot=Object.defineProperty,nr=(e,t)=>Oot(e,"name",{value:t,configurable:!0}),bF=["Enter"," "],kot=["ArrowDown","PageUp","Home"],G2e=["ArrowUp","PageDown","End"],Sot=[...kot,...G2e],Eot={ltr:[...bF,"ArrowRight"],rtl:[...bF,"ArrowLeft"]},Cot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cP="Menu",[zS,Tot,Aot]=lQ(cP),[Hy,X2e]=hc(cP,[Aot,zw,Vw]),uP=zw(),Y2e=Vw(),[Z2e,_g]=Hy(cP),[_ot,OC]=Hy(cP),jot=nr(e=>{const{__scopeMenu:t,open:n=!1,children:i,dir:r,onOpenChange:s,modal:o=!0}=e,l=uP(t),[c,u]=p.useState(null),d=p.useRef(!1),f=Nd(s),h=xC(r);return p.useEffect(()=>{const m=nr(()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=nr(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),p.useEffect(()=>{if(!n)return;const m=nr(()=>f(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,f]),a.jsx(aP,{...l,children:a.jsx(Z2e,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(_ot,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:i})})})},"Menu"),J2e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t,s=uP(i);return a.jsx(vQ,{...s,...r,ref:n})},"MenuAnchor")),e_e="MenuPortal",[Not,t_e]=Hy(e_e,{forceMount:void 0}),Rot=nr(e=>{const{__scopeMenu:t,forceMount:n,children:i,container:r}=e,s=_g(e_e,t);return a.jsx(Not,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"MenuPortal"),Cd="MenuContent",[Iot,EQ]=Hy(Cd),Pot=p.forwardRef(nr(function(t,n){const i=t_e(Cd,t.__scopeMenu),{forceMount:r=i.forceMount,...s}=t,o=_g(Cd,t.__scopeMenu),l=OC(Cd,t.__scopeMenu);return a.jsx(zS.Provider,{scope:t.__scopeMenu,children:a.jsx(Qf,{present:r||o.open,children:a.jsx(zS.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Dot,{...s,ref:n}):a.jsx(Mot,{...s,ref:n})})})})},"MenuContent")),Dot=p.forwardRef(nr(function(t,n){const i=_g(Cd,t.__scopeMenu),r=p.useRef(null),s=pr(n,r);return p.useEffect(()=>{const o=r.current;if(o)return I2e(o)},[]),a.jsx(CQ,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:An(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentModal")),Mot=p.forwardRef(nr(function(t,n){const i=_g(Cd,t.__scopeMenu);return a.jsx(CQ,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentNonModal")),Lot=cp("MenuContent.ScrollLock"),CQ=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,y=_g(Cd,i),x=OC(Cd,i),w=uP(i),O=Y2e(i),S=Tot(i),[k,C]=p.useState(null),E=p.useRef(null),R=pr(n,E,y.onContentChange),_=p.useRef(0),j=p.useRef(""),T=p.useRef(0),N=p.useRef(null),A=p.useRef("right"),P=p.useRef(0),D=b?mQ:p.Fragment,M=b?{as:Lot,allowPinchZoom:!0}:void 0,L=nr(I=>{var Q,Z;const H=j.current+I,K=S().filter(ce=>!ce.disabled),F=document.activeElement,W=(Q=K.find(ce=>ce.ref.current===F))==null?void 0:Q.textValue,V=K.map(ce=>ce.textValue),X=c_e(V,H,W),ie=(Z=K.find(ce=>ce.textValue===X))==null?void 0:Z.ref.current;nr(function ce(Ee){j.current=Ee,window.clearTimeout(_.current),Ee!==""&&(_.current=window.setTimeout(()=>ce(""),1e3))},"updateSearch")(H),ie&&setTimeout(()=>ie.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(_.current),[]),rP();const U=p.useCallback(I=>{var K,F;return A.current===((K=N.current)==null?void 0:K.side)&&d_e(I,(F=N.current)==null?void 0:F.area)},[]);return a.jsx(Iot,{scope:i,searchRef:j,onItemEnter:p.useCallback(I=>{U(I)&&I.preventDefault()},[U]),onItemLeave:p.useCallback(I=>{var H;U(I)||((H=E.current)==null||H.focus(),C(null))},[U]),onTriggerLeave:p.useCallback(I=>{U(I)&&I.preventDefault()},[U]),pointerGraceTimerRef:T,onPointerGraceIntentChange:p.useCallback(I=>{N.current=I},[]),children:a.jsx(D,{...M,children:a.jsx(y2e,{asChild:!0,trapped:s,onMountAutoFocus:An(o,I=>{var H;I.preventDefault(),(H=E.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:a.jsx(kQ,{asChild:!0,...O,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:An(u,I=>{x.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(xQ,{role:"menu","aria-orientation":"vertical","data-state":AQ(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:R,style:{outline:"none",...v.style},onKeyDown:An(v.onKeyDown,I=>{const K=I.target.closest("[data-radix-menu-content]")===I.currentTarget,F=I.ctrlKey||I.altKey||I.metaKey,W=I.key.length===1;K&&(I.key==="Tab"&&I.preventDefault(),!F&&W&&L(I.key));const V=E.current;if(I.target!==V||!Sot.includes(I.key))return;I.preventDefault();const ie=S().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);G2e.includes(I.key)&&ie.reverse(),a_e(ie)}),onBlur:An(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(_.current),j.current="")}),onPointerMove:An(t.onPointerMove,Xx(I=>{const H=I.target,K=P.current!==I.clientX;if(I.currentTarget.contains(H)&&K){const F=I.clientX>P.current?"right":"left";A.current=F,P.current=I.clientX}}))})})})})})})},"MenuContentImpl")),$ot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return a.jsx(Mr.div,{role:"group",...r,ref:n})},"MenuGroup")),yF="MenuItem",rZ="menu.itemSelect",TQ=p.forwardRef(nr(function(t,n){const{disabled:i=!1,onSelect:r,...s}=t,o=p.useRef(null),l=OC(yF,t.__scopeMenu),c=EQ(yF,t.__scopeMenu),u=pr(n,o),d=p.useRef(!1),f=nr(()=>{const h=o.current;if(!i&&h){const m=new CustomEvent(rZ,{bubbles:!0,cancelable:!0});h.addEventListener(rZ,g=>r==null?void 0:r(g),{once:!0}),aQ(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return a.jsx(n_e,{...s,ref:u,disabled:i,onClick:An(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:An(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:An(t.onKeyDown,h=>{i||h.target!==h.currentTarget||c.searchRef.current!==""&&h.key===" "||bF.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),n_e=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,disabled:r=!1,textValue:s,...o}=t,l=EQ(yF,i),c=Y2e(i),u=p.useRef(null),d=pr(n,u),[f,h]=p.useState(!1),[m,g]=p.useState("");return p.useEffect(()=>{const b=u.current;b&&g((b.textContent??"").trim())},[o.children]),a.jsx(zS.ItemSlot,{scope:i,disabled:r,textValue:s??m,children:a.jsx(SQ,{asChild:!0,...c,focusable:!r,children:a.jsx(Mr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:An(t.onPointerMove,Xx(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(t.onPointerLeave,Xx(b=>l.onItemLeave(b))),onFocus:An(t.onFocus,()=>h(!0)),onBlur:An(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),Fot=p.forwardRef(nr(function(t,n){const{checked:i=!1,onCheckedChange:r,...s}=t;return a.jsx(r_e,{scope:t.__scopeMenu,checked:i,children:a.jsx(TQ,{role:"menuitemcheckbox","aria-checked":VS(i)?"mixed":i,...s,ref:n,"data-state":dP(i),onSelect:An(s.onSelect,()=>r==null?void 0:r(VS(i)?!0:!i),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Bot="MenuRadioGroup",[Uot,Qot]=Hy(Bot,{value:void 0,onValueChange:nr(()=>{},"onValueChange")}),zot=p.forwardRef(nr(function(t,n){const{value:i,onValueChange:r,...s}=t,o=Nd(r);return a.jsx(Uot,{scope:t.__scopeMenu,value:i,onValueChange:o,children:a.jsx($ot,{...s,ref:n})})},"MenuRadioGroup")),Vot="MenuRadioItem",Hot=p.forwardRef(nr(function(t,n){const{value:i,...r}=t,s=Qot(Vot,t.__scopeMenu),o=i===s.value;return a.jsx(r_e,{scope:t.__scopeMenu,checked:o,children:a.jsx(TQ,{role:"menuitemradio","aria-checked":o,...r,ref:n,"data-state":dP(o),onSelect:An(r.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,i)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),i_e="MenuItemIndicator",[r_e,qot]=Hy(i_e,{checked:!1}),Wot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,forceMount:r,...s}=t,o=qot(i_e,i);return a.jsx(Qf,{present:r||VS(o.checked)||o.checked===!0,children:a.jsx(Mr.span,{...s,ref:n,"data-state":dP(o.checked)})})},"MenuItemIndicator")),Kot=p.forwardRef(nr(function(t,n){const{__scopeMenu:i,...r}=t;return a.jsx(Mr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:n})},"MenuSeparator")),s_e="MenuSub",[Got,o_e]=Hy(s_e),Xot=nr(e=>{const{__scopeMenu:t,children:n,open:i=!1,onOpenChange:r}=e,s=_g(s_e,t),o=uP(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=Nd(r);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),a.jsx(aP,{...o,children:a.jsx(Z2e,{scope:t,open:i,onOpenChange:f,content:u,onContentChange:d,children:a.jsx(Got,{scope:t,contentId:sg(),triggerId:sg(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),jA="MenuSubTrigger",Yot=p.forwardRef(nr(function(t,n){const i=_g(jA,t.__scopeMenu),r=OC(jA,t.__scopeMenu),s=o_e(jA,t.__scopeMenu),o=EQ(jA,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=o,d={__scopeMenu:t.__scopeMenu},f=p.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]);const h=pr(n,s.onTriggerChange);return a.jsx(J2e,{asChild:!0,...d,children:a.jsx(n_e,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?s.contentId:void 0,"data-state":AQ(i.open),...t,ref:h,onClick:m=>{var g;(g=t.onClick)==null||g.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:An(t.onPointerMove,Xx(m=>{o.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!i.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{i.onOpenChange(!0),f()},100))})),onPointerLeave:An(t.onPointerLeave,Xx(m=>{var b,v;f();const g=(b=i.content)==null?void 0:b.getBoundingClientRect();if(g){const y=(v=i.content)==null?void 0:v.dataset.side,x=y==="right",w=x?-5:5,O=g[x?"left":"right"],S=g[x?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:O,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:O,y:g.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:An(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||o.searchRef.current!==""&&m.key===" "||Eot[r.dir].includes(m.key)&&(i.onOpenChange(!0),(b=i.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),Zot="MenuSubContent",Jot=p.forwardRef(nr(function(t,n){const i=t_e(Cd,t.__scopeMenu),{forceMount:r=i.forceMount,align:s="start",...o}=t,l=_g(Cd,t.__scopeMenu),c=OC(Cd,t.__scopeMenu),u=o_e(Zot,t.__scopeMenu),d=p.useRef(null),f=pr(n,d);return a.jsx(zS.Provider,{scope:t.__scopeMenu,children:a.jsx(Qf,{present:r||l.open,children:a.jsx(zS.Slot,{scope:t.__scopeMenu,children:a.jsx(CQ,{id:u.contentId,"aria-labelledby":u.triggerId,...o,ref:f,align:s,side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;c.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:An(t.onFocusOutside,h=>{h.target!==u.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:An(t.onEscapeKeyDown,h=>{c.onClose(),h.preventDefault()}),onKeyDown:An(t.onKeyDown,h=>{var b;const m=h.currentTarget.contains(h.target),g=Cot[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function AQ(e){return e?"open":"closed"}nr(AQ,"getOpenState");function VS(e){return e==="indeterminate"}nr(VS,"isIndeterminate");function dP(e){return VS(e)?"indeterminate":e?"checked":"unchecked"}nr(dP,"getCheckedState");function a_e(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}nr(a_e,"focusFirst");function l_e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}nr(l_e,"wrapArray");function c_e(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=l_e(e,Math.max(s,0));r.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}nr(c_e,"getNextMatch");function u_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}nr(u_e,"isPointInPolygon");function d_e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return u_e(n,t)}nr(d_e,"isPointerInGraceArea");function Xx(e){return t=>t.pointerType==="mouse"?e(t):void 0}nr(Xx,"whenMouse");var eat=jot,tat=J2e,nat=Rot,iat=Pot,rat=TQ,sat=Fot,oat=zot,aat=Hot,lat=Wot,cat=Kot,uat=Xot,dat=Yot,fat=Jot,hat=Object.defineProperty,fu=(e,t)=>hat(e,"name",{value:t,configurable:!0}),_Q="DropdownMenu",[pat,van]=hc(_Q,[X2e]),hu=X2e(),[mat,f_e]=pat(_Q),gat=fu(e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:r,defaultOpen:s,onOpenChange:o,modal:l=!0}=e,c=hu(t),u=p.useRef(null),[d,f]=Ju({prop:r,defaultProp:s??!1,onChange:o,caller:_Q});return a.jsx(mat,{scope:t,triggerId:sg(),triggerRef:u,contentId:sg(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(eat,{...c,open:d,onOpenChange:f,dir:i,modal:l,children:n})})},"DropdownMenu"),bat="DropdownMenuTrigger",yat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,disabled:r=!1,...s}=t,o=f_e(bat,i),l=hu(i),c=pr(n,o.triggerRef);return a.jsx(tat,{asChild:!0,...l,children:a.jsx(Mr.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:c,onPointerDown:An(t.onPointerDown,u=>{!r&&u.button===0&&u.ctrlKey===!1&&(o.onOpenToggle(),o.open||u.preventDefault())}),onKeyDown:An(t.onKeyDown,u=>{r||(["Enter"," "].includes(u.key)&&o.onOpenToggle(),u.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),vat=fu(e=>{const{__scopeDropdownMenu:t,...n}=e,i=hu(t);return a.jsx(nat,{...i,...n})},"DropdownMenuPortal"),xat="DropdownMenuContent",wat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=f_e(xat,i),o=hu(i),l=p.useRef(!1);return a.jsx(iat,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:n,onCloseAutoFocus:An(t.onCloseAutoFocus,c=>{var u;l.current||(u=s.triggerRef.current)==null||u.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:An(t.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;(!s.modal||f)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Oat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(rat,{...s,...r,ref:n})},"DropdownMenuItem")),kat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(sat,{...s,...r,ref:n})},"DropdownMenuCheckboxItem")),Sat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(oat,{...s,...r,ref:n})},"DropdownMenuRadioGroup")),Eat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(aat,{...s,...r,ref:n})},"DropdownMenuRadioItem")),Cat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(lat,{...s,...r,ref:n})},"DropdownMenuItemIndicator")),Tat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(cat,{...s,...r,ref:n})},"DropdownMenuSeparator")),Aat=fu(e=>{const{__scopeDropdownMenu:t,children:n,open:i,onOpenChange:r,defaultOpen:s}=e,o=hu(t),[l,c]=Ju({prop:i,defaultProp:s??!1,onChange:r,caller:"DropdownMenuSub"});return a.jsx(uat,{...o,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),_at=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(dat,{...s,...r,ref:n})},"DropdownMenuSubTrigger")),jat=p.forwardRef(fu(function(t,n){const{__scopeDropdownMenu:i,...r}=t,s=hu(i);return a.jsx(fat,{...s,...r,ref:n,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),Nat=gat,Rat=yat,h_e=vat,Iat=wat,p_e=Oat,Pat=kat,Dat=Sat,Mat=Eat,m_e=Cat,Lat=Tat,$at=Aat,Fat=_at,Bat=jat,Uat=Object.defineProperty,jg=(e,t)=>Uat(e,"name",{value:t,configurable:!0}),jQ="Popover",[g_e,xan]=hc(jQ,[zw]),NQ=zw(),[Qat,Hw]=g_e(jQ),zat=jg(e=>{const{__scopePopover:t,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:o=!1}=e,l=NQ(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=Ju({prop:i,defaultProp:r??!1,onChange:s,caller:jQ});return a.jsx(aP,{...l,children:a.jsx(Qat,{scope:t,contentId:sg(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>d(!0),[]),onCustomAnchorRemove:p.useCallback(()=>d(!1),[]),modal:o,children:n})})},"Popover"),Vat="PopoverTrigger",Hat=p.forwardRef(jg(function(t,n){const{__scopePopover:i,...r}=t,s=Hw(Vat,i),o=NQ(i),l=pr(n,s.triggerRef),c=a.jsx(Mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":RQ(s.open),...r,ref:l,onClick:An(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(vQ,{asChild:!0,...o,children:c})},"PopoverTrigger")),b_e="PopoverPortal",[qat,Wat]=g_e(b_e,{forceMount:void 0}),Kat=jg(e=>{const{__scopePopover:t,forceMount:n,children:i,container:r}=e,s=Hw(b_e,t);return a.jsx(qat,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"PopoverPortal"),HS="PopoverContent",Gat=p.forwardRef(jg(function(t,n){const i=Wat(HS,t.__scopePopover),{forceMount:r=i.forceMount,...s}=t,o=Hw(HS,t.__scopePopover);return a.jsx(Qf,{present:r||o.open,children:o.modal?a.jsx(Yat,{...s,ref:n}):a.jsx(Zat,{...s,ref:n})})},"PopoverContent")),Xat=cp("PopoverContent.RemoveScroll"),Yat=p.forwardRef(jg(function(t,n){const i=Hw(HS,t.__scopePopover),r=p.useRef(null),s=pr(n,r),o=p.useRef(!1);return p.useEffect(()=>{const l=r.current;if(l)return I2e(l)},[]),a.jsx(mQ,{as:Xat,allowPinchZoom:!0,children:a.jsx(y_e,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:An(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),o.current||(c=i.triggerRef.current)==null||c.focus()}),onPointerDownOutside:An(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:An(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Zat=p.forwardRef(jg(function(t,n){const i=Hw(HS,t.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return a.jsx(y_e,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(r.current||(c=i.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=o.target;((d=i.triggerRef.current)==null?void 0:d.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})},"PopoverContentNonModal")),y_e=p.forwardRef(jg(function(t,n){const{__scopePopover:i,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Hw(HS,i),g=NQ(i);return rP(),a.jsx(y2e,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:a.jsx(xQ,{"data-state":RQ(m.open),role:"dialog",id:m.contentId,...g,...h,ref:n,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function RQ(e){return e?"open":"closed"}jg(RQ,"getState");var v_e=zat,x_e=Hat,w_e=Kat,O_e=Gat,Jat=Object.defineProperty,rl=(e,t)=>Jat(e,"name",{value:t,configurable:!0}),k_e="Radio",[elt,S_e]=hc(k_e),[tlt,fP]=elt(k_e);function E_e(e){const{__scopeRadio:t,checked:n=!1,children:i,disabled:r,form:s,name:o,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=p.useState(null),[m,g]=p.useState(null),b=p.useRef(!1),[v,y]=p.useReducer(O=>O+1,0),x=f?!!s||!!f.closest("form"):!0,w={checked:n,disabled:r,required:c,name:o,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:m,setBubbleInput:g,onCheck:rl(()=>l==null?void 0:l(),"onCheck")};return a.jsx(tlt,{scope:t,...w,children:C_e(d)?d(w):i})}rl(E_e,"RadioProvider");var nlt="RadioTrigger",ilt=p.forwardRef(rl(function({__scopeRadio:t,onClick:n,...i},r){const{checked:s,disabled:o,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=fP(nlt,t),g=pr(r,c);return a.jsx(Mr.button,{type:"button",role:"radio","aria-checked":s,"data-state":IQ(s),"data-disabled":o?"":void 0,disabled:o,value:l,...i,ref:g,onClick:An(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),rlt="RadioIndicator",slt=p.forwardRef(rl(function(t,n){const{__scopeRadio:i,forceMount:r,...s}=t,o=fP(rlt,i);return a.jsx(Qf,{present:r||o.checked,children:a.jsx(Mr.span,{"data-state":IQ(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),olt="RadioBubbleInput",alt=p.forwardRef(rl(function({__scopeRadio:t,onClick:n,...i},r){const{control:s,checked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=fP(olt,t),v=pr(r,m),y=wC(s),x=p.useRef(!1),w=p.useRef(o),O=p.useRef(b);p.useEffect(()=>{const k=h;if(!k)return;const C=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(C,"checked").set,_=b!==O.current;O.current=b;const j=w.current!==o;w.current=o;const T=!(_&&g.current);if(j&&R){x.current=!_;const N=new Event("click",{bubbles:T});R.call(k,o),k.dispatchEvent(N),x.current=!1}},[h,o,g,b]);const S=p.useRef(o);return a.jsx(Mr.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...i,tabIndex:-1,ref:v,onClick:An(n,k=>{x.current&&k.stopPropagation()}),style:{...i.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function C_e(e){return typeof e=="function"}rl(C_e,"isFunction");function IQ(e){return e?"checked":"unchecked"}rl(IQ,"getState");var llt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],PQ="RadioGroup",[clt,wan]=hc(PQ,[Vw,S_e]),T_e=Vw(),hP=S_e(),[ult,dlt]=clt(PQ),flt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,name:r,form:s,defaultValue:o,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=T_e(i),v=xC(f),[y,x]=Ju({prop:l,defaultProp:o??null,onChange:m,caller:PQ}),[w,O]=p.useState(null),S=pr(n,O),k=p.useRef(y);return p.useEffect(()=>{const C=s?w==null?void 0:w.ownerDocument.getElementById(s):w==null?void 0:w.closest("form");if(C instanceof HTMLFormElement){const E=rl(()=>x(k.current),"reset");return C.addEventListener("reset",E),()=>C.removeEventListener("reset",E)}},[w,s,x]),a.jsx(ult,{scope:i,name:r,form:s,required:c,disabled:u,value:y,onValueChange:x,children:a.jsx(kQ,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:a.jsx(Mr.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),hlt="RadioGroupItemProvider",plt="RadioGroupItemTrigger";function A_e(e){const{__scopeRadioGroup:t,value:n,disabled:i,children:r,internal_do_not_use_render:s}=e,o=dlt(hlt,t),l=hP(t),c=o.disabled||i;return a.jsx(E_e,{...l,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:s,children:r})}rl(A_e,"RadioGroupItemProvider");var mlt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=T_e(i),o=hP(i),{checked:l,disabled:c}=fP(plt,o.__scopeRadio),u=p.useRef(null),d=pr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=rl(g=>{llt.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=rl(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),a.jsx(SQ,{asChild:!0,...s,focusable:!c,active:l,children:a.jsx(ilt,{...o,...r,ref:d,onKeyDown:An(r.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:An(r.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),glt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,value:r,disabled:s,...o}=t;return a.jsx(A_e,{__scopeRadioGroup:i,value:r,disabled:s,internal_do_not_use_render:({isFormControl:l})=>a.jsxs(a.Fragment,{children:[a.jsx(mlt,{...o,ref:n,__scopeRadioGroup:i}),l&&a.jsx(blt,{__scopeRadioGroup:i})]})})},"RadioGroupItem")),blt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=hP(i);return a.jsx(alt,{...s,...r,ref:n})},"RadioGroupItemBubbleInput")),ylt=p.forwardRef(rl(function(t,n){const{__scopeRadioGroup:i,...r}=t,s=hP(i);return a.jsx(slt,{...s,...r,ref:n})},"RadioGroupIndicator")),vlt=Object.defineProperty,og=(e,t)=>vlt(e,"name",{value:t,configurable:!0}),DQ="Switch",[xlt,Oan]=hc(DQ),[wlt,MQ]=xlt(DQ);function __e(e){const{__scopeSwitch:t,checked:n,children:i,defaultChecked:r,disabled:s,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Ju({prop:n,defaultProp:r??!1,onChange:c,caller:DQ}),[g,b]=p.useState(null),[v,y]=p.useState(null),x=p.useRef(!1),[w,O]=p.useReducer(C=>C+1,0),S=g?!!o||!!g.closest("form"):!0,k={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:O,required:u,defaultChecked:r,isFormControl:S,bubbleInput:v,setBubbleInput:y};return a.jsx(wlt,{scope:t,...k,children:j_e(f)?f(k):i})}og(__e,"SwitchProvider");var Olt="SwitchTrigger",klt=p.forwardRef(og(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,form:o,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=MQ(Olt,t),y=pr(r,f),x=p.useRef(u);return p.useEffect(()=>{const w=o?s==null?void 0:s.ownerDocument.getElementById(o):s==null?void 0:s.form;if(w instanceof HTMLFormElement){const O=og(()=>h(x.current),"reset");return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[s,o,h]),a.jsx(Mr.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":LQ(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onClick:An(n,w=>{g(),h(O=>!O),v&&b&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})})},"SwitchTrigger")),Slt=p.forwardRef(og(function(t,n){const{__scopeSwitch:i,name:r,checked:s,defaultChecked:o,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return a.jsx(__e,{__scopeSwitch:i,checked:s,defaultChecked:o,disabled:c,required:l,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(klt,{...h,ref:n,__scopeSwitch:i}),m&&a.jsx(Alt,{__scopeSwitch:i})]})})},"Switch")),Elt="SwitchThumb",Clt=p.forwardRef(og(function(t,n){const{__scopeSwitch:i,...r}=t,s=MQ(Elt,i);return a.jsx(Mr.span,{"data-state":LQ(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),Tlt="SwitchBubbleInput",Alt=p.forwardRef(og(function({__scopeSwitch:t,onClick:n,...i},r){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:v}=MQ(Tlt,t),y=pr(r,v),x=wC(s),w=p.useRef(!1),O=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const C=b;if(!C)return;const E=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(E,"checked").set,j=l!==S.current;S.current=l;const T=O.current!==c;O.current=c;const N=!(j&&o.current);if(T&&_){w.current=!j;const A=new Event("click",{bubbles:N});_.call(C,c),C.dispatchEvent(A),w.current=!1}},[b,c,o,l]);const k=p.useRef(c);return a.jsx(Mr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??k.current,required:d,disabled:f,name:h,value:m,form:g,...i,tabIndex:-1,ref:y,onClick:An(n,C=>{w.current&&C.stopPropagation()}),style:{...i.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function j_e(e){return typeof e=="function"}og(j_e,"isFunction");function LQ(e){return e?"checked":"unchecked"}og(LQ,"getState");var _lt=Object.defineProperty,jlt=(e,t)=>_lt(e,"name",{value:t,configurable:!0}),Nlt="Toggle",Rlt=p.forwardRef(jlt(function(t,n){const{pressed:i,defaultPressed:r,onPressedChange:s,...o}=t,[l,c]=Ju({prop:i,onChange:s,defaultProp:r??!1,caller:Nlt});return a.jsx(Mr.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...o,ref:n,onClick:An(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),Ilt=Object.defineProperty,ag=(e,t)=>Ilt(e,"name",{value:t,configurable:!0}),qw="ToggleGroup",[N_e,kan]=hc(qw,[Vw]),R_e=Vw(),Plt=p.forwardRef(ag(function(t,n){const{type:i,...r}=t;if(i==="single"){const s=r;return a.jsx(Dlt,{role:"radiogroup",...s,ref:n})}if(i==="multiple"){const s=r;return a.jsx(Mlt,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${qw}\``)},"ToggleGroup")),[I_e,P_e]=N_e(qw),Dlt=p.forwardRef(ag(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ag(()=>{},"onValueChange"),...o}=t,[l,c]=Ju({prop:i,defaultProp:r??"",onChange:s,caller:qw});return a.jsx(I_e,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:a.jsx(D_e,{...o,ref:n})})},"ToggleGroupImplSingle")),Mlt=p.forwardRef(ag(function(t,n){const{value:i,defaultValue:r,onValueChange:s=ag(()=>{},"onValueChange"),...o}=t,[l,c]=Ju({prop:i,defaultProp:r??[],onChange:s,caller:qw}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return a.jsx(I_e,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:a.jsx(D_e,{...o,ref:n})})},"ToggleGroupImplMultiple")),[Llt,$lt]=N_e(qw),D_e=p.forwardRef(ag(function(t,n){const{__scopeToggleGroup:i,disabled:r=!1,rovingFocus:s=!0,orientation:o,dir:l,loop:c=!0,...u}=t,d=R_e(i),f=xC(l),h={dir:f,...u};return a.jsx(Llt,{scope:i,rovingFocus:s,disabled:r,children:s?a.jsx(kQ,{asChild:!0,...d,orientation:o,dir:f,loop:c,children:a.jsx(Mr.div,{...h,ref:n})}):a.jsx(Mr.div,{...h,ref:n})})},"ToggleGroupImpl")),vF="ToggleGroupItem",Flt=p.forwardRef(ag(function(t,n){const i=P_e(vF,t.__scopeToggleGroup),r=$lt(vF,t.__scopeToggleGroup),s=R_e(t.__scopeToggleGroup),o=i.value.includes(t.value),l=r.disabled||t.disabled,c={...t,pressed:o,disabled:l},u=p.useRef(null);return r.rovingFocus?a.jsx(SQ,{asChild:!0,...s,focusable:!l,active:o,ref:u,children:a.jsx(sZ,{...c,ref:n})}):a.jsx(sZ,{...c,ref:n})},"ToggleGroupItem")),sZ=p.forwardRef(ag(function(t,n){const{__scopeToggleGroup:i,value:r,...s}=t,o=P_e(vF,i),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=o.type==="single"?l:void 0;return a.jsx(Rlt,{...c,...s,ref:n,onPressedChange:u=>{u?o.onItemActivate(r):o.onItemDeactivate(r)}})},"ToggleGroupItemImpl")),Blt=Object.defineProperty,ga=(e,t)=>Blt(e,"name",{value:t,configurable:!0}),[$Q,San]=hc("Tooltip",[zw]),FQ=zw(),Ult="TooltipProvider",Qlt=700,xF="tooltip.open",[zlt,BQ]=$Q(Ult),Vlt=ga(e=>{const{__scopeTooltip:t,delayDuration:n=Qlt,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=e,o=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(zlt,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),o.current=!1)},[i]),onClose:p.useCallback(()=>{i<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,i))},[i]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})},"TooltipProvider"),wF="Tooltip",[Hlt,kC]=$Q(wF),qlt=ga(e=>{const{__scopeTooltip:t,children:n,open:i,defaultOpen:r,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=BQ(wF,e.__scopeTooltip),u=FQ(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=sg(),b=p.useRef(0),v=o??c.disableHoverableContent,y=l??c.delayDuration,x=p.useRef(!1),[w,O]=Ju({prop:i,defaultProp:r??!1,onChange:ga(_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(xF))):c.onClose(),s==null||s(_)},"onChange"),caller:wF}),S=p.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),k=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,x.current=!1,O(!0)},[O]),C=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,O(!1)},[O]),E=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{x.current=!0,O(!0),b.current=0},y)},[y,O]);p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]);const R=h??g;return a.jsx(aP,{...u,children:a.jsx(Hlt,{scope:t,contentId:R,setContentId:m,open:w,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?E():k()},[c.isOpenDelayedRef,E,k]),onTriggerLeave:p.useCallback(()=>{v?C():(window.clearTimeout(b.current),b.current=0)},[C,v]),onOpen:k,onClose:C,disableHoverableContent:v,children:n})})},"Tooltip"),oZ="TooltipTrigger",Wlt=p.forwardRef(ga(function(t,n){const{__scopeTooltip:i,...r}=t,s=kC(oZ,i),o=BQ(oZ,i),l=FQ(i),c=p.useRef(null),u=pr(n,c,s.onTriggerChange),d=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(vQ,{asChild:!0,...l,children:a.jsx(Mr.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:u,onPointerMove:An(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:An(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:An(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:An(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:An(t.onBlur,s.onClose),onClick:An(t.onClick,s.onClose)})})},"TooltipTrigger")),M_e="TooltipPortal",[Klt,Glt]=$Q(M_e,{forceMount:void 0}),Xlt=ga(e=>{const{__scopeTooltip:t,forceMount:n,children:i,container:r}=e,s=kC(M_e,t);return a.jsx(Klt,{scope:t,forceMount:n,children:a.jsx(Qf,{present:n||s.open,children:a.jsx(hQ,{asChild:!0,container:r,children:i})})})},"TooltipPortal"),qS="TooltipContent",Ylt=p.forwardRef(ga(function(t,n){const i=Glt(qS,t.__scopeTooltip),{forceMount:r=i.forceMount,side:s="top",...o}=t,l=kC(qS,t.__scopeTooltip);return a.jsx(Qf,{present:r||l.open,children:l.disableHoverableContent?a.jsx(L_e,{side:s,...o,ref:n}):a.jsx(Zlt,{side:s,...o,ref:n})})},"TooltipContent")),Zlt=p.forwardRef(ga(function(t,n){const i=kC(qS,t.__scopeTooltip),r=BQ(qS,t.__scopeTooltip),s=p.useRef(null),o=pr(n,s),[l,c]=p.useState(null),{trigger:u,onClose:d}=i,f=s.current,{onPointerInTransitChange:h}=r,m=p.useCallback(()=>{c(null),h(!1)},[h]),g=p.useCallback((b,v)=>{const y=b.currentTarget,x={x:b.clientX,y:b.clientY},w=$_e(x,y.getBoundingClientRect()),O=F_e(x,w),S=B_e(v.getBoundingClientRect()),k=Q_e([...O,...S]);c(k),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=ga(y=>g(y,f),"handleTriggerLeave"),v=ga(y=>g(y,u),"handleContentLeave");return u.addEventListener("pointerleave",b),f.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",v)}}},[u,f,g,m]),p.useEffect(()=>{if(l){const b=ga(v=>{const y=v.target,x={x:v.clientX,y:v.clientY},w=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),O=!U_e(x,l);w?m():O&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),a.jsx(L_e,{...t,ref:o})},"TooltipContentHoverable")),Jlt=GAe("TooltipContent"),L_e=p.forwardRef(ga(function(t,n){const{__scopeTooltip:i,children:r,"aria-label":s,id:o,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=kC(qS,i),f=FQ(i),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(xF,h),()=>document.removeEventListener(xF,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=ga(b=>{b.target instanceof Node&&b.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]);const{setContentId:m}=d;return zu(()=>(m(o),()=>{m(void 0)}),[o,m]),a.jsx(uQ,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:a.jsxs(xQ,{"data-state":d.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:d.contentId,...f,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(Jlt,{children:r}),s?a.jsx(Crt,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function $_e(e,t){const n=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,i,r,s)){case s:return"left";case r:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}ga($_e,"getExitSideFromRect");function F_e(e,t,n=5){const i=[];switch(t){case"top":i.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":i.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":i.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":i.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return i}ga(F_e,"getPaddedExitPoints");function B_e(e){const{top:t,right:n,bottom:i,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:i},{x:r,y:i}]}ga(B_e,"getPointsFromRect");function U_e(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}ga(U_e,"isPointInPolygon");function Q_e(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),z_e(t)}ga(Q_e,"getHull");function z_e(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let i=e.length-1;i>=0;i--){const r=e[i];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ga(z_e,"getHullPresorted");var ect=Vlt,tct=qlt,V_e=Wlt,nct=Xlt,ict=Ylt;function lg(e){const t=p.useRef(e);return t.current=e,t}let Yx=[],NA=!1;const aZ=e=>{var t,n;if(e.key==="Escape"){const[i]=Yx;i&&(e.preventDefault(),(n=(t=i.callback).current)==null||n.call(t))}},H_e=()=>{Yx.length>0&&!NA?(document.body.addEventListener("keydown",aZ),NA=!0):Yx.length===0&&NA&&(document.body.removeEventListener("keydown",aZ),NA=!1)},rct=e=>{Yx.unshift(e),H_e()},sct=({id:e})=>{Yx=Yx.filter(t=>t.id!==e),H_e()},SC=(e,t)=>{const n=p.useId(),i=lg(t);p.useEffect(()=>{if(!e)return;const r={id:n,callback:i};return rct(r),()=>sct(r)},[n,e,i])},oct=p.createContext(null);function q_e(){const e=p.useContext(oct);return(e==null?void 0:e.linkComponent)??"a"}function EC(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const act=()=>zAe,lZ=(e,t=!1,n="TransitionGroup")=>{const i=[];return p.Children.forEach(e,r=>{if(r&&typeof r=="object"&&"key"in r&&r.key)i.push(r);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),i},$0=()=>{},F0=e=>{const t=p.useRef(e);return t.current=e,p.useCallback(n=>t.current(n),[])};function lct(e,t,n,i){const r=e.reduce((c,u)=>({...c,[u.key]:1}),{}),s=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),o=e.filter(c=>!s[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!r[c.component.key]}));return i==="append"?l.concat(o):o.concat(l)}function cct(e,t,n){if((zAe||art)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const uct="_TransitionGroupChild_1hv1z_1",dct={TransitionGroupChild:uct},W_e={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},fct=e=>({...W_e,enter:!e}),hct=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return W_e}},pct=({ref:e,as:t,children:n,className:i,transitionId:r,style:s,preventMountTransition:o,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:m,onExit:g,onExitActive:b,onExitComplete:v})=>{const[y,x]=p.useReducer(hct,fct(o||!1)),w=p.useRef(!1),O=p.useRef(null),S=p.useRef(c);S.current=c;const k=p.useRef(u);k.current=u;const C=p.useRef(null),E=p.useCallback(R=>{const _=O.current;if(!(!_||R===C.current))switch(C.current=R,R){case"enter":f(_);break;case"enter-active":h(_);break;case"enter-complete":m(_);break;case"exit":g(_);break;case"exit-active":b(_);break;case"exit-complete":v(_);break}},[f,h,m,g,b,v]);return pi.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),E("exit");const T=xN(()=>{x({type:"exit-active"}),E("exit-active"),j=window.setTimeout(()=>{E("exit-complete"),d()},k.current)});return()=>{T(),j!==void 0&&clearTimeout(j)}}if(o&&!w.current){w.current=!0;return}let R;x({type:"enter-before"}),E("enter");const _=xN(()=>{x({type:"enter-active"}),E("enter-active"),R=window.setTimeout(()=>{x({type:"done"}),E("enter-complete")},S.current)});return()=>{_(),R!==void 0&&clearTimeout(R)}},[l,o,d,E]),p.useEffect(()=>()=>{w.current=!1},[]),a.jsx(t,{ref:EC([O,e]),className:Ti(i,dct.TransitionGroupChild),"data-transition-id":r,style:s,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},mct=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,i=!n&&t!=null?t:null,[r,s]=p.useState(i==null);return rQ(()=>s(!0),r?null:i),r?a.jsx(pct,{...e}):null},Ww=e=>{const{ref:t,as:n="span",children:i,className:r,transitionId:s,style:o,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=act()}=e,m=F0(e.onEnter??$0),g=F0(e.onEnterActive??$0),b=F0(e.onEnterComplete??$0),v=F0(e.onExit??$0),y=F0(e.onExitActive??$0),x=F0(e.onExitComplete??$0);p.Children.forEach(i,k=>{if(k&&!k.key)throw new Error("Child elements of must include a `key`")});const w=p.useCallback(k=>({component:k,shouldRender:!0,removeChild:()=>{S(C=>C.filter(E=>k.key!==E.component.key))},onEnter:m,onEnterActive:g,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[m,g,b,v,y,x]),[O,S]=p.useState(()=>lZ(i).map(k=>({...w(k),preventMountTransition:u})));return p.useLayoutEffect(()=>{S(k=>{const C=lZ(i);return lct(C,k,w,f)})},[i,f,w]),cct("TransitionGroup",t,p.Children.count(i)),h?a.jsx(a.Fragment,{children:p.Children.map(i,k=>a.jsx(n,{ref:t,className:r,style:o,"data-transition-id":s,children:k}))}):a.jsx(a.Fragment,{children:O.map(({component:k,...C})=>a.jsx(mct,{...C,as:n,className:r,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:o,ref:t,children:k},k.key))})},gct="_Button_1864l_1",bct="_ButtonInner_1864l_4",yct="_ButtonLoader_1864l_749",s5={Button:gct,ButtonInner:bct,ButtonLoader:yct},Dt=e=>{const{type:t="button",color:n="primary",variant:i="solid",pill:r=!0,uniform:s=!1,size:o="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:m,className:g,onClick:b,disabled:v,disabledTone:y,inert:x=u,...w}=e,O=v||x,S=p.useCallback(k=>{v||b==null||b(k)},[b,v]);return a.jsxs("button",{type:t,className:Ti(s5.Button,g),"data-color":n,"data-variant":i,"data-pill":r?"":void 0,"data-uniform":s?"":void 0,"data-size":o,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:sQ,disabled:O,"aria-disabled":O,tabIndex:O?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:S,...w,children:[a.jsx(Ww,{className:s5.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&a.jsx(yC,{},"loader")}),a.jsx("span",{className:s5.ButtonInner,children:iQ(m)})]})},vct=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function xct(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function wct(e,t=document.body){if(typeof e=="string")return cZ(e,t);try{return vct()?(await navigator.clipboard.write([xct(e)]),!0):e["text/plain"]?cZ(e["text/plain"],t):!1}catch{return!1}}async function cZ(e,t=document.body){if(navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",t.appendChild(n),n.focus(),n.select();let i=!1;try{i=document.execCommand("copy")}catch{}return t.removeChild(n),i}const Oct="_TransitionItem_1o7b1_1",kct={TransitionItem:Oct},Sct=e=>{const{as:t="span",className:n,children:i,preventInitialTransition:r,insertMethod:s,transitionClassName:o,transitionPosition:l="absolute"}=e,{enterTotalDuration:c,exitTotalDuration:u,variables:d}=_ct(e);return a.jsx(t,{className:Ti("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:a.jsx(Ww,{as:t,className:Ti(kct.TransitionItem,o),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:r,children:i})})},Ect=400,Cct=500,Tct=200,Act=300;function _ct({initial:e,enter:t,exit:n,forceCompositeLayer:i}){const r=KL(e),s=KL(t),o=KL(n),l=[r,o,s].some(b=>b!=="none"),c=(t==null?void 0:t.duration)??(l?Cct:Ect),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?Act:Tct),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=zy({"tg-will-change":i?"transform, opacity":"auto","tg-enter-opacity":WL((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":GL(t),"tg-enter-duration":kA(c),"tg-enter-delay":kA((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":WL((n==null?void 0:n.opacity)??0),"tg-exit-transform":o,"tg-exit-filter":GL(n),"tg-exit-duration":kA(d),"tg-exit-delay":kA((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":WL((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":r==="none"?o:r,"tg-initial-filter":GL(e??n??{})}),m=((t==null?void 0:t.delay)??0)+c,g=((n==null?void 0:n.delay)??0)+d;return{enterTotalDuration:m,exitTotalDuration:g,variables:h}}const UQ=({children:e,copyValue:t,onClick:n,...i})=>{const[r,s]=p.useState(!1),o=p.useRef(null),l=c=>{r||(s(!0),n==null||n(c),wct(typeof t=="function"?t():t),o.current=window.setTimeout(()=>{s(!1)},1300))};return p.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),a.jsxs(Dt,{...i,onClick:l,children:[a.jsx(Sct,{className:"w-[var(--button-icon-size)] h-[var(--button-icon-size)]",initial:{scale:.6},enter:{scale:1,delay:150,duration:300},exit:{scale:.6,duration:150},forceCompositeLayer:!0,children:r?a.jsx(Gx,{},"copied-icon"):a.jsx(YU,{},"copy-icon")}),typeof e=="function"?e({copied:r}):e]})},jct="_Menu_1t4b0_1",Nct="_MenuList_1t4b0_3",Rct="_MenuItemContent_1t4b0_53",Ict="_MenuItem_1t4b0_53",Pct="_ItemActions_1t4b0_98",Dct="_PressableInner_1t4b0_117",Mct="_Separator_1t4b0_135",Lct="_SubMenuItem_1t4b0_139",$ct="_SubTriggerIcon_1t4b0_141",Fct="_RadioItem_1t4b0_151",Bct="_RadioIndicatorActive_1t4b0_158",Uct="_RadioIndicator_1t4b0_158",Qct="_CheckboxItem_1t4b0_249",zct="_CheckboxIndicator_1t4b0_256",Vct="_CheckboxCircle_1t4b0_269",ps={Menu:jct,MenuList:Nct,MenuItemContent:Rct,MenuItem:Ict,ItemActions:Pct,PressableInner:Dct,Separator:Mct,SubMenuItem:Lct,SubTriggerIcon:$ct,RadioItem:Fct,RadioIndicatorActive:Bct,RadioIndicator:Uct,CheckboxItem:Qct,CheckboxIndicator:zct,CheckboxCircle:Vct},K_e=p.createContext(null),CC=()=>{const e=p.useContext(K_e);if(!e)throw new Error("Menu components must be wrapped in ");return e},Pr=({children:e,forceOpen:t,onOpen:n,onClose:i,modal:r=!1})=>{const[s,o]=p.useState(!1),l=t??s,c=lg(n),u=lg(i),d=p.useCallback(h=>{var m,g;o(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);SC(s,()=>{d(!1)});const f=p.useMemo(()=>({open:l,setOpen:d}),[l,d]);return a.jsx(K_e.Provider,{value:f,children:a.jsx(Nat,{open:l,onOpenChange:d,modal:r,children:e})})},Hct=({className:e,children:t,disabled:n,onSelect:i,onClick:r})=>{const{open:s}=CC(),o=l=>{s||l.preventDefault()};return i?a.jsx(p_e,{className:Ti(ps.MenuItem,e),onSelect:i,onClick:r,disabled:n,onPointerMove:o,onPointerLeave:o,children:a.jsx("div",{className:ps.PressableInner,children:t})}):a.jsx("div",{className:Ti(ps.MenuItemContent,e),children:t})},qct=({className:e,children:t})=>a.jsx("div",{className:Ti(ps.ItemActions,e),children:t}),Wct=({children:e,onClick:t})=>{const{setOpen:n}=CC();return a.jsx(Dt,{className:"rounded-sm",color:"secondary",size:"xs",uniform:!0,iconSize:"sm",variant:"ghost",onClick:i=>{i.stopPropagation(),n(!1),t(i)},children:e})},Kct=e=>{const{className:t,children:n,href:i,to:r,disabled:s,as:o,...l}=e,{open:c}=CC(),u=i||r,d=u?/^https?:\/\//.test(u):!0,f=q_e(),h=o||(d?"a":f),m=b=>{c||b.preventDefault()},g=d?{target:"_blank",rel:"noopener noreferrer",href:i??r}:{href:i,to:r};return a.jsx(p_e,{asChild:!0,className:Ti(ps.MenuItem,t),disabled:s,onPointerMove:d?void 0:m,onPointerLeave:d?void 0:m,children:a.jsx(h,{...g,...l,children:a.jsx("span",{className:ps.PressableInner,children:n})})})},Gct=({className:e})=>a.jsx(Lat,{className:Ti(ps.Separator,e),role:"separator"}),Xct=({children:e,side:t,sideOffset:n=5,align:i,alignOffset:r,width:s,minWidth:o,maxHeight:l})=>{const{open:c}=CC();return a.jsx(h_e,{forceMount:!0,children:a.jsx(Ww,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:c&&a.jsx(Iat,{forceMount:!0,className:ps.MenuList,side:t,sideOffset:n,align:i,alignOffset:r??(i==="center"?0:-5),avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Kh,style:zy({"menu-width":s,"menu-min-width":o,"menu-max-height":l}),children:e},"dropdown")})})},Yct=({children:e,disabled:t})=>a.jsx(Rat,{asChild:!0,disabled:t,children:e}),G_e=p.createContext(null),X_e=()=>{const e=p.useContext(G_e);if(!e)throw new Error("Submenu components must be wrapped in ");return e},Zct=({children:e,forceOpen:t,onOpen:n,onClose:i})=>{const[r,s]=p.useState(!1),o=p.useRef(null),l=t??r,c=lg(n),u=lg(i),d=p.useCallback(h=>{var m,g;s(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);SC(r,()=>{var h;d(!1),(h=o.current)==null||h.focus()});const f=p.useMemo(()=>({open:l,setOpen:d,triggerRef:o}),[l,d]);return a.jsx(G_e.Provider,{value:f,children:a.jsx($at,{open:l,onOpenChange:d,children:e})})},Jct=({className:e,children:t,disabled:n})=>{const{open:i}=CC(),{triggerRef:r}=X_e(),s=o=>{i||o.preventDefault()};return a.jsx(Fat,{ref:r,className:Ti(ps.MenuItem,ps.SubMenuItem,e),disabled:n,onPointerMove:s,onPointerLeave:s,children:a.jsxs("div",{className:ps.PressableInner,children:[t,a.jsx(vnt,{width:"16",height:"16",className:ps.SubTriggerIcon})]})})},eut=({children:e,sideOffset:t=4,alignOffset:n=-6,width:i="auto",minWidth:r="auto",maxHeight:s})=>{const{open:o}=X_e();return a.jsx(h_e,{forceMount:!0,children:a.jsx(Ww,{className:ps.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:o&&a.jsx(Bat,{className:ps.MenuList,sideOffset:t,alignOffset:n,avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Kh,style:zy({"menu-width":i,"menu-min-width":r,"menu-max-height":s}),children:e},"submenu")})})},tut=({children:e,value:t,onChange:n,indicatorPosition:i="end",...r})=>a.jsx(Dat,{...r,value:t,onValueChange:s=>n(s),"data-indicator-position":i,children:e}),nut=({className:e,children:t,...n})=>a.jsx(Mat,{className:Ti(ps.MenuItem,ps.RadioItem,e),...n,children:a.jsxs("div",{className:ps.PressableInner,children:[a.jsx("div",{className:ps.RadioIndicator,children:a.jsx(m_e,{className:ps.RadioIndicatorActive})}),t]})}),iut=({className:e,children:t,indicatorPosition:n="end",indicatorVariant:i="solid",...r})=>a.jsx(Pat,{className:Ti(ps.MenuItem,ps.CheckboxItem,e),...r,"data-indicator-position":n,"data-indicator-variant":i,children:a.jsxs("div",{className:ps.PressableInner,children:[a.jsx("div",{className:ps.CheckboxIndicator,children:a.jsx(m_e,{children:i==="ghost"?a.jsx(Gx,{className:"size-4"}):a.jsx("div",{className:ps.CheckboxCircle,children:a.jsx(Gx,{className:"size-4"})})})}),t]})});Pr.Content=Xct;Pr.Item=Hct;Pr.ItemActions=qct;Pr.ItemAction=Wct;Pr.Link=Kct;Pr.Separator=Gct;Pr.Trigger=Yct;Pr.Sub=Zct;Pr.SubTrigger=Jct;Pr.SubContent=eut;Pr.CheckboxItem=iut;Pr.RadioGroup=tut;Pr.RadioItem=nut;const rut="_Tooltip_16g2y_1",sut="_TriggerDecorator_16g2y_73",Y_e={Tooltip:rut,TriggerDecorator:sut},uo=e=>{const{ref:t,children:n,content:i,forceOpen:r=i===null?!1:void 0,maxWidth:s=300,openDelay:o=150,interactive:l=!1,compact:c=!1,preventUnintentionalClickToClose:u,align:d,alignOffset:f=0,side:h,sideOffset:m=5,gutterSize:g="md",contentClassName:b,onPointerDown:v,onClick:y,...x}=e,[w,O]=p.useState(!1),[S,k]=p.useState(!1);rQ(()=>k(!1),S?400:null);const C=r??w,E=_=>{typeof r!="boolean"&&(O(_),u&&k(_))},R=_=>{u&&S&&(_.preventDefault(),_.stopPropagation())};return a.jsxs(Z_e,{open:C,delayDuration:o,onOpenChange:E,disableHoverableContent:!l,children:[a.jsx(V_e,{asChild:!0,children:a.jsx(WAe,{...x,ref:t,onPointerDown:_=>{R(_),v==null||v(_)},onClick:_=>{R(_),y==null||y(_)},children:n})}),a.jsx(J_e,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:i})]})},Z_e=({children:e,open:t,onOpenChange:n,...i})=>(SC(t,()=>{n(!1)}),a.jsx(ect,{children:a.jsx(tct,{open:t,onOpenChange:n,...i,children:e})})),J_e=({children:e,maxWidth:t=300,compact:n=!1,clickable:i=void 0,alignOffset:r=0,sideOffset:s=5,gutterSize:o="md",className:l,style:c,...u})=>a.jsx(nct,{children:a.jsx(ict,{...u,className:Ti(Y_e.Tooltip,l),"data-compact":n,"data-clickable":i,"data-gutter-size":o,alignOffset:r,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Kh,children:e})}),out=({children:e,asChild:t=!0,...n})=>a.jsx(V_e,{asChild:t,...n,children:e}),aut=e=>{const{children:t,className:n,focusable:i=!0,ref:r,...s}=e,o=typeof t=="string";return a.jsx(WAe,{ref:r,...s,className:Ti(Y_e.TriggerDecorator,n),tabIndex:i?0:void 0,children:o?a.jsx("span",{children:t}):t})};uo.Root=Z_e;uo.Content=J_e;uo.Trigger=out;uo.TriggerDecorator=aut;const lut=50,uZ=48;function cut(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(o=>typeof o.text=="string"?o.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function uut(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return z("search.untitledSession")}function dut(e,t,n){const i=Math.max(0,t-uZ),r=Math.min(e.length,t+n+uZ);return(i>0?"…":"")+e.slice(i,r).trim()+(r{var c;if((c=l.events)!=null&&c.length)return l;try{return await NI(t,e,l.id)}catch{return l}})),o=[];for(const l of s)for(const{text:c,role:u,ts:d}of cut(l)){const f=c.toLowerCase().indexOf(i);if(f!==-1){o.push({type:"session",appId:t,sessionId:l.id,title:uut(l),snippet:dut(c,f,i.length),role:u,ts:d??l.lastUpdateTime});break}}return o.sort((l,c)=>(c.ts??0)-(l.ts??0)),o.slice(0,lut)}async function hut(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await xEe(e,t.trim())}catch(o){const l=String(o);return{results:[],note:l.includes("404")?z("search.webUnavailable"):z("search.webFailed",{message:l})}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((o,l)=>({type:"web",index:l,title:o.title,url:o.url,siteName:o.siteName,summary:o.summary}))}:{results:[],note:z("search.webNotMounted")}}async function put(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await vEe(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:z(e==="knowledge"?"search.knowledgeNotMounted":"search.memoryNotMounted")};if(r.error)return{results:[],note:r.error};const s=r.sourceName??z(e==="knowledge"?"search.knowledge":"search.longTermMemory");return{results:r.results.map((o,l)=>e==="knowledge"?{type:"knowledge",index:l,content:o.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:l,content:o.content,sourceName:s,sourceType:r.sourceType,author:o.author,ts:o.timestamp})}}async function mut(e,t,n){return e==="session"?{results:await fut(n.userId,n.appId,t)}:e==="web"?hut(n.appId,t):put(e,n.appId,n.userId,t)}function eje({mirrored:e=!1}){return a.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[a.jsx("path",{className:"sidebar-panel-glyph__divider",d:"M5.938 6.833c.11 0 .249.102.249.292v6.042c0 .19-.14.291-.249.291s-.248-.101-.248-.291V7.125c0-.19.139-.292.248-.292Z",strokeWidth:"1.167"}),a.jsx("path",{className:"sidebar-panel-glyph__frame",d:"M14.5 3.75h-9a3 3 0 0 0-3 3v6.857a3 3 0 0 0 3 3h9a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3Z",strokeWidth:"1.667",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gut(e){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:a.jsx(eje,{})})}function but(e){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:a.jsx(eje,{mirrored:!0})})}function yut(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 8.333c.368 0 .667.299.667.667v2h2a.667.667 0 0 1 0 1.333h-2v2a.667.667 0 0 1-1.334 0v-2h-2a.667.667 0 0 1 0-1.333h2V9c0-.368.299-.667.667-.667ZM7.667 1c3.49 0 6.383 2.554 6.913 5.896a.667.667 0 0 1-1.317.208 5.667 5.667 0 1 0-9.708 4.424.67.67 0 0 1 .07.12.667.667 0 0 1-.13.834l-.95.853 4.788-.002a.667.667 0 0 1 0 1.334l-5.657.002c-.917 0-1.35-1.131-.67-1.744l1.163-1.045A6.97 6.97 0 0 1 .667 8c0-3.866 3.134-7 7-7Z",fill:"currentColor"})})}function vut(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),a.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function xut(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 0.667c4.05 0 7.334 3.283 7.334 7.333 0 4.05-3.284 7.334-7.334 7.334S0.667 12.05 0.667 8 3.95 0.667 8 0.667Zm0 1.333a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM6.167 6c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.334 0v-2c0-.368.299-.667.667-.667Zm3.666 0c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.333 0v-2c0-.368.298-.667.666-.667Z",fill:"currentColor"})})}function tje(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M7.58 2.6a.667.667 0 0 0-.667-.667h-.666a.667.667 0 0 0-.667.667v10.667c0 .368.299.666.667.666h.666a.667.667 0 0 0 .667-.666V2.6Zm1.333 10.667A2 2 0 0 1 6.913 15.267h-.666a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.666a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"}),a.jsx("path",{d:"M11.88 5.045a.667.667 0 0 0-.801-.514l-.653.136a.667.667 0 0 0-.504.786l1.85 8.092c.081.358.44.589.8.514l.653-.137a.667.667 0 0 0 .504-.786L11.88 5.045Zm3.155 7.82a2 2 0 0 1-1.512 2.358l-.653.136a2 2 0 0 1-2.403-1.541L8.617 5.726a2 2 0 0 1 1.513-2.358l.652-.136a2 2 0 0 1 2.404 1.541l1.849 8.092Z",fill:"currentColor"}),a.jsx("path",{d:"M4.247 2.6a.667.667 0 0 0-.667-.667h-.667a.667.667 0 0 0-.666.667v10.667c0 .368.298.666.666.666h.667a.667.667 0 0 0 .667-.666V2.6ZM5.58 13.267a2 2 0 0 1-2 2h-.667a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.667a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"})]})}function nje(e){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M3.25 2.25h6l3.5 3.5v8H3.25v-11Z"}),a.jsx("path",{d:"M9.25 2.25v3.5h3.5M5.5 8.25h5M5.5 10.75h4"})]})}function wut({className:e="icon"}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),a.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Out({open:e}){return a.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:a.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function kut({active:e=!1,onClick:t}){const{t:n}=Ae("workspaceTools");return a.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":n("search.nav"),"aria-current":e?"page":void 0,title:n("search.nav"),children:[a.jsx(vut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:n("search.nav")})]})}function Sut(e,t,n,i){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),o=l=>r?n?i("search.checkingCapabilities"):i("search.notMounted",{label:l}):i("search.selectAgent");return[{id:"session",label:i("search.sources.session"),ready:r,unavailableLabel:i("search.selectAgent")},{id:"web",label:i("search.sources.web"),ready:r&&s.has("web"),description:i("search.webDescription"),unavailableLabel:o(" web_search")},{id:"knowledge",label:i("search.sources.knowledge"),ready:r&&s.has("knowledge"),unavailableLabel:o(i("search.sources.knowledge"))},{id:"memory",label:i("search.sources.memory"),ready:r&&s.has("memory"),unavailableLabel:o(i("search.sources.memory"))}]}function wN(e,t){return{context_search:"Context Search",local:t("search.backendLocal"),mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function dZ(e,t){return e?new Date(e*1e3).toLocaleString(t,{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function Eut({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var L,U;const{t:o,i18n:l}=Ae("workspaceTools"),c=l.resolvedLanguage||l.language,[u,d]=p.useState("session"),[f,h]=p.useState(""),[m,g]=p.useState([]),[b,v]=p.useState(),[y,x]=p.useState(!1),[w,O]=p.useState(!1),[S,k]=p.useState(!1),C=p.useRef(0),E=p.useRef(null),R=Sut(t,n,i,o),_=R.find(I=>I.id===u),j=u==="knowledge"?(L=n==null?void 0:n.components)==null?void 0:L.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):u==="memory"?(U=n==null?void 0:n.components)==null?void 0:U.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;p.useEffect(()=>{C.current+=1,d("session"),g([]),v(void 0),O(!1),x(!1),k(!1)},[t]),p.useEffect(()=>{if(!S)return;function I(H){var K;(K=E.current)!=null&&K.contains(H.target)||k(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[S]);async function T(I,H){var V;const K=I.trim();if(!K||!((V=R.find(X=>X.id===H))!=null&&V.ready))return;const F=++C.current;x(!0),O(!0);let W;try{W=await mut(H,K,{userId:e,appId:t})}catch(X){const ie=X instanceof Error?X.message:String(X);W={results:[],note:o("search.failed",{message:ie})}}F===C.current&&(g(W.results),v(W.note),x(!1))}function N(I){C.current+=1,h(I),g([]),v(void 0),O(!1),x(!1)}function A(I){C.current+=1,d(I),k(!1),g([]),v(void 0),O(!1),x(!1)}const P=!!(_!=null&&_.ready),D=t?u==="web"?o("search.placeholder.web"):u==="knowledge"?o("search.placeholder.knowledge",{name:(j==null?void 0:j.name)??o("search.placeholder.knowledgeFallback")}):u==="memory"?o("search.placeholder.memory",{name:(j==null?void 0:j.name)??o("search.placeholder.memoryFallback")}):o("search.placeholder.session"):o("search.placeholder.selectAgent"),M=j!=null&&j.backend?wN(j.backend,o):"";return a.jsxs("div",{className:"search",children:[a.jsxs("div",{className:"search-box",children:[a.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[a.jsxs("button",{className:"search-source-picker",type:"button","aria-label":o("search.sourceTypeAria",{label:(_==null?void 0:_.label)??o("search.notSelected")}),"aria-haspopup":"listbox","aria-expanded":S,onClick:()=>k(I=>!I),children:[a.jsx("span",{children:(_==null?void 0:_.label)??o("search.sourceType")}),M&&a.jsx("small",{children:M}),a.jsx(Out,{open:S})]}),S&&a.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":o("search.selectSource"),children:R.map(I=>{var F,W;const H=I.id==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(V=>V.source==="knowledgebase"||V.kind==="knowledgebase"):I.id==="memory"?(W=n==null?void 0:n.components)==null?void 0:W.find(V=>V.source==="long_term_memory"||V.kind==="memory"):void 0,K=H?[H.name,H.backend?wN(H.backend,o):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return a.jsxs("button",{type:"button",role:"option","aria-selected":u===I.id,disabled:!I.ready,onClick:()=>A(I.id),children:[a.jsx("span",{children:I.label}),K&&a.jsx("small",{children:K})]},I.id)})})]}),a.jsx("span",{className:"search-box-divider","aria-hidden":!0}),a.jsx("input",{className:"search-input",value:f,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),T(f,u))},placeholder:D,disabled:!P,autoFocus:!0}),a.jsx("button",{className:"search-go",onClick:()=>void T(f,u),disabled:!f.trim()||y,"aria-label":o("search.nav"),children:y?a.jsx(Ei,{className:"icon spin"}):a.jsx(wut,{className:"icon"})})]}),a.jsx("div",{className:"search-results",children:P?w?y?null:b?a.jsx("div",{className:"search-empty",children:b}):m.length===0&&w?a.jsx("div",{className:"search-empty",children:o("search.noResults",{query:f.trim()})}):m.map((I,H)=>a.jsx(Cut,{result:I,agentLabel:r,onOpen:s,locale:c},H)):a.jsx("div",{className:"search-empty",children:o(u==="web"?"search.instructions.web":u==="knowledge"?"search.instructions.knowledge":u==="memory"?"search.instructions.memory":"search.instructions.session")}):a.jsx("div",{className:"search-empty",children:t?i?o("search.loadingCapabilities"):(_==null?void 0:_.unavailableLabel)??o("search.sourceUnavailable"):o("search.noAgentHint")})})]})}function Cut({result:e,agentLabel:t,onOpen:n,locale:i}){const{t:r}=Ae("workspaceTools");switch(e.type){case"session":return a.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[a.jsx(AAe,{className:"search-result-icon"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:e.title}),a.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${dZ(e.ts,i)}`:""]})]}),a.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return a.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[a.jsx(tP,{className:"search-result-icon"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:e.title||e.url}),a.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&a.jsx(my,{className:"search-result-ext"})]})]}),e.summary&&a.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return a.jsxs("div",{className:"search-result search-result-static",children:[a.jsx(fZ,{source:"knowledge"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:r("search.knowledgeFragment",{index:e.index+1})}),a.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${wN(e.sourceType,r)}`:""]})]}),a.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return a.jsxs("div",{className:"search-result search-result-static",children:[a.jsx(fZ,{source:"memory"}),a.jsxs("div",{className:"search-result-body",children:[a.jsxs("div",{className:"search-result-head",children:[a.jsx("span",{className:"search-result-title",children:r("search.memoryFragment",{index:e.index+1})}),a.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${wN(e.sourceType,r)}`:"",e.ts?` · ${dZ(e.ts,i)}`:""]})]}),a.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function fZ({source:e,className:t="search-result-icon"}){return e==="knowledge"?a.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[a.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),a.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):a.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[a.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),a.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function Tut({filled:e=!1,...t}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[a.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),a.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Aut({filled:e=!1,...t}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[a.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),a.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function ije(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),a.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),a.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),a.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),a.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const pP="/assets/media/logo-DCsNZy-k.svg",QQ="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e";function _ut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M8.5 4.5H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-13a2 2 0 0 0-2-2h-2.5"}),a.jsx("rect",{x:"8.5",y:"2.5",width:"7",height:"4",rx:"1.5"}),a.jsx("path",{d:"m8 13 2.5 2.5L16 10"})]})}const hZ="(max-width: 860px)";function pZ({title:e}){const t=p.useRef(null),n=p.useRef(null),[i,r]=p.useState(0);p.useLayoutEffect(()=>{const l=t.current,c=n.current;if(!l||!c)return;const u=()=>{const f=Math.max(0,Math.ceil(c.scrollWidth-l.clientWidth));r(h=>h===f?h:f)};u();const d=new ResizeObserver(u);return d.observe(l),d.observe(c),()=>d.disconnect()},[e]);const s=Math.min(12,Math.max(4.8,3.6+i/36)),o={"--history-title-translate":`-${i}px`,"--history-title-duration":`${s.toFixed(2)}s`};return a.jsx("span",{ref:t,className:`history-title${i>0?" is-overflowing":""}`,style:o,children:a.jsx("span",{ref:n,className:"history-title-text",children:e})})}function jut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),a.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),a.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),a.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Nut(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"12",cy:"12",r:"8.25"}),a.jsx("path",{d:"M3.75 12h16.5M12 3.75c2.1 2.2 3.2 4.95 3.2 8.25S14.1 18.05 12 20.25M12 3.75C9.9 5.95 8.8 8.7 8.8 12s1.1 6.05 3.2 8.25"})]})}function Rut(e){let t=2166136261;for(const i of e)t^=i.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Iut={super_admin:"account.roles.super_admin",admin:"account.roles.admin",developer:"account.roles.developer",user:"account.roles.user"};function Put({activePage:e,access:t,userInfo:n,onAgentKitCli:i,onDeveloperResources:r,onSystemInfo:s,onIssueFeedback:o,onLogout:l}){const{t:c,i18n:u}=Ae(["sidebar","common"]),[d,f]=p.useState("");if(!n)return null;const h=FXe(n)||c("sidebar:account.defaultUser"),m=typeof n.email=="string"?n.email.trim():"",g=Rut(h),b=BXe(n),v=b===d?"":b,y=WE(u.resolvedLanguage??u.language)??qE;return a.jsx("div",{className:"sidebar-user",children:a.jsxs("div",{className:"sidebar-user-row",children:[a.jsxs(Pr,{modal:!0,children:[a.jsx(Pr.Trigger,{children:a.jsxs("button",{type:"button",className:"sidebar-user-btn",title:h,children:[a.jsx("span",{className:`account-avatar${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?a.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),a.jsx("span",{className:"sidebar-user-identity",children:a.jsx("span",{className:"sidebar-user-name",children:h})})]})}),a.jsxs(Pr.Content,{side:"top",align:"start",sideOffset:4,minWidth:216,children:[a.jsxs("div",{className:"account-menu-head",children:[a.jsx("span",{className:`account-avatar account-avatar--lg${v?" has-image":""}`,style:g,"aria-hidden":"true",children:v?a.jsx("img",{className:"account-avatar-image",src:v,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(v)}):null}),a.jsxs("div",{className:"account-id",children:[a.jsxs("div",{className:"account-name-row",children:[a.jsx("div",{className:"account-name",children:h}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:c(`sidebar:${Iut[t.role]}`)})]}),m&&m!==h&&a.jsx("div",{className:"account-sub",children:m})]})]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:s,children:[a.jsx(Uf,{className:"icon","aria-hidden":"true"}),c("sidebar:account.systemInfo")]}),a.jsxs(Pr.Sub,{children:[a.jsx(Pr.SubTrigger,{className:"account-menu-action",children:a.jsxs("span",{className:"account-menu-action__label",children:[a.jsx(Nut,{className:"icon"}),c("sidebar:account.language")]})}),a.jsx(Pr.SubContent,{sideOffset:6,minWidth:136,children:a.jsx(Pr.RadioGroup,{value:y,onChange:x=>{ZQe(x)},indicatorPosition:"end",children:b9.map(x=>a.jsx(Pr.RadioItem,{value:x,children:c(`common:languageNames.${x}`)},x))})})]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:o,children:[a.jsx(ije,{className:"icon"}),c("sidebar:account.issueFeedback")]}),a.jsxs(Pr.Item,{className:"account-menu-action",onSelect:l,children:[a.jsx(uit,{className:"icon","aria-hidden":"true"}),c("sidebar:account.logout")]})]})]}),a.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":c("sidebar:account.shortcuts"),children:[a.jsx(uo,{compact:!0,content:c("sidebar:account.tryCli"),children:a.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:i,"aria-label":c("sidebar:account.tryCli"),children:a.jsx(Ant,{className:"icon"})})}),a.jsx(uo,{compact:!0,content:c("sidebar:account.developerResources"),children:a.jsx("button",{type:"button",className:`sidebar-user-shortcut${e==="developer-resources"?" is-active":""}`,onClick:r,"aria-label":c("sidebar:account.developerResources"),"aria-current":e==="developer-resources"?"page":void 0,children:a.jsx(gnt,{className:"icon"})})})]})]})})}function Dut({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:o,streamingSids:l,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:m,onReviewCenter:g,onAddAgent:b,onMyAgents:v,onWorkspace:y,onApplications:x,onCronJobs:w,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onUserManagement:C,onIssueFeedback:E,onPickSession:R,onDeleteSession:_,userInfo:j,onLogout:T}){const{t:N}=Ae("sidebar"),A=V=>(s==null?void 0:s[V])!==!1,P=o.role==="admin"||o.role==="super_admin",D=o.capabilities.manageUsers&&!!C,[M,L]=p.useState(null),U=p.useRef(typeof window<"u"&&window.matchMedia(hZ).matches),[I,H]=p.useState(U.current),K=n.map(V=>({id:V.id,title:iP(V.events,N("history.newConversation")),createdAt:(V.lastUpdateTime??0)*1e3})).sort((V,X)=>X.createdAt-V.createdAt),F=()=>{U.current=!1,H(V=>!V),L(null)};p.useEffect(()=>{const V=window.matchMedia(hZ),X=ie=>{ie.matches?H(Q=>Q||(U.current=!0,!0)):U.current&&(U.current=!1,H(!1))};return V.addEventListener("change",X),()=>V.removeEventListener("change",X)},[]);const W=t==="byteplus"?QQ:pP;return a.jsxs("aside",{className:`sidebar ${I?"is-collapsed":""}`,children:[a.jsxs("div",{className:"sidebar-top",children:[a.jsxs("div",{className:"sidebar-brand-row",children:[a.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":N("navigation.home"),title:N("navigation.home"),children:[a.jsx("img",{className:"brand-logo",src:e.logoUrl||W,width:20,height:20,alt:"","aria-hidden":!0}),a.jsx("span",{className:"brand-title",children:e.title})]}),a.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:F,"aria-label":N(I?"navigation.expand":"navigation.collapse"),title:N(I?"navigation.expand":"navigation.collapse"),children:I?a.jsx(but,{className:"icon"}):a.jsx(gut,{className:"icon"})})]}),a.jsxs("nav",{className:"sidebar-nav","aria-label":N("navigation.label"),children:[A("newChat")&&a.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":N("navigation.newChat"),"aria-current":r==="new-chat"?"page":void 0,title:N("navigation.newChat"),children:[a.jsx(yut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.newChat")})]}),A("search")&&a.jsx(kut,{active:r==="search",onClick:f}),a.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:v,"aria-label":N("navigation.agents"),"aria-current":r==="agents"?"page":void 0,title:N("navigation.agents"),children:[a.jsx(xut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.agents")})]}),a.jsxs("button",{className:`new-chat new-chat--workspaces${r==="workspaces"?" is-active":""}`,onClick:y,"aria-label":N("navigation.workspaces"),"aria-current":r==="workspaces"?"page":void 0,title:N("navigation.workspaces"),children:[a.jsx(Vnt,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.workspaces")})]}),a.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:m,"aria-label":N("navigation.library"),"aria-current":r==="library"?"page":void 0,title:N("navigation.library"),children:[a.jsx(tje,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.library")})]}),a.jsxs("button",{className:`new-chat new-chat--cronjobs${r==="cronjobs"?" is-active":""}`,onClick:w,"aria-label":N("navigation.cronjobs"),"aria-current":r==="cronjobs"?"page":void 0,title:N("navigation.cronjobs"),children:[a.jsx(XU,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.cronjobs")})]}),a.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:x,"aria-label":N("navigation.automations"),"aria-current":r==="applications"?"page":void 0,title:N("navigation.automations"),children:[a.jsx(jut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.automations")})]})]}),P||D?a.jsxs("nav",{className:"sidebar-nav sidebar-nav--administration","aria-label":N("navigation.administration"),children:[a.jsx("div",{className:"sidebar-nav-group-title","aria-hidden":"true",children:N("navigation.administration")}),P?a.jsxs("button",{type:"button",className:`new-chat new-chat--review-center${r==="review-center"?" is-active":""}`,onClick:g,"aria-label":N("navigation.reviewCenter"),"aria-current":r==="review-center"?"page":void 0,title:N("navigation.reviewCenter"),children:[a.jsx(_ut,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.reviewCenter")})]}):null,D?a.jsxs("button",{type:"button",className:`new-chat${r==="users"?" is-active":""}`,onClick:C,"aria-label":N("navigation.users"),"aria-current":r==="users"?"page":void 0,title:N("navigation.users"),children:[a.jsx(Zit,{className:"icon"}),a.jsx("span",{className:"sidebar-nav-label",children:N("navigation.users")})]}):null]}):null]}),A("history")&&a.jsxs("div",{className:"sidebar-history",children:[a.jsxs("div",{className:"history-head",children:[a.jsx("span",{children:N("history.title")}),A("newChat")&&a.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":N("history.create"),title:N("history.create"),children:a.jsx(Tl,{className:"icon"})})]}),a.jsx("div",{className:"history-list",children:u?a.jsxs(a.Fragment,{children:[u.loading&&u.threads.length===0?a.jsx("div",{className:"history-empty",role:"status",children:N("history.loading")}):null,u.error?a.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?a.jsx("div",{className:"history-empty",children:N("history.empty")}):null,u.threads.map(V=>{const X=V.id===u.currentThreadId,ie=V.name||V.preview||`Thread ${V.id.slice(0,8)}`,Q=V.id===u.busyThreadId;return a.jsxs("div",{className:`history-item ${X?"active":""}`,children:[a.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(V.id),"aria-current":X?"page":void 0,title:ie,disabled:Q,children:[a.jsx(pZ,{title:ie}),X?a.jsx("span",{className:"history-current-badge",children:N("history.current")}):null]}),a.jsx("button",{type:"button",className:"history-more","aria-label":N("history.manage",{title:ie}),title:N("history.more"),disabled:Q,onClick:()=>L(Z=>Z===V.id?null:V.id),children:a.jsx(DY,{className:"icon"})}),M===V.id?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),a.jsx("div",{className:"history-menu",children:a.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),u.onDelete(V)},children:[a.jsx(rg,{className:"icon"})," ",N("history.delete")]})})]}):null]},V.id)}),u.hasMore?a.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?N("history.loadingMore"):N("history.loadMore")}):null]}):a.jsxs(a.Fragment,{children:[K.length===0?a.jsx("div",{className:"history-empty",children:N("history.empty")}):null,K.map(V=>{const X=V.id===i,ie=(l==null?void 0:l.has(V.id))===!0,Q=!ie&&(c==null?void 0:c.has(V.id))===!0;return a.jsxs("div",{className:`history-item ${X?"active":""}`,children:[a.jsxs("button",{className:"history-item-btn",onClick:()=>R(V.id),"aria-current":X?"page":void 0,title:V.title,children:[a.jsx(pZ,{title:V.title}),Q&&a.jsxs("span",{className:"history-evaluating-status",title:N("history.evaluatingTitle"),children:[a.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),N("history.evaluating")]})]}),a.jsxs("div",{className:"history-action-slot",children:[ie?a.jsx(yC,{className:"history-streaming-indicator",size:12,role:"status","aria-label":N("history.generating")}):null,a.jsx("button",{type:"button",className:"history-more","aria-label":N("history.manage",{title:V.title}),title:N("history.more"),onClick:()=>L(Z=>Z===V.id?null:V.id),children:a.jsx(DY,{className:"icon"})})]}),M===V.id&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),a.jsx("div",{className:"history-menu",children:a.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),_(V.id)},children:[a.jsx(rg,{className:"icon"})," ",N("history.delete")]})})]})]},V.id)})]})})]}),a.jsx("div",{className:"sidebar-footer",children:a.jsx(Put,{activePage:r,access:o,userInfo:j,onAgentKitCli:O,onDeveloperResources:S,onSystemInfo:k,onIssueFeedback:E,onLogout:T})})]})}function Mo(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n{}};function mP(){for(var e=0,t=arguments.length,n={},i;e=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}L_.prototype=mP.prototype={constructor:L_,on:function(e,t){var n=this._,i=Lut(e+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s0)for(var n=new Array(r),i=0,r,s;i=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),gZ.hasOwnProperty(t)?{space:gZ[t],local:e}:e}function Fut(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===OF&&t.documentElement.namespaceURI===OF?t.createElement(e):t.createElementNS(n,e)}}function But(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rje(e){var t=gP(e);return(t.local?But:Fut)(t)}function Uut(){}function zQ(e){return e==null?Uut:function(){return this.querySelector(e)}}function Qut(e){typeof e!="function"&&(e=zQ(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r=w&&(w=x+1);!(S=v[w])&&++w=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function hdt(e){e||(e=pdt);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,r=new Array(i),s=0;st?1:e>=t?0:NaN}function mdt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gdt(){return Array.from(this)}function bdt(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Adt:typeof t=="function"?jdt:_dt)(e,t,n??"")):Zx(this.node(),e)}function Zx(e,t){return e.style.getPropertyValue(t)||cje(e).getComputedStyle(e,null).getPropertyValue(t)}function Rdt(e){return function(){delete this[e]}}function Idt(e,t){return function(){this[e]=t}}function Pdt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ddt(e,t){return arguments.length>1?this.each((t==null?Rdt:typeof t=="function"?Pdt:Idt)(e,t)):this.node()[e]}function uje(e){return e.trim().split(/^|\s+/)}function VQ(e){return e.classList||new dje(e)}function dje(e){this._node=e,this._names=uje(e.getAttribute("class")||"")}dje.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function fje(e,t){for(var n=VQ(e),i=-1,r=t.length;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function cft(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n()=>e;function kF(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:o,y:l,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}kF.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function vft(e){return!e.ctrlKey&&!e.button}function xft(){return this.parentNode}function wft(e,t){return t??{x:e.x,y:e.y}}function Oft(){return navigator.maxTouchPoints||"ontouchstart"in this}function yje(){var e=vft,t=xft,n=wft,i=Oft,r={},s=mP("start","drag","end"),o=0,l,c,u,d,f=0;function h(O){O.on("mousedown.drag",m).filter(i).on("touchstart.drag",v).on("touchmove.drag",y,yft).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(O,S){if(!(d||!e.call(this,O,S))){var k=w(this,t.call(this,O,S),O,S,"mouse");k&&(zc(O.view).on("mousemove.drag",g,WS).on("mouseup.drag",b,WS),gje(O.view),o5(O),u=!1,l=O.clientX,c=O.clientY,k("start",O))}}function g(O){if(sx(O),!u){var S=O.clientX-l,k=O.clientY-c;u=S*S+k*k>f}r.mouse("drag",O)}function b(O){zc(O.view).on("mousemove.drag mouseup.drag",null),bje(O.view,u),sx(O),r.mouse("end",O)}function v(O,S){if(e.call(this,O,S)){var k=O.changedTouches,C=t.call(this,O,S),E=k.length,R,_;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?IA(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?IA(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Sft.exec(e))?new nc(t[1],t[2],t[3],1):(t=Eft.exec(e))?new nc(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cft.exec(e))?IA(t[1],t[2],t[3],t[4]):(t=Tft.exec(e))?IA(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Aft.exec(e))?kZ(t[1],t[2]/100,t[3]/100,1):(t=_ft.exec(e))?kZ(t[1],t[2]/100,t[3]/100,t[4]):bZ.hasOwnProperty(e)?xZ(bZ[e]):e==="transparent"?new nc(NaN,NaN,NaN,0):null}function xZ(e){return new nc(e>>16&255,e>>8&255,e&255,1)}function IA(e,t,n,i){return i<=0&&(e=t=n=NaN),new nc(e,t,n,i)}function Rft(e){return e instanceof AC||(e=by(e)),e?(e=e.rgb(),new nc(e.r,e.g,e.b,e.opacity)):new nc}function SF(e,t,n,i){return arguments.length===1?Rft(e):new nc(e,t,n,i??1)}function nc(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}HQ(nc,SF,vje(AC,{brighter(e){return e=e==null?kN:Math.pow(kN,e),new nc(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?KS:Math.pow(KS,e),new nc(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nc(Zb(this.r),Zb(this.g),Zb(this.b),SN(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wZ,formatHex:wZ,formatHex8:Ift,formatRgb:OZ,toString:OZ}));function wZ(){return`#${Rb(this.r)}${Rb(this.g)}${Rb(this.b)}`}function Ift(){return`#${Rb(this.r)}${Rb(this.g)}${Rb(this.b)}${Rb((isNaN(this.opacity)?1:this.opacity)*255)}`}function OZ(){const e=SN(this.opacity);return`${e===1?"rgb(":"rgba("}${Zb(this.r)}, ${Zb(this.g)}, ${Zb(this.b)}${e===1?")":`, ${e})`}`}function SN(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zb(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Rb(e){return e=Zb(e),(e<16?"0":"")+e.toString(16)}function kZ(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xd(e,t,n,i)}function xje(e){if(e instanceof xd)return new xd(e.h,e.s,e.l,e.opacity);if(e instanceof AC||(e=by(e)),!e)return new xd;if(e instanceof xd)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,l=s-r,c=(s+r)/2;return l?(t===s?o=(n-i)/l+(n0&&c<1?0:o,new xd(o,l,c,e.opacity)}function Pft(e,t,n,i){return arguments.length===1?xje(e):new xd(e,t,n,i??1)}function xd(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}HQ(xd,Pft,vje(AC,{brighter(e){return e=e==null?kN:Math.pow(kN,e),new xd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?KS:Math.pow(KS,e),new xd(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new nc(a5(e>=240?e-240:e+120,r,i),a5(e,r,i),a5(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new xd(SZ(this.h),PA(this.s),PA(this.l),SN(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=SN(this.opacity);return`${e===1?"hsl(":"hsla("}${SZ(this.h)}, ${PA(this.s)*100}%, ${PA(this.l)*100}%${e===1?")":`, ${e})`}`}}));function SZ(e){return e=(e||0)%360,e<0?e+360:e}function PA(e){return Math.max(0,Math.min(1,e||0))}function a5(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bP=e=>()=>e;function wje(e,t){return function(n){return e+n*t}}function Dft(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function Ean(e,t){var n=t-e;return n?wje(e,n>180||n<-180?n-360*Math.round(n/360):n):bP(isNaN(e)?t:e)}function Mft(e){return(e=+e)==1?Oje:function(t,n){return n-t?Dft(t,n,e):bP(isNaN(t)?n:t)}}function Oje(e,t){var n=t-e;return n?wje(e,n):bP(isNaN(e)?t:e)}const EN=function e(t){var n=Mft(t);function i(r,s){var o=n((r=SF(r)).r,(s=SF(s)).r),l=n(r.g,s.g),c=n(r.b,s.b),u=Oje(r.opacity,s.opacity);return function(d){return r.r=o(d),r.g=l(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function Lft(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;rn&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(i=i[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,c.push({i:o,x:lf(i,r)})),n=l5.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:lf(u,d)})):d&&f.push(r(f)+"rotate("+d+i)}function l(u,d,f,h){u!==d?h.push({i:f.push(r(f)+"skewX(",null,i)-2,x:lf(u,d)}):d&&f.push(r(f)+"skewX("+d+i)}function c(u,d,f,h,m,g){if(u!==f||d!==h){var b=m.push(r(m)+"scale(",null,",",null,")");g.push({i:b-4,x:lf(u,f)},{i:b-2,x:lf(d,h)})}else(f!==1||h!==1)&&m.push(r(m)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(m){for(var g=-1,b=h.length,v;++g=0&&e._call.call(void 0,t),e=e._next;--Jx}function TZ(){yy=(TN=XS.now())+yP,Jx=HO=0;try{Zft()}finally{Jx=0,eht(),yy=0}}function Jft(){var e=XS.now(),t=e-TN;t>Cje&&(yP-=t,TN=e)}function eht(){for(var e,t=CN,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:CN=n);qO=e,TF(i)}function TF(e){if(!Jx){HO&&(HO=clearTimeout(HO));var t=e-yy;t>24?(e<1/0&&(HO=setTimeout(TZ,e-XS.now()-yP)),eO&&(eO=clearInterval(eO))):(eO||(TN=XS.now(),eO=setInterval(Jft,Cje)),Jx=1,Tje(TZ))}}function AZ(e,t,n){var i=new AN;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var tht=mP("start","end","cancel","interrupt"),nht=[],_je=0,_Z=1,AF=2,F_=3,jZ=4,_F=5,B_=6;function vP(e,t,n,i,r,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;iht(e,n,{name:t,index:i,group:r,on:tht,tween:nht,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:_je})}function WQ(e,t){var n=$d(e,t);if(n.state>_je)throw new Error("too late; already scheduled");return n}function zf(e,t){var n=$d(e,t);if(n.state>F_)throw new Error("too late; already running");return n}function $d(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function iht(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=Aje(s,0,n.time);function s(u){n.state=_Z,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,m;if(n.state!==_Z)return c();for(d in i)if(m=i[d],m.name===n.name){if(m.state===F_)return AZ(o);m.state===jZ?(m.state=B_,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[d]):+dAF&&i.state<_F,i.state=B_,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[o]}s&&delete e.__transition}}function rht(e){return this.each(function(){U_(this,e)})}function sht(e,t){var n,i;return function(){var r=zf(this,e),s=r.tween;if(s!==n){i=n=s;for(var o=0,l=i.length;o=0&&(t=t.slice(0,n)),!t||t==="start"})}function Iht(e,t,n){var i,r,s=Rht(t)?WQ:zf;return function(){var o=s(this,e),l=o.on;l!==i&&(r=(i=l).copy()).on(t,n),o.on=r}}function Pht(e,t){var n=this._id;return arguments.length<2?$d(this.node(),n).on.on(e):this.each(Iht(n,e,t))}function Dht(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Mht(){return this.on("end.remove",Dht(this._id))}function Lht(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zQ(e));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o()=>e;function lpt(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function $h(e,t,n){this.k=e,this.x=t,this.y=n}$h.prototype={constructor:$h,scale:function(e){return e===1?this:new $h(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $h(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var xP=new $h(1,0,0);Ije.prototype=$h.prototype;function Ije(e){for(;!e.__zoom;)if(!(e=e.parentNode))return xP;return e.__zoom}function c5(e){e.stopImmediatePropagation()}function tO(e){e.preventDefault(),e.stopImmediatePropagation()}function cpt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function upt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function NZ(){return this.__zoom||xP}function dpt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fpt(){return navigator.maxTouchPoints||"ontouchstart"in this}function hpt(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function Pje(){var e=cpt,t=upt,n=hpt,i=dpt,r=fpt,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=$_,u=mP("start","zoom","end"),d,f,h,m=500,g=150,b=0,v=10;function y(A){A.property("__zoom",NZ).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",_).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(A,P,D,M){var L=A.selection?A.selection():A;L.property("__zoom",NZ),A!==L?S(A,P,D,M):L.interrupt().each(function(){k(this,arguments).event(M).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(A,P,D,M){y.scaleTo(A,function(){var L=this.__zoom.k,U=typeof P=="function"?P.apply(this,arguments):P;return L*U},D,M)},y.scaleTo=function(A,P,D,M){y.transform(A,function(){var L=t.apply(this,arguments),U=this.__zoom,I=D==null?O(L):typeof D=="function"?D.apply(this,arguments):D,H=U.invert(I),K=typeof P=="function"?P.apply(this,arguments):P;return n(w(x(U,K),I,H),L,o)},D,M)},y.translateBy=function(A,P,D,M){y.transform(A,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),o)},null,M)},y.translateTo=function(A,P,D,M,L){y.transform(A,function(){var U=t.apply(this,arguments),I=this.__zoom,H=M==null?O(U):typeof M=="function"?M.apply(this,arguments):M;return n(xP.translate(H[0],H[1]).scale(I.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof D=="function"?-D.apply(this,arguments):-D),U,o)},M,L)};function x(A,P){return P=Math.max(s[0],Math.min(s[1],P)),P===A.k?A:new $h(P,A.x,A.y)}function w(A,P,D){var M=P[0]-D[0]*A.k,L=P[1]-D[1]*A.k;return M===A.x&&L===A.y?A:new $h(A.k,M,L)}function O(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function S(A,P,D,M){A.on("start.zoom",function(){k(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(M).end()}).tween("zoom",function(){var L=this,U=arguments,I=k(L,U).event(M),H=t.apply(L,U),K=D==null?O(H):typeof D=="function"?D.apply(L,U):D,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),W=L.__zoom,V=typeof P=="function"?P.apply(L,U):P,X=c(W.invert(K).concat(F/W.k),V.invert(K).concat(F/V.k));return function(ie){if(ie===1)ie=V;else{var Q=X(ie),Z=F/Q[2];ie=new $h(Z,K[0]-Q[0]*Z,K[1]-Q[1]*Z)}I.zoom(null,ie)}})}function k(A,P,D){return!D&&A.__zooming||new C(A,P)}function C(A,P){this.that=A,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,P),this.taps=0}C.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,P){return this.mouse&&A!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var P=zc(this.that).datum();u.call(A,this.that,new lpt(A,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),P)}};function E(A,...P){if(!e.apply(this,arguments))return;var D=k(this,P).event(A),M=this.__zoom,L=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,i.apply(this,arguments)))),U=gd(A);if(D.wheel)(D.mouse[0][0]!==U[0]||D.mouse[0][1]!==U[1])&&(D.mouse[1]=M.invert(D.mouse[0]=U)),clearTimeout(D.wheel);else{if(M.k===L)return;D.mouse=[U,M.invert(U)],U_(this),D.start()}tO(A),D.wheel=setTimeout(I,g),D.zoom("mouse",n(w(x(M,L),D.mouse[0],D.mouse[1]),D.extent,o));function I(){D.wheel=null,D.end()}}function R(A,...P){if(h||!e.apply(this,arguments))return;var D=A.currentTarget,M=k(this,P,!0).event(A),L=zc(A.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",F,!0),U=gd(A,D),I=A.clientX,H=A.clientY;gje(A.view),c5(A),M.mouse=[U,this.__zoom.invert(U)],U_(this),M.start();function K(W){if(tO(W),!M.moved){var V=W.clientX-I,X=W.clientY-H;M.moved=V*V+X*X>b}M.event(W).zoom("mouse",n(w(M.that.__zoom,M.mouse[0]=gd(W,D),M.mouse[1]),M.extent,o))}function F(W){L.on("mousemove.zoom mouseup.zoom",null),bje(W.view,M.moved),tO(W),M.event(W).end()}}function _(A,...P){if(e.apply(this,arguments)){var D=this.__zoom,M=gd(A.changedTouches?A.changedTouches[0]:A,this),L=D.invert(M),U=D.k*(A.shiftKey?.5:2),I=n(w(x(D,U),M,L),t.apply(this,P),o);tO(A),l>0?zc(this).transition().duration(l).call(S,I,M,A):zc(this).call(y.transform,I,M,A)}}function j(A,...P){if(e.apply(this,arguments)){var D=A.touches,M=D.length,L=k(this,P,A.changedTouches.length===M).event(A),U,I,H,K;for(c5(A),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},YS=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Dje=["Enter"," ","Escape"],Mje={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ew;(function(e){e.Strict="strict",e.Loose="loose"})(ew||(ew={}));var Jb;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Jb||(Jb={}));var ZS;(function(e){e.Partial="partial",e.Full="full"})(ZS||(ZS={}));const Lje={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var mm;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(mm||(mm={}));var JS;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(JS||(JS={}));var pn;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(pn||(pn={}));const RZ={[pn.Left]:pn.Right,[pn.Right]:pn.Left,[pn.Top]:pn.Bottom,[pn.Bottom]:pn.Top};function $je(e){return e===null?null:e?"valid":"invalid"}const Fje=e=>"id"in e&&"source"in e&&"target"in e,ppt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),GQ=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_C=(e,t=[0,0])=>{const{width:n,height:i}=Cp(e),r=e.origin??t,s=n*r[0],o=i*r[1];return{x:e.position.x-s,y:e.position.y-o}},mpt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,r)=>{const s=typeof r=="string";let o=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(r):GQ(r)?r:t.nodeLookup.get(r.id));const l=o?_N(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return wP(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return OP(n)},jC=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=wP(n,_N(r)),i=!0)}),i?OP(n):{x:0,y:0,width:0,height:0}},XQ=(e,t,[n,i,r]=[0,0,1],s=!1,o=!1)=>{const l={...Kw(t,[n,i,r]),width:t.width/r,height:t.height/r},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(o&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=eE(l,nw(u)),v=(m??0)*(g??0),y=s&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},gpt=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function bpt(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!i||i.has(r.id))&&n.set(r.id,r)}),n}async function ypt({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},o){if(e.size===0)return!0;const l=bpt(e,o),c=jC(l),u=ZQ(c,t,n,(o==null?void 0:o.minZoom)??r,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await i.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function Bje({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=o.origin??i;let f=o.extent||r;if(o.extent==="parent"&&!o.expandParent)if(!l)s==null||s("005",Rd.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&xy(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=xy(f)?vy(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",Rd.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function vpt({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&o.find(b=>b.id===h.parentId);(m||g)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=gpt(o,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!r)return{edges:d,nodes:o};const f=await r({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const tw=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),vy=(e={x:0,y:0},t,n)=>({x:tw(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:tw(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Uje(e,t,n){const{width:i,height:r}=Cp(n),{x:s,y:o}=n.internals.positionAbsolute;return vy(e,[[s,o],[s+i,o+r]],t)}const IZ=(e,t,n)=>en?-tw(Math.abs(e-n),1,t)/t:0,YQ=(e,t,n=15,i=40)=>{const r=IZ(e.x,i,t.width-i)*n,s=IZ(e.y,i,t.height-i)*n;return[r,s]},wP=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),jF=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),OP=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),nw=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=GQ(e)?e.internals.positionAbsolute:_C(e,t);return{x:n,y:i,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},_N=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=GQ(e)?e.internals.positionAbsolute:_C(e,t);return{x:n,y:i,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:i+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Qje=(e,t)=>OP(wP(jF(e),jF(t))),eE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},PZ=e=>Od(e.width)&&Od(e.height)&&Od(e.x)&&Od(e.y),Od=e=>!isNaN(e)&&isFinite(e),zje=(e,t)=>(n,i)=>{},NC=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kw=({x:e,y:t},[n,i,r],s=!1,o=[1,1])=>{const l={x:(e-n)/r,y:(t-i)/r};return s?NC(l,o):l},iw=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function B0(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xpt(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=B0(e,n),r=B0(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=B0(e.top??e.y??0,n),r=B0(e.bottom??e.y??0,n),s=B0(e.left??e.x??0,t),o=B0(e.right??e.x??0,t);return{top:i,right:o,bottom:r,left:s,x:s+o,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function wpt(e,t,n,i,r,s){const{x:o,y:l}=iw(e,[t,n,i]),{x:c,y:u}=iw({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const ZQ=(e,t,n,i,r,s)=>{const o=xpt(s,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=tw(u,i,r),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*d,g=n/2-h*d,b=wpt(e,m,g,d,t,n),v={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:d}},tE=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function xy(e){return e!=null&&e!=="parent"}function Cp(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function JQ(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Vje(e,t={width:0,height:0},n,i,r){const s={...e},o=i.get(n);if(o){const l=o.origin||r;s.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function DZ(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Opt(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function kpt(e){return{...Mje,...e||{}}}function Fk(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:o}=kd(e),l=Kw({x:s-((r==null?void 0:r.left)??0),y:o-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?NC(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const ez=e=>({width:e.offsetWidth,height:e.offsetHeight}),Hje=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Spt=["INPUT","SELECT","TEXTAREA"];function qje(e){var i,r;const t=((r=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Spt.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Wje=e=>"clientX"in e,kd=(e,t)=>{var s,o;const n=Wje(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},MZ=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:r,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/i,y:(l.top-n.top)/i,...ez(o)}})};function Kje({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:o,targetControlY:l}){const c=e*.125+r*.375+o*.375+n*.125,u=t*.125+s*.375+l*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function LA(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function LZ({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case pn.Left:return[t-LA(t-i,s),n];case pn.Right:return[t+LA(i-t,s),n];case pn.Top:return[t,n-LA(n-r,s)];case pn.Bottom:return[t,n+LA(r-n,s)]}}function Gje({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top,curvature:o=.25}){const[l,c]=LZ({pos:n,x1:e,y1:t,x2:i,y2:r,c:o}),[u,d]=LZ({pos:s,x1:i,y1:r,x2:e,y2:t,c:o}),[f,h,m,g]=Kje({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${i},${r}`,f,h,m,g]}function Xje({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n0}const Tpt=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,Apt=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),_pt=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Rd.error006()),t;const i=n.getEdgeId||Tpt;let r;return Fje(e)?r={...e}:r={...e,id:i(e)},Apt(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Yje({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,o,l]=Xje({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,o,l]}const $Z={[pn.Left]:{x:-1,y:0},[pn.Right]:{x:1,y:0},[pn.Top]:{x:0,y:-1},[pn.Bottom]:{x:0,y:1}},jpt=({source:e,sourcePosition:t=pn.Bottom,target:n})=>t===pn.Left||t===pn.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Npt({source:e,sourcePosition:t=pn.Bottom,target:n,targetPosition:i=pn.Top,center:r,offset:s,stepPosition:o}){const l=$Z[t],c=$Z[i],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=jpt({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",m=f[h];let g=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,w,O]=Xje({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=r.x??u.x+(d.x-u.x)*o,v=r.y??(u.y+d.y)/2):(b=r.x??(u.x+d.x)/2,v=r.y??u.y+(d.y-u.y)*o);const E=[{x:b,y:u.y},{x:b,y:d.y}],R=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===m?g=h==="x"?E:R:g=h==="x"?R:E}else{const E=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?R:E:g=l.y===m?E:R,t===i){const A=Math.abs(e[h]-n[h]);if(A<=s){const P=Math.min(s-1,s-A);l[h]===m?y[h]=(u[h]>e[h]?-1:1)*P:x[h]=(d[h]>n[h]?-1:1)*P}}if(t!==i){const A=h==="x"?"y":"x",P=l[h]===c[A],D=u[A]>d[A],M=u[A]=N?(b=(_.x+j.x)/2,v=g[0].y):(b=g[0].x,v=(_.y+j.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},k={x:d.x+x.x,y:d.y+x.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],b,v,w,O]}function Rpt(e,t,n,i){const r=Math.min(FZ(e,t)/2,FZ(t,n)/2,i),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const u=e.xn.id===t):e[0])||null}function NF(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function Ppt(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((o,l)=>([l.markerStart||i,l.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=NF(c,t);s.has(u)||(o.push({id:u,color:c.color||n,...c}),s.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const Zje=1e3,Dpt=10,tz={nodeOrigin:[0,0],nodeExtent:YS,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mpt={...tz,checkEquality:!0};function nz(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function Lpt(e,t,n){const i=nz(tz,n);for(const r of e.values())if(r.parentId)rz(r,e,t,i);else{const s=_C(r,i.nodeOrigin),o=xy(r.extent)?r.extent:i.nodeExtent,l=vy(s,o,Cp(r));r.internals.positionAbsolute=l}}function $pt(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&i.push(s)}return{source:n,target:i}}function iz(e){return e==="manual"}function RF(e,t,n,i={}){var d,f;const r=nz(Mpt,i),s={i:0},o=new Map(t),l=r!=null&&r.elevateNodesOnSelect&&!iz(r.zIndexMode)?Zje:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=o.get(h.id);if(r.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=_C(h,r.nodeOrigin),b=xy(h.extent)?h.extent:r.nodeExtent,v=vy(g,b,Cp(h));m={...r.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:v,handleBounds:$pt(h,m),z:Jje(h,l,r.zIndexMode),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),h.parentId&&rz(m,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Fpt(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function rz(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=nz(tz,i),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Fpt(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Dpt),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!iz(c)?Zje:0,{x:h,y:m,z:g}=Bpt(e,d,o,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||m!==b.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:m}:b,z:g}})}function Jje(e,t,n){const i=Od(e.zIndex)?e.zIndex:0;return iz(n)?i:i+(e.selected?t:0)}function Bpt(e,t,n,i,r,s){const{x:o,y:l}=t.internals.positionAbsolute,c=Cp(e),u=_C(e,n),d=xy(e.extent)?vy(u,e.extent,c):u;let f=vy({x:o+d.x,y:l+d.y},i,c);e.extent==="parent"&&(f=Uje(f,c,t));const h=Jje(e,r,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function sz(e,t,n,i=[0,0]){var o;const r=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=s.get(l.parentId))==null?void 0:o.expandedRect)??nw(c),d=Qje(u,l.rect);s.set(l.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var w;const d=c.internals.positionAbsolute,f=Cp(c),h=c.origin??i,m=l.x0||g>0||y||x)&&(r.push({id:u,type:"position",position:{x:c.position.x-m+y,y:c.position.y-g+x}}),(w=n.get(u))==null||w.forEach(O=>{e.some(S=>S.id===O.id)||r.push({id:O.id,type:"position",position:{x:O.position.x+m,y:O.position.y+g}})})),(f.width0){const m=sz(h,t,n,r);u.push(...m)}return{changes:u,updatedInternals:c}}async function Qpt({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function zZ(e,t,n,i,r,s){let o=r;const l=i.get(o)||new Map;i.set(o,l.set(n,t)),o=`${r}-${e}`;const c=i.get(o)||new Map;if(i.set(o,c.set(n,t)),s){o=`${r}-${e}-${s}`;const u=i.get(o)||new Map;i.set(o,u.set(n,t))}}function eNe(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:o=null,targetHandle:l=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:o,targetHandle:l},u=`${r}-${o}--${s}-${l}`,d=`${s}-${l}--${r}-${o}`;zZ("source",c,d,e,r,o),zZ("target",c,u,e,s,l),t.set(i.id,i)}}function tNe(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:tNe(n,t):!1}function VZ(e,t,n){var r;let i=e;do{if((r=i==null?void 0:i.matches)!=null&&r.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function zpt(e,t,n,i){const r=new Map;for(const[s,o]of e)if((o.selected||o.id===i)&&(!o.parentId||!tNe(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(s);l&&r.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return r}function u5({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var o,l,c;const r=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&r.push({...f,position:d.position,dragging:i})}if(!e)return[r[0],r];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:i}:r[0],r]}function Vpt({dragItems:e,snapGrid:t,x:n,y:i}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:i-r.distance.y},o=NC(s,t);return{x:o.x-s.x,y:o.y-s.y}}function Hpt({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,m=!1,g=!1,b=null;function v({noDragClassName:x,handleSelector:w,domNode:O,isSelectable:S,nodeId:k,nodeClickDistance:C=0}){h=zc(O);function E({x:T,y:N}){const{nodeLookup:A,nodeExtent:P,snapGrid:D,snapToGrid:M,nodeOrigin:L,onNodeDrag:U,onSelectionDrag:I,onError:H,updateNodePositions:K}=t();s={x:T,y:N};let F=!1;const W=l.size>1,V=W&&P?jF(jC(l)):null,X=W&&M?Vpt({dragItems:l,snapGrid:D,x:T,y:N}):null;for(const[ie,Q]of l){if(!A.has(ie))continue;let Z={x:T-Q.distance.x,y:N-Q.distance.y};M&&(Z=X?{x:Math.round(Z.x+X.x),y:Math.round(Z.y+X.y)}:NC(Z,D));let ce=null;if(W&&P&&!Q.extent&&V){const{positionAbsolute:G}=Q.internals,te=G.x-V.x+P[0][0],ye=G.x+Q.measured.width-V.x2+P[1][0],Ne=G.y-V.y+P[0][1],pe=G.y+Q.measured.height-V.y2+P[1][1];ce=[[te,Ne],[ye,pe]]}const{position:Ee,positionAbsolute:Y}=Bje({nodeId:ie,nextPosition:Z,nodeLookup:A,nodeExtent:ce||P,nodeOrigin:L,onError:H});F=F||Q.position.x!==Ee.x||Q.position.y!==Ee.y,Q.position=Ee,Q.internals.positionAbsolute=Y}if(g=g||F,!!F&&(K(l,!0),b&&(i||U||!k&&I))){const[ie,Q]=u5({nodeId:k,dragItems:l,nodeLookup:A});i==null||i(b,l,ie,Q),U==null||U(b,ie,Q),k||I==null||I(b,Q)}}async function R(){if(!d)return;const{transform:T,panBy:N,autoPanSpeed:A,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(o);return}const[D,M]=YQ(u,d,A);(D!==0||M!==0)&&(s.x=(s.x??0)-D/T[2],s.y=(s.y??0)-M/T[2],await N({x:D,y:M})&&E(s)),o=requestAnimationFrame(R)}function _(T){var W;const{nodeLookup:N,multiSelectionActive:A,nodesDraggable:P,transform:D,snapGrid:M,snapToGrid:L,selectNodesOnDrag:U,onNodeDragStart:I,onSelectionDragStart:H,unselectNodesAndEdges:K}=t();f=!0,(!U||!S)&&!A&&k&&((W=N.get(k))!=null&&W.selected||K()),S&&U&&k&&(e==null||e(k));const F=Fk(T.sourceEvent,{transform:D,snapGrid:M,snapToGrid:L,containerBounds:d});if(s=F,l=zpt(N,P,F,k),l.size>0&&(n||I||!k&&H)){const[V,X]=u5({nodeId:k,dragItems:l,nodeLookup:N});n==null||n(T.sourceEvent,l,V,X),I==null||I(T.sourceEvent,V,X),k||H==null||H(T.sourceEvent,X)}}const j=yje().clickDistance(C).on("start",T=>{const{domNode:N,nodeDragThreshold:A,transform:P,snapGrid:D,snapToGrid:M}=t();d=(N==null?void 0:N.getBoundingClientRect())||null,m=!1,g=!1,b=T.sourceEvent,A===0&&_(T),s=Fk(T.sourceEvent,{transform:P,snapGrid:D,snapToGrid:M,containerBounds:d}),u=kd(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:N,transform:A,snapGrid:P,snapToGrid:D,nodeDragThreshold:M,nodeLookup:L}=t(),U=Fk(T.sourceEvent,{transform:A,snapGrid:P,snapToGrid:D,containerBounds:d});if(b=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||k&&!L.has(k))&&(m=!0),!m){if(!c&&N&&f&&(c=!0,R()),!f){const I=kd(T.sourceEvent,d),H=I.x-u.x,K=I.y-u.y;Math.sqrt(H*H+K*K)>M&&_(T)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&f&&(u=kd(T.sourceEvent,d),E(U))}}).on("end",T=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:N,updateNodePositions:A,onNodeDragStop:P,onSelectionDragStop:D}=t();if(g&&(A(l,!1),g=!1),r||P||!k&&D){const[M,L]=u5({nodeId:k,dragItems:l,nodeLookup:N,dragging:!1});r==null||r(T.sourceEvent,l,M,L),P==null||P(T.sourceEvent,M,L),k||D==null||D(T.sourceEvent,L)}}}).filter(T=>{const N=T.target;return!T.button&&(!x||!VZ(N,`.${x}`,O))&&(!w||VZ(N,w,O))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function qpt(e,t,n){const i=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())eE(r,nw(s))>0&&i.push(s);return i}const Wpt=250;function Kpt(e,t,n,i){var l,c;let r=[],s=1/0;const o=qpt(e,n,t+Wpt);for(const u of o){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:m}=wy(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(m-e.y,2));g>t||(g1){const u=i.type==="source"?"target":"source";return r.find(d=>d.type===u)??r[0]}return r[0]}function nNe(e,t,n,i,r,s=!1){var u,d,f;const o=i.get(e);if(!o)return null;const l=r==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...wy(o,c,c.position,!0)}:c}function iNe(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Gpt(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rNe=()=>!0;function Xpt(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:y=rNe,onReconnectEnd:x,updateConnection:w,getTransform:O,getFromHandle:S,autoPanSpeed:k,dragThreshold:C=1,handleDomNode:E}){const R=Hje(e.target);let _=0,j;const{x:T,y:N}=kd(e),A=iNe(s,E),P=l==null?void 0:l.getBoundingClientRect();let D=!1;if(!P||!A)return;const M=nNe(r,A,i,c,t);if(!M)return;let L=kd(e,P),U=!1,I=null,H=!1,K=null;function F(){if(!d||!P)return;const[Ee,Y]=YQ(L,P,k);h({x:Ee,y:Y}),_=requestAnimationFrame(F)}const W={...M,nodeId:r,type:A,position:M.position},V=c.get(r);let ie={inProgress:!0,isValid:null,from:wy(V,W,pn.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:V,to:L,toHandle:null,toPosition:RZ[W.position],toNode:null,pointer:L};function Q(){D=!0,w(ie),g==null||g(e,{nodeId:r,handleId:i,handleType:A})}C===0&&Q();function Z(Ee){if(!D){const{x:pe,y:me}=kd(Ee),se=pe-T,Se=me-N;if(!(se*se+Se*Se>C*C))return;Q()}if(!S()||!W){ce(Ee);return}const Y=O();L=kd(Ee,P),j=Kpt(Kw(L,Y,!1,[1,1]),n,c,W),U||(F(),U=!0);const G=sNe(Ee,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:o?"target":"source",isValidConnection:y,doc:R,lib:u,flowId:f,nodeLookup:c});K=G.handleDomNode,I=G.connection,H=Gpt(!!j,G.isValid);const te=c.get(r),ye=te?wy(te,W,pn.Left,!0):ie.from,Ne={...ie,from:ye,isValid:H,to:G.toHandle&&H?iw({x:G.toHandle.x,y:G.toHandle.y},Y):L,toHandle:G.toHandle,toPosition:H&&G.toHandle?G.toHandle.position:RZ[W.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:L};w(Ne),ie=Ne}function ce(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(D){(j||K)&&I&&H&&(b==null||b(I));const{inProgress:Y,...G}=ie,te={...G,toPosition:ie.toHandle?ie.toPosition:null};v==null||v(Ee,te),s&&(x==null||x(Ee,te))}m(),cancelAnimationFrame(_),U=!1,H=!1,I=null,K=null,R.removeEventListener("mousemove",Z),R.removeEventListener("mouseup",ce),R.removeEventListener("touchmove",Z),R.removeEventListener("touchend",ce)}}R.addEventListener("mousemove",Z),R.addEventListener("mouseup",ce),R.addEventListener("touchmove",Z),R.addEventListener("touchend",ce)}function sNe(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:o,lib:l,flowId:c,isValidConnection:u=rNe,nodeLookup:d}){const f=s==="target",h=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y:g}=kd(e),b=o.elementFromPoint(m,g),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=iNe(void 0,v),w=v.getAttribute("data-nodeid"),O=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),k=v.classList.contains("connectableend");if(!w||!x)return y;const C={source:f?w:i,sourceHandle:f?O:r,target:f?i:w,targetHandle:f?r:O};y.connection=C;const R=S&&k&&(n===ew.Strict?f&&x==="source"||!f&&x==="target":w!==i||O!==r);y.isValid=R&&u(C),y.toHandle=nNe(w,x,O,d,n,!0)}return y}const IF={onPointerDown:Xpt,isValid:sNe};function Ypt({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=zc(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:m=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const O=n(),S=w.sourceEvent.ctrlKey&&tE()?10:1,k=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*d,C=O[2]*Math.pow(2,k*S);t.scaleTo(C)};let b=[0,0];const v=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(b=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const O=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const S=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],k=[S[0]-b[0],S[1]-b[1]];b=S;const C=i()*Math.max(O[2],Math.log(O[2]))*(m?-1:1),E={x:O[0]-k[0]*C,y:O[1]-k[1]*C},R=[[0,0],[c,u]];t.setViewportConstrained({x:E.x,y:E.y,zoom:O[2]},R,l)},x=Pje().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?g:null);r.call(x,{})}function o(){r.on("zoom",null)}return{update:s,destroy:o,pointer:gd}}const kP=e=>({x:e.x,y:e.y,zoom:e.k}),d5=({x:e,y:t,zoom:n})=>xP.translate(e,t).scale(n),Rv=(e,t)=>e.target.closest(`.${t}`),oNe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zpt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,f5=(e,t=0,n=Zpt,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},aNe=e=>{const t=e.ctrlKey&&tE()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jpt({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Rv(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const v=gd(d),y=aNe(d),x=f*Math.pow(2,y);i.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let m=r===Jb.Vertical?0:d.deltaX*h,g=r===Jb.Horizontal?0:d.deltaY*h;!tE()&&d.shiftKey&&r!==Jb.Vertical&&(m=d.deltaY*h,g=0),i.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=kP(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function emt({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",o=!t&&s&&!i.ctrlKey,l=Rv(i,e);if(i.ctrlKey&&s&&l&&i.preventDefault(),o||l)return null;i.preventDefault(),n.call(this,i,r)}}function tmt({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,o,l;if((s=i.sourceEvent)!=null&&s.internal)return;const r=kP(i.transform);e.mouseButton=((o=i.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,r))}}function nmt({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var o,l;e.usedRightMouseButton=!!(n&&oNe(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((l=s.sourceEvent)!=null&&l.internal)&&(r==null||r(s.sourceEvent,kP(s.transform)))}}function imt({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&oNe(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=kP(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(o.sourceEvent,c)},n?150:0)}}}function rmt({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,m=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Rv(f,`${u}-flow__node`)||Rv(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||o||d&&!g||Rv(f,l)&&g||Rv(f,c)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!r&&!m&&g||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function smt({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Pje().scaleExtent([t,n]).translateExtent(i),h=zc(e).call(f);x({x:r.x,y:r.y,zoom:tw(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(aNe);async function b(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).transform(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:T,onPaneContextMenu:N,userSelectionActive:A,panOnScroll:P,panOnDrag:D,panOnScrollMode:M,panOnScrollSpeed:L,preventScrolling:U,zoomOnPinch:I,zoomOnScroll:H,zoomOnDoubleClick:K,zoomActivationKeyPressed:F,lib:W,onTransformChange:V,connectionInProgress:X,paneClickDistance:ie,selectionOnDrag:Q}){A&&!u.isZoomingOrPanning&&y();const Z=P&&!F&&!A;f.clickDistance(Q?1/0:!Od(ie)||ie<0?0:ie);const ce=Z?Jpt({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:L,zoomOnPinch:I,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:l}):emt({noWheelClassName:j,preventScrolling:U,d3ZoomHandler:m});h.on("wheel.zoom",ce,{passive:!1});const Ee=tmt({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});f.on("start",Ee);const Y=nmt({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!N,onPanZoom:s,onTransformChange:V});f.on("zoom",Y);const G=imt({zoomPanValues:u,panOnDrag:D,panOnScroll:P,onPaneContextMenu:N,onPanZoomEnd:l,onDraggingChange:c});f.on("end",G);const te=rmt({zoomActivationKeyPressed:F,panOnDrag:D,zoomOnScroll:H,panOnScroll:P,zoomOnDoubleClick:K,zoomOnPinch:I,userSelectionActive:A,noPanClassName:T,noWheelClassName:j,lib:W,connectionInProgress:X});f.filter(te),K?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(j,T,N){const A=d5(j),P=f==null?void 0:f.constrain()(A,T,N);return P&&await b(P),P}async function w(j,T){const N=d5(j);return await b(N,T),N}function O(j){if(h){const T=d5(j),N=h.property("__zoom");(N.k!==j.zoom||N.x!==j.x||N.y!==j.y)&&(f==null||f.transform(h,T,null,{sync:!0}))}}function S(){const j=h?Ije(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function k(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).scaleTo(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}async function C(j,T){return h?new Promise(N=>{f==null||f.interpolate((T==null?void 0:T.interpolate)==="linear"?$k:$_).scaleBy(f5(h,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>N(!0)),j)}):!1}function E(j){f==null||f.scaleExtent(j)}function R(j){f==null||f.translateExtent(j)}function _(j){const T=!Od(j)||j<0?0:j;f==null||f.clickDistance(T)}return{update:v,destroy:y,setViewport:w,setViewportConstrained:x,getViewport:S,scaleTo:k,scaleBy:C,setScaleExtent:E,setTranslateExtent:R,syncViewport:O,setClickDistance:_}}var rw;(function(e){e.Line="line",e.Handle="handle"})(rw||(rw={}));function omt({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const o=e-t,l=n-i,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&r&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function HZ(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:r}}function Wp(e,t){return Math.max(0,t-e)}function Kp(e,t){return Math.max(0,e-t)}function $A(e,t,n){return Math.max(0,t-e,e-n)}function qZ(e,t){return e?!t:t}function amt(e,t,n,i,r,s,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=i,{x:w,y:O,width:S,height:k,aspectRatio:C}=e;let E=Math.floor(d?m-e.pointerX:0),R=Math.floor(f?g-e.pointerY:0);const _=S+(c?-E:E),j=k+(u?-R:R),T=-s[0]*S,N=-s[1]*k;let A=$A(_,b,v),P=$A(j,y,x);if(o){let L=0,U=0;c&&E<0?L=Wp(w+E+T,o[0][0]):!c&&E>0&&(L=Kp(w+_+T,o[1][0])),u&&R<0?U=Wp(O+R+N,o[0][1]):!u&&R>0&&(U=Kp(O+j+N,o[1][1])),A=Math.max(A,L),P=Math.max(P,U)}if(l){let L=0,U=0;c&&E>0?L=Kp(w+E,l[0][0]):!c&&E<0&&(L=Wp(w+_,l[1][0])),u&&R>0?U=Kp(O+R,l[0][1]):!u&&R<0&&(U=Wp(O+j,l[1][1])),A=Math.max(A,L),P=Math.max(P,U)}if(r){if(d){const L=$A(_/C,y,x)*C;if(A=Math.max(A,L),o){let U=0;!c&&!u||c&&!u&&h?U=Kp(O+N+_/C,o[1][1])*C:U=Wp(O+N+(c?E:-E)/C,o[0][1])*C,A=Math.max(A,U)}if(l){let U=0;!c&&!u||c&&!u&&h?U=Wp(O+_/C,l[1][1])*C:U=Kp(O+(c?E:-E)/C,l[0][1])*C,A=Math.max(A,U)}}if(f){const L=$A(j*C,b,v)/C;if(P=Math.max(P,L),o){let U=0;!c&&!u||u&&!c&&h?U=Kp(w+j*C+T,o[1][0])/C:U=Wp(w+(u?R:-R)*C+T,o[0][0])/C,P=Math.max(P,U)}if(l){let U=0;!c&&!u||u&&!c&&h?U=Wp(w+j*C,l[1][0])/C:U=Kp(w+(u?R:-R)*C,l[0][0])/C,P=Math.max(P,U)}}}R=R+(R<0?P:-P),E=E+(E<0?A:-A),r&&(h?_>j*C?R=(qZ(c,u)?-E:E)/C:E=(qZ(c,u)?-R:R)*C:d?(R=E/C,u=c):(E=R*C,c=u));const D=c?w+E:w,M=u?O+R:O;return{width:S+(c?-E:E),height:k+(u?-R:R),x:s[0]*E*(c?-1:1)+D,y:s[1]*R*(u?-1:1)+M}}const lNe={width:0,height:0,x:0,y:0},lmt={...lNe,pointerX:0,pointerY:0,aspectRatio:1};function cmt(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,l=n[0]*s,c=n[1]*o;return[[i-l,r-c],[i+s-l,r+o-c]]}function umt({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=zc(e);let o={controlDirection:HZ("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:v}){let y={...lNe},x={...lmt};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:HZ(u)};let w,O=null,S=[],k,C,E,R=!1;const _=yje().on("start",j=>{const{nodeLookup:T,transform:N,snapGrid:A,snapToGrid:P,nodeOrigin:D,paneDomNode:M}=n();if(w=T.get(t),!w)return;O=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:U}=Fk(j.sourceEvent,{transform:N,snapGrid:A,snapToGrid:P,containerBounds:O});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},x={...y,pointerX:L,pointerY:U,aspectRatio:y.width/y.height},k=void 0,C=xy(w.extent)?w.extent:void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(k=T.get(w.parentId)),k&&w.extent==="parent"&&(C=[[0,0],[k.measured.width,k.measured.height]]),S=[],E=void 0;for(const[I,H]of T)if(H.parentId===t&&(S.push({id:I,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const K=cmt(H,w,H.origin??D);E?E=[[Math.min(K[0][0],E[0][0]),Math.min(K[0][1],E[0][1])],[Math.max(K[1][0],E[1][0]),Math.max(K[1][1],E[1][1])]]:E=K}m==null||m(j,{...y})}).on("drag",j=>{const{transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P}=n(),D=Fk(j.sourceEvent,{transform:T,snapGrid:N,snapToGrid:A,containerBounds:O}),M=[];if(!w)return;const{x:L,y:U,width:I,height:H}=y,K={},F=w.origin??P,{width:W,height:V,x:X,y:ie}=amt(x,o.controlDirection,D,o.boundaries,o.keepAspectRatio,F,C,E),Q=W!==I,Z=V!==H,ce=X!==L&&Q,Ee=ie!==U&&Z;if(!ce&&!Ee&&!Q&&!Z)return;if((ce||Ee||F[0]===1||F[1]===1)&&(K.x=ce?X:y.x,K.y=Ee?ie:y.y,y.x=K.x,y.y=K.y,S.length>0)){const ye=X-L,Ne=ie-U;for(const pe of S)pe.position={x:pe.position.x-ye+F[0]*(W-I),y:pe.position.y-Ne+F[1]*(V-H)},M.push(pe)}if((Q||Z)&&(K.width=Q&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:y.width,K.height=Z&&(!o.resizeDirection||o.resizeDirection==="vertical")?V:y.height,y.width=K.width,y.height=K.height),k&&w.expandParent){const ye=F[0]*(K.width??0);K.x&&K.x{R&&(b==null||b(j,{...y}),r==null||r({...y}),R=!1)});s.call(_)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}const dmt={},WZ=e=>{let t;const n=new Set,i=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(dmt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(i,r,c);return c},fmt=e=>e?WZ(e):WZ,{useDebugValue:hmt}=pi,{useSyncExternalStoreWithSelector:pmt}=PZe,mmt=e=>e;function cNe(e,t=mmt,n){const i=pmt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hmt(i),i}const KZ=(e,t)=>{const n=fmt(e),i=(r,s=t)=>cNe(n,r,s);return Object.assign(i,n),i},gmt=(e,t)=>e?KZ(e,t):KZ;function As(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,r]of e)if(!Object.is(r,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const SP=p.createContext(null),bmt=SP.Provider,uNe=Rd.error001("react");function zi(e,t){const n=p.useContext(SP);if(n===null)throw new Error(uNe);return cNe(n,e,t)}function _s(){const e=p.useContext(SP);if(e===null)throw new Error(uNe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const GZ={display:"none"},ymt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dNe="react-flow__node-desc",fNe="react-flow__edge-desc",vmt="react-flow__aria-live",xmt=e=>e.ariaLiveMessage,wmt=e=>e.ariaLabelConfig;function Omt({rfId:e}){const t=zi(xmt);return a.jsx("div",{id:`${vmt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ymt,children:t})}function kmt({rfId:e,disableKeyboardA11y:t}){const n=zi(wmt);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${dNe}-${e}`,style:GZ,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${fNe}-${e}`,style:GZ,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(Omt,{rfId:e})]})}const EP=p.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const o=`${e}`.split("-");return a.jsx("div",{className:Mo(["react-flow__panel",n,...o]),style:i,ref:s,...r,children:t})});EP.displayName="Panel";function Smt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(EP,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:a.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Emt=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},FA=e=>e.id;function Cmt(e,t){return As(e.selectedNodes.map(FA),t.selectedNodes.map(FA))&&As(e.selectedEdges.map(FA),t.selectedEdges.map(FA))}function Tmt({onSelectionChange:e}){const t=_s(),{selectedNodes:n,selectedEdges:i}=zi(Emt,Cmt);return p.useEffect(()=>{const r={nodes:n,edges:i};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,i,e]),null}const Amt=e=>!!e.onSelectionChangeHandlers;function _mt({onSelectionChange:e}){const t=zi(Amt);return e||t?a.jsx(Tmt,{onSelectionChange:e}):null}const hNe=[0,0],jmt={x:0,y:0,zoom:1},Nmt=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],XZ=[...Nmt,"rfId"],Rmt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),YZ={translateExtent:YS,nodeOrigin:hNe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Imt(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=zi(Rmt,As),u=_s();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=YZ,l()}),[]);const d=p.useRef(YZ);return p.useEffect(()=>{for(const f of XZ){const h=e[f],m=d.current[f];h!==m&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?r(h):f==="translateExtent"?s(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:kpt(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},XZ.map(f=>e[f])),null}function ZZ(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Pmt(e){var i;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const r=ZZ(),s=()=>n(r!=null&&r.matches?"dark":"light");return s(),r==null||r.addEventListener("change",s),()=>{r==null||r.removeEventListener("change",s)}},[e]),t!==null?t:(i=ZZ())!=null&&i.matches?"dark":"light"}const JZ=typeof document<"u"?document:null;function nE(e=null,t={target:JZ,actInsideInputWithModifier:!0}){const[n,i]=p.useState(!1),r=p.useRef(!1),s=p.useRef(new Set([])),[o,l]=p.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??JZ,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var v,y;if(r.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!r.current||r.current&&!u)&&qje(m))return!1;const b=tJ(m.code,l);if(s.current.add(m[b]),eJ(o,s.current,!1)){const x=((y=(v=m.composedPath)==null?void 0:v.call(m))==null?void 0:y[0])||m.target,w=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(r.current||!w)&&m.preventDefault(),i(!0)}},f=m=>{const g=tJ(m.code,l);eJ(o,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),r.current=!1},h=()=>{s.current.clear(),i(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,i]),n}function eJ(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function tJ(e,t){return t.includes(e)?"code":"key"}const Imt=()=>{const e=_s();return p.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:s,maxZoom:o,panZoom:l}=e.getState(),c=ZQ(t,i,r,s,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return Kw(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),o=iw(t,n);return{x:o.x+r,y:o.y+s}}}),[])};function pNe(e,t){const n=[],i=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")i.set(s.id,[s]);else{const o=i.get(s.id);o?o.push(s):i.set(s.id,[s])}for(const s of t){const o=i.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...s};for(const c of o)Pmt(c,l);n.push(l)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Pmt(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function mNe(e,t){return pNe(e,t)}function gNe(e,t){return pNe(e,t)}function yb(e,t){return{id:e,type:"select",selected:t}}function Iv(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const o=t.has(r);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),i.push(yb(s.id,o)))}return i}function nJ({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const l=t.get(o.id),c=((r=l==null?void 0:l.internals)==null?void 0:r.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function iJ(e){return{id:e.id,type:"remove"}}const Dmt=zje();function Mmt(e,t,n={}){return Tpt(e,t,{...n,onError:n.onError??Dmt})}const rJ=e=>fpt(e),Lmt=e=>Fje(e);function bNe(e){return p.forwardRef(e)}const $mt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function sJ(e){const[t,n]=p.useState(BigInt(0)),[i]=p.useState(()=>Fmt(()=>n(r=>r+BigInt(1))));return $mt(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function Fmt(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const yNe=p.createContext(null);function Bmt({children:e}){const t=_s(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=nJ({items:b,lookup:h});for(const y of g.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:w}=t.getState();y&&w(x)})},[]),i=sJ(n),r=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let m=c;for(const g of l)m=typeof g=="function"?g(m):g;d?u(m):f&&f(nJ({items:m,lookup:h}))},[]),s=sJ(r),o=p.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return a.jsx(yNe.Provider,{value:o,children:e})}function Umt(){const e=p.useContext(yNe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Qmt=e=>!!e.panZoom;function CP(){const e=Imt(),t=_s(),n=Umt(),i=zi(Qmt),r=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=rJ(f)?f:h.get(f.id),b=g.parentId?Vje(g.position,g.measured,g.parentId,h,m):g.position,v={...g,position:b,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((x=g.measured)==null?void 0:x.height)??g.height};return nw(v)},u=(f,h,m={replace:!1})=>{o(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&rJ(v)?v:{...b,...v}}return b}))},d=(f,h,m={replace:!1})=>{l(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&Lmt(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(m=>[...m,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(m=>[...m,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:m}=t.getState(),[g,b,v]=m;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:g,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:w,onBeforeDelete:O}=t.getState(),{nodes:S,edges:k}=await bpt({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:O}),C=k.length>0,E=S.length>0;if(C){const R=k.map(iJ);v==null||v(k),x(R)}if(E){const R=S.map(iJ);b==null||b(S),y(R)}return(E||C)&&(w==null||w({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(f,h=!0,m)=>{const g=PZ(f),b=g?f:c(f),v=m!==void 0;return b?(m||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!g&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const w=nw(v?y:x),O=eE(w,b);return h&&O>0||O>=w.width*w.height||O>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=PZ(f)?f:c(f);if(!b)return!1;const v=eE(b,h);return m&&v>0||v>=h.width*h.height||v>=b.width*b.height},updateNode:u,updateNodeData:(f,h,m={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:d,updateEdgeData:(f,h,m={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:m}=t.getState();return hpt(f,{nodeLookup:h,nodeOrigin:m})},getHandleConnections:({type:f,id:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??xpt();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(m=>[...m]),h.promise}}},[]);return p.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const oJ=e=>e.selected,zmt=typeof window<"u"?window:void 0;function Vmt({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=_s(),{deleteElements:i}=CP(),r=nE(e,{actInsideInputWithModifier:!1}),s=nE(t,{target:zmt});p.useEffect(()=>{if(r){const{edges:o,nodes:l}=n.getState();i({nodes:l.filter(oJ),edges:o.filter(oJ)}),n.setState({nodesSelectionActive:!1})}},[r]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Hmt(e){const t=_s();p.useEffect(()=>{const n=()=>{var r,s,o,l;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=ez(e.current);(i.height===0||i.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Rd.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const TP={position:"absolute",width:"100%",height:"100%",top:0,left:0},qmt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Wmt({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=Jb.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:m=!0,children:g,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:w,selectionOnDrag:O}){const S=_s(),k=p.useRef(null),{userSelectionActive:C,lib:E,connectionInProgress:R}=zi(qmt,As),_=nE(h),j=p.useRef();Hmt(k);const T=p.useCallback(N=>{y==null||y({x:N[0],y:N[1],zoom:N[2]}),x||S.setState({transform:N})},[y,x]);return p.useEffect(()=>{if(k.current){j.current=imt({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:D=>S.setState(M=>M.paneDragging===D?M:{paneDragging:D}),onPanZoomStart:(D,M)=>{const{onViewportChangeStart:L,onMoveStart:U}=S.getState();U==null||U(D,M),L==null||L(M)},onPanZoom:(D,M)=>{const{onViewportChange:L,onMove:U}=S.getState();U==null||U(D,M),L==null||L(M)},onPanZoomEnd:(D,M)=>{const{onViewportChangeEnd:L,onMoveEnd:U}=S.getState();U==null||U(D,M),L==null||L(M)}});const{x:N,y:A,zoom:P}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[N,A,P],domNode:k.current.closest(".react-flow")}),()=>{var D;(D=j.current)==null||D.destroy()}}},[]),p.useEffect(()=>{var N;(N=j.current)==null||N.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:_,preventScrolling:m,noPanClassName:v,userSelectionActive:C,noWheelClassName:b,lib:E,onTransformChange:T,connectionInProgress:R,selectionOnDrag:O,paneClickDistance:w})},[e,t,n,i,r,s,o,l,_,m,v,C,b,E,T,R,O,w]),a.jsx("div",{className:"react-flow__renderer",ref:k,style:TP,children:g})}const Kmt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Gmt(){const{userSelectionActive:e,userSelectionRect:t}=zi(Kmt,As);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const h5=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Xmt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Ymt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ZS.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:m,onPaneMouseLeave:g,children:b}){const v=p.useRef(0),y=_s(),{userSelectionActive:x,elementsSelectable:w,dragging:O,connectionInProgress:S,panBy:k,autoPanSpeed:C}=zi(Xmt,As),E=w&&(e||x),R=p.useRef(null),_=p.useRef(),j=p.useRef(new Set),T=p.useRef(new Set),N=p.useRef(!1),A=p.useRef({x:0,y:0}),P=p.useRef(!1),D=Q=>{if(N.current||S){N.current=!1;return}u==null||u(Q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=Q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Q.preventDefault();return}d==null||d(Q)},L=f?Q=>f(Q):void 0,U=Q=>{N.current&&(Q.stopPropagation(),N.current=!1)},I=Q=>{var pe,me;const{domNode:Z,transform:ce}=y.getState();if(_.current=Z==null?void 0:Z.getBoundingClientRect(),!_.current)return;const Ee=Q.target===R.current;if(!Ee&&!!Q.target.closest(".nokey")||!e||!(o&&Ee||t)||Q.button!==0||!Q.isPrimary)return;(me=(pe=Q.target)==null?void 0:pe.setPointerCapture)==null||me.call(pe,Q.pointerId),N.current=!1;const{x:te,y:ye}=kd(Q.nativeEvent,_.current),Ne=Kw({x:te,y:ye},ce);y.setState({userSelectionRect:{width:0,height:0,startX:Ne.x,startY:Ne.y,x:te,y:ye}}),Ee||(Q.stopPropagation(),Q.preventDefault())};function H(Q,Z){const{userSelectionRect:ce}=y.getState();if(!ce)return;const{transform:Ee,nodeLookup:Y,edgeLookup:G,connectionLookup:te,triggerNodeChanges:ye,triggerEdgeChanges:Ne,defaultEdgeOptions:pe}=y.getState(),me={x:ce.startX,y:ce.startY},{x:se,y:Se}=iw(me,Ee),Le={startX:me.x,startY:me.y,x:QRe.id)),T.current=new Set;const ve=(pe==null?void 0:pe.selectable)??!0;for(const Re of j.current){const ne=te.get(Re);if(ne)for(const{edgeId:ge}of ne.values()){const Ce=G.get(ge);Ce&&(Ce.selectable??ve)&&T.current.add(ge)}}if(!DZ(be,j.current)){const Re=Iv(Y,j.current,!0);ye(Re)}if(!DZ(Ve,T.current)){const Re=Iv(G,T.current);Ne(Re)}y.setState({userSelectionRect:Le,userSelectionActive:!0,nodesSelectionActive:!1})}function K(){if(!r||!_.current)return;const[Q,Z]=YQ(A.current,_.current,C);k({x:Q,y:Z}).then(ce=>{if(!N.current||!ce){v.current=requestAnimationFrame(K);return}const{x:Ee,y:Y}=A.current;H(Ee,Y),v.current=requestAnimationFrame(K)})}const F=()=>{cancelAnimationFrame(v.current),v.current=0,P.current=!1};p.useEffect(()=>()=>F(),[]);const W=Q=>{const{userSelectionRect:Z,transform:ce,resetSelectedElements:Ee}=y.getState();if(!_.current||!Z)return;const{x:Y,y:G}=kd(Q.nativeEvent,_.current);A.current={x:Y,y:G};const te=iw({x:Z.startX,y:Z.startY},ce);if(!N.current){const ye=t?0:s;if(Math.hypot(Y-te.x,G-te.y)<=ye)return;Ee(),l==null||l(Q)}N.current=!0,P.current||(K(),P.current=!0),H(Y,G)},V=Q=>{var Z,ce;Q.button===0&&((ce=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ce.call(Z,Q.pointerId),!x&&Q.target===R.current&&y.getState().userSelectionRect&&(D==null||D(Q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(c==null||c(Q),y.setState({nodesSelectionActive:j.current.size>0})),F())},X=Q=>{var Z,ce;(ce=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ce.call(Z,Q.pointerId),F()},ie=i===!0||Array.isArray(i)&&i.includes(0);return a.jsxs("div",{className:Mo(["react-flow__pane",{draggable:ie,dragging:O,selection:e}]),onClick:E?void 0:h5(D,R),onContextMenu:h5(M,R),onWheel:h5(L,R),onPointerEnter:E?void 0:h,onPointerMove:E?W:m,onPointerUp:E?V:void 0,onPointerCancel:E?X:void 0,onPointerDownCapture:E?I:void 0,onClickCapture:E?U:void 0,onPointerLeave:g,ref:R,style:TP,children:[b,a.jsx(Gmt,{})]})}function PF({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Rd.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function vNe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:o}){const l=_s(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=zpt({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{PF({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:o}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,o]),c}const Zmt=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function xNe(){const e=_s();return p.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Zmt(o),m=r?s[0]:5,g=r?s[1]:5,b=n.direction.x*m*n.factor,v=n.direction.y*g*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};r&&(x=NC(x,s));const{position:w,positionAbsolute:O}=Bje({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:l});y.position=w,y.internals.positionAbsolute=O,f.set(y.id,y)}c(f)},[])}const oz=p.createContext(null),Jmt=oz.Provider;oz.Consumer;const wNe=()=>p.useContext(oz),egt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),tgt=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:o}=i,{fromHandle:l,toHandle:c,isValid:u}=o,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:s===ew.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!r,valid:d&&u}};function ngt({type:e="source",position:t=pn.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var P,D;const g=o||null,b=e==="target",v=_s(),y=wNe(),{connectOnClick:x,noPanClassName:w,rfId:O}=zi(egt,As),{connectingFrom:S,connectingTo:k,clickConnecting:C,isPossibleEndHandle:E,connectionInProcess:R,clickConnectionInProcess:_,valid:j}=zi(tgt(y,g,e),As);y||(D=(P=v.getState()).onError)==null||D.call(P,"010",Rd.error010());const T=M=>{const{defaultEdgeOptions:L,onConnect:U,hasDefaultEdges:I}=v.getState(),H={...L,...M};if(I){const{edges:K,setEdges:F,onError:W}=v.getState();F(Mmt(H,K,{onError:W}))}U==null||U(H),l==null||l(H)},N=M=>{if(!y)return;const L=Wje(M.nativeEvent);if(r&&(L&&M.button===0||!L)){const U=v.getState();IF.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:b,handleId:g,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...I)=>{var H,K;return(K=(H=v.getState()).onConnectEnd)==null?void 0:K.call(H,...I)},updateConnection:U.updateConnection,onConnect:T,isValidConnection:n||((...I)=>{var H,K;return((K=(H=v.getState()).isValidConnection)==null?void 0:K.call(H,...I))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}L?d==null||d(M):f==null||f(M)},A=M=>{const{onClickConnectStart:L,onClickConnectEnd:U,connectionClickStartHandle:I,connectionMode:H,isValidConnection:K,lib:F,rfId:W,nodeLookup:V,connection:X}=v.getState();if(!y||!I&&!r)return;if(!I){L==null||L(M.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const ie=Hje(M.target),Q=n||K,{connection:Z,isValid:ce}=IF.isValid(M.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:H,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:Q,flowId:W,doc:ie,lib:F,nodeLookup:V});ce&&Z&&T(Z);const Ee=structuredClone(X);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,U==null||U(M,Ee),v.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${O}-${y}-${g}-${e}`,className:Mo(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,u,{source:!b,target:b,connectable:i,connectablestart:r,connectableend:s,clickconnecting:C,connectingfrom:S,connectingto:k,valid:j,connectionindicator:i&&(!R||E)&&(R||_?s:r)}]),onMouseDown:N,onTouchStart:N,onClick:x?A:void 0,ref:m,...h,children:c})}const ic=p.memo(bNe(ngt));function igt({data:e,isConnectable:t,sourcePosition:n=pn.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(ic,{type:"source",position:n,isConnectable:t})]})}function rgt({data:e,isConnectable:t,targetPosition:n=pn.Top,sourcePosition:i=pn.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(ic,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(ic,{type:"source",position:i,isConnectable:t})]})}function sgt(){return null}function ogt({data:e,isConnectable:t,targetPosition:n=pn.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(ic,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const NN={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aJ={input:igt,default:rgt,output:ogt,group:sgt};function agt(e){var t,n,i,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const lgt=e=>{const{width:t,height:n,x:i,y:r}=jC(e.nodeLookup,{filter:s=>!!s.selected});return{width:Od(t)?t:null,height:Od(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function cgt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=_s(),{width:r,height:s,transformString:o,userSelectionActive:l}=zi(lgt,As),c=xNe(),u=p.useRef(null);p.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&r!==null&&s!==null;if(vNe({nodeRef:u,disabled:!d}),!d)return null;const f=e?m=>{const g=i.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,h=m=>{Object.prototype.hasOwnProperty.call(NN,m.key)&&(m.preventDefault(),c({direction:NN[m.key],factor:m.shiftKey?4:1}))};return a.jsx("div",{className:Mo(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s}})})}const lJ=typeof window<"u"?window:void 0,ugt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ONe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:O,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:E,autoPanOnSelection:R,defaultViewport:_,translateExtent:j,minZoom:T,maxZoom:N,preventScrolling:A,onSelectionContextMenu:P,noWheelClassName:D,noPanClassName:M,disableKeyboardA11y:L,onViewportChange:U,isControlledViewport:I}){const{nodesSelectionActive:H,userSelectionActive:K}=zi(ugt,As),F=nE(u,{target:lJ}),W=nE(b,{target:lJ}),V=W||E,X=W||O,ie=d&&V!==!0,Q=F||K||ie;return Vmt({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(Wmt,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!F&&V,defaultViewport:_,translateExtent:j,minZoom:T,maxZoom:N,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:D,noPanClassName:M,onViewportChange:U,isControlledViewport:I,paneClickDistance:l,selectionOnDrag:ie,children:a.jsxs(Ymt,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:V,autoPanOnSelection:R,isSelecting:!!Q,selectionMode:f,selectionKeyPressed:F,paneClickDistance:l,selectionOnDrag:ie,children:[e,H&&a.jsx(cgt,{onSelectionContextMenu:P,noPanClassName:M,disableKeyboardA11y:L})]})})}ONe.displayName="FlowRenderer";const dgt=p.memo(ONe),fgt=e=>t=>e?XQ(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function hgt(e){return zi(p.useCallback(fgt(e),[e]),As)}const pgt=e=>e.updateNodeInternals;function mgt(){const e=zi(pgt),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");i.set(s,{id:s,nodeElement:r.target,force:!0})}),e(i)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function ggt({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=_s(),s=p.useRef(null),o=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),d=n&&!!e.internals.handleBounds;return p.useEffect(()=>{s.current&&!e.hidden&&(!d||o.current!==s.current)&&(o.current&&(i==null||i.unobserve(o.current)),i==null||i.observe(s.current),o.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{o.current&&(i==null||i.unobserve(o.current),o.current=null)},[]),p.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(f||h||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function bgt({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:w,internals:O,isParent:S}=zi(Q=>{const Z=Q.nodeLookup.get(e),ce=Q.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ce}},As);let k=w.type||"default",C=(v==null?void 0:v[k])||aJ[k];C===void 0&&(x==null||x("003",Rd.error003(k)),k="default",C=(v==null?void 0:v.default)||aJ.default);const E=!!(w.draggable||l&&typeof w.draggable>"u"),R=!!(w.selectable||c&&typeof w.selectable>"u"),_=!!(w.connectable||u&&typeof w.connectable>"u"),j=!!(w.focusable||d&&typeof w.focusable>"u"),T=_s(),N=JQ(w),A=ggt({node:w,nodeType:k,hasDimensions:N,resizeObserver:f}),P=vNe({nodeRef:A,disabled:w.hidden||!E,noDragClassName:h,handleSelector:w.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:y}),D=xNe();if(w.hidden)return null;const M=Cp(w),L=agt(w),U=R||E||t||n||i||r,I=n?Q=>n(Q,{...O.userNode}):void 0,H=i?Q=>i(Q,{...O.userNode}):void 0,K=r?Q=>r(Q,{...O.userNode}):void 0,F=s?Q=>s(Q,{...O.userNode}):void 0,W=o?Q=>o(Q,{...O.userNode}):void 0,V=Q=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ce}=T.getState();R&&(!Z||!E||ce>0)&&PF({id:e,store:T,nodeRef:A}),t&&t(Q,{...O.userNode})},X=Q=>{if(!(qje(Q.nativeEvent)||g)){if(Dje.includes(Q.key)&&R){const Z=Q.key==="Escape";PF({id:e,store:T,unselect:Z,nodeRef:A})}else if(E&&w.selected&&Object.prototype.hasOwnProperty.call(NN,Q.key)){Q.preventDefault();const{ariaLabelConfig:Z}=T.getState();T.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~O.positionAbsolute.x,y:~~O.positionAbsolute.y})}),D({direction:NN[Q.key],factor:Q.shiftKey?4:1})}}},ie=()=>{var te;if(g||!((te=A.current)!=null&&te.matches(":focus-visible")))return;const{transform:Q,width:Z,height:ce,autoPanOnNodeFocus:Ee,setCenter:Y}=T.getState();if(!Ee)return;XQ(new Map([[e,w]]),{x:0,y:0,width:Z,height:ce},Q,!0).length>0||Y(w.position.x+M.width/2,w.position.y+M.height/2,{zoom:Q[2]})};return a.jsx("div",{className:Mo(["react-flow__node",`react-flow__node-${k}`,{[m]:E},w.className,{selected:w.selected,selectable:R,parent:S,draggable:E,dragging:P}]),ref:A,style:{zIndex:O.z,transform:`translate(${O.positionAbsolute.x}px,${O.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:N?"visible":"hidden",...w.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:H,onMouseLeave:K,onContextMenu:F,onClick:V,onDoubleClick:W,onKeyDown:j?X:void 0,tabIndex:j?0:void 0,onFocus:j?ie:void 0,role:w.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${dNe}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:a.jsx(Jmt,{value:e,children:a.jsx(C,{id:e,data:w.data,type:k,positionAbsoluteX:O.positionAbsolute.x,positionAbsoluteY:O.positionAbsolute.y,selected:w.selected??!1,selectable:R,draggable:E,deletable:w.deletable??!0,isConnectable:_,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:P,dragHandle:w.dragHandle,zIndex:O.z,parentId:w.parentId,...M})})})}var ygt=p.memo(bgt);const vgt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kNe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zi(vgt,As),o=hgt(e.onlyRenderVisibleElements),l=mgt();return a.jsx("div",{className:"react-flow__nodes",style:TP,children:o.map(c=>a.jsx(ygt,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}kNe.displayName="NodeRenderer";const xgt=p.memo(kNe);function wgt(e){return zi(p.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const i=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),o=n.nodeLookup.get(r.target);s&&o&&Spt({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),As)}const Ogt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},kgt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},cJ={[JS.Arrow]:Ogt,[JS.ArrowClosed]:kgt};function Sgt(e){const t=_s();return p.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(cJ,e)?cJ[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Rd.error009(e)),null)},[e])}const Egt=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=Sgt(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},SNe=({defaultColor:e,rfId:t})=>{const n=zi(s=>s.edges),i=zi(s=>s.defaultEdgeOptions),r=p.useMemo(()=>Rpt(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return r.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:r.map(s=>a.jsx(Egt,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};SNe.displayName="MarkerDefinitions";var Cgt=p.memo(SNe);function ENe({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=Mo(["react-flow__edge-textwrapper",u]),g=p.useRef(null);return p.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[r&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}ENe.displayName="EdgeText";const Tgt=p.memo(ENe);function RC({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...d,d:e,fill:"none",className:Mo(["react-flow__edge-path",d.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Od(t)&&Od(n)?a.jsx(Tgt,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function uJ({pos:e,x1:t,y1:n,x2:i,y2:r}){return e===pn.Left||e===pn.Right?[.5*(t+i),n]:[t,.5*(n+r)]}function CNe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top}){const[o,l]=uJ({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=uJ({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,m]=Kje({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${i},${r}`,d,f,h,m]}function TNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,w,O]=CNe({sourceX:n,sourceY:i,sourcePosition:o,targetX:r,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return a.jsx(RC,{id:S,path:x,labelX:w,labelY:O,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})})}const Agt=TNe({isInternal:!1}),ANe=TNe({isInternal:!0});Agt.displayName="SimpleBezierEdge";ANe.displayName="SimpleBezierEdgeInternal";function _Ne(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:m=pn.Bottom,targetPosition:g=pn.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[w,O,S]=jN({sourceX:n,sourceY:i,sourcePosition:m,targetX:r,targetY:s,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),k=e.isInternal?void 0:t;return a.jsx(RC,{id:k,path:w,labelX:O,labelY:S,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const jNe=_Ne({isInternal:!1}),NNe=_Ne({isInternal:!0});jNe.displayName="SmoothStepEdge";NNe.displayName="SmoothStepEdgeInternal";function RNe(e){return p.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return a.jsx(jNe,{...n,id:i,pathOptions:p.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const _gt=RNe({isInternal:!1}),INe=RNe({isInternal:!0});_gt.displayName="StepEdge";INe.displayName="StepEdgeInternal";function PNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[v,y,x]=Yje({sourceX:n,sourceY:i,targetX:r,targetY:s}),w=e.isInternal?void 0:t;return a.jsx(RC,{id:w,path:v,labelX:y,labelY:x,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const jgt=PNe({isInternal:!1}),DNe=PNe({isInternal:!0});jgt.displayName="StraightEdge";DNe.displayName="StraightEdgeInternal";function MNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:o=pn.Bottom,targetPosition:l=pn.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[w,O,S]=Gje({sourceX:n,sourceY:i,sourcePosition:o,targetX:r,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return a.jsx(RC,{id:k,path:w,labelX:O,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:x})})}const Ngt=MNe({isInternal:!1}),LNe=MNe({isInternal:!0});Ngt.displayName="BezierEdge";LNe.displayName="BezierEdgeInternal";const dJ={default:LNe,straight:DNe,step:INe,smoothstep:NNe,simplebezier:ANe},fJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Rgt=(e,t,n)=>n===pn.Left?e-t:n===pn.Right?e+t:e,Igt=(e,t,n)=>n===pn.Top?e-t:n===pn.Bottom?e+t:e,hJ="react-flow__edgeupdater";function pJ({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:o,className:Mo([hJ,`${hJ}-${l}`]),cx:Rgt(t,i,e),cy:Igt(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Pgt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:m}){const g=_s(),b=(O,S)=>{if(O.button!==0)return;const{autoPanOnConnect:k,domNode:C,connectionMode:E,connectionRadius:R,lib:_,onConnectStart:j,cancelConnection:T,nodeLookup:N,rfId:A,panBy:P,updateConnection:D}=g.getState(),M=S.type==="target",L=(H,K)=>{h(!1),f==null||f(H,n,S.type,K)},U=H=>u==null?void 0:u(n,H),I=(H,K)=>{h(!0),d==null||d(O,n,S.type),j==null||j(H,K)};IF.onPointerDown(O.nativeEvent,{autoPanOnConnect:k,connectionMode:E,connectionRadius:R,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:N,isTarget:M,edgeUpdaterType:S.type,lib:_,flowId:A,cancelConnection:T,panBy:P,isValidConnection:(...H)=>{var K,F;return((F=(K=g.getState()).isValidConnection)==null?void 0:F.call(K,...H))??!0},onConnect:U,onConnectStart:I,onConnectEnd:(...H)=>{var K,F;return(F=(K=g.getState()).onConnectEnd)==null?void 0:F.call(K,...H)},onReconnectEnd:L,updateConnection:D,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:O.currentTarget})},v=O=>b(O,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=O=>b(O,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>m(!0),w=()=>m(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(pJ,{position:l,centerX:i,centerY:r,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&a.jsx(pJ,{position:c,centerX:s,centerY:o,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:w,type:"target"})]})}function Dgt({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let w=zi(Y=>Y.edgeLookup.get(e));const O=zi(Y=>Y.defaultEdgeOptions);w=O?{...O,...w}:w;let S=w.type||"default",k=(b==null?void 0:b[S])||dJ[S];k===void 0&&(y==null||y("011",Rd.error011(S)),S="default",k=(b==null?void 0:b.default)||dJ.default);const C=!!(w.focusable||t&&typeof w.focusable>"u"),E=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),R=!!(w.selectable||i&&typeof w.selectable>"u"),_=p.useRef(null),[j,T]=p.useState(!1),[N,A]=p.useState(!1),P=_s(),{zIndex:D,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K}=zi(p.useCallback(Y=>{const G=Y.nodeLookup.get(w.source),te=Y.nodeLookup.get(w.target);if(!G||!te)return{zIndex:w.zIndex,...fJ};const ye=Npt({id:e,sourceNode:G,targetNode:te,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Y.connectionMode,onError:y});return{zIndex:kpt({selected:w.selected,zIndex:w.zIndex,sourceNode:G,targetNode:te,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...ye||fJ}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),As),F=p.useMemo(()=>w.markerStart?`url('#${NF(w.markerStart,g)}')`:void 0,[w.markerStart,g]),W=p.useMemo(()=>w.markerEnd?`url('#${NF(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||M===null||L===null||U===null||I===null)return null;const V=Y=>{var Ne;const{addSelectedEdges:G,unselectNodesAndEdges:te,multiSelectionActive:ye}=P.getState();R&&(P.setState({nodesSelectionActive:!1}),w.selected&&ye?(te({nodes:[],edges:[w]}),(Ne=_.current)==null||Ne.blur()):G([e])),r&&r(Y,w)},X=s?Y=>{s(Y,{...w})}:void 0,ie=o?Y=>{o(Y,{...w})}:void 0,Q=l?Y=>{l(Y,{...w})}:void 0,Z=c?Y=>{c(Y,{...w})}:void 0,ce=u?Y=>{u(Y,{...w})}:void 0,Ee=Y=>{var G;if(!x&&Dje.includes(Y.key)&&R){const{unselectNodesAndEdges:te,addSelectedEdges:ye}=P.getState();Y.key==="Escape"?((G=_.current)==null||G.blur(),te({edges:[w]})):ye([e])}};return a.jsx("svg",{style:{zIndex:D},children:a.jsxs("g",{className:Mo(["react-flow__edge",`react-flow__edge-${S}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!R&&!r,updating:j,selectable:R}]),onClick:V,onDoubleClick:X,onContextMenu:ie,onMouseEnter:Q,onMouseMove:Z,onMouseLeave:ce,onKeyDown:C?Ee:void 0,tabIndex:C?0:void 0,role:w.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":C?`${fNe}-${g}`:void 0,ref:_,...w.domAttributes,children:[!N&&a.jsx(k,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:R,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:F,markerEnd:W,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),E&&a.jsx(Pgt,{edge:w,isReconnectable:E,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K,setUpdateHover:T,setReconnecting:A})]})})}var Mgt=p.memo(Dgt);const Lgt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $Ne({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:w}=zi(Lgt,As),O=wgt(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(Cgt,{defaultColor:e,rfId:n}),O.map(S=>a.jsx(Mgt,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:r,onReconnect:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:i,disableKeyboardA11y:b},S))]})}$Ne.displayName="EdgeRenderer";const $gt=p.memo($Ne),Fgt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Bgt({children:e}){const t=zi(Fgt);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Ugt(e){const t=CP(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Qgt=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function zgt(e){const t=zi(Qgt),n=_s();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Vgt(e){return e.connection.inProgress?{...e.connection,to:Kw(e.connection.to,e.transform)}:{...e.connection}}function Hgt(e){return Vgt}function qgt(e){const t=Hgt();return zi(t,As)}const Wgt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Kgt({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:o,isValid:l,inProgress:c}=zi(Wgt,As);return!(s&&r&&c)?null:a.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Mo(["react-flow__connection",$je(l)]),children:a.jsx(FNe,{style:t,type:n,CustomComponent:i,isValid:l})})})}const FNe=({style:e,type:t=mm.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=qgt();if(!r)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:$je(i),toNode:d,toHandle:f,pointer:m});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case mm.Bezier:[g]=Gje(b);break;case mm.SimpleBezier:[g]=CNe(b);break;case mm.Step:[g]=jN({...b,borderRadius:0});break;case mm.SmoothStep:[g]=jN(b);break;default:[g]=Yje(b)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};FNe.displayName="ConnectionLine";const Ggt={};function mJ(e=Ggt){p.useRef(e),_s(),p.useEffect(()=>{},[e])}function Xgt(){_s(),p.useRef(!1),p.useEffect(()=>{},[])}function BNe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,deleteKeyCode:E,onlyRenderVisibleElements:R,elementsSelectable:_,defaultViewport:j,translateExtent:T,minZoom:N,maxZoom:A,preventScrolling:P,defaultMarkerColor:D,zoomOnScroll:M,zoomOnPinch:L,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:H,zoomOnDoubleClick:K,panOnDrag:F,autoPanOnSelection:W,onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneScroll:Z,onPaneContextMenu:ce,paneClickDistance:Ee,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:ye,onEdgeMouseLeave:Ne,reconnectRadius:pe,onReconnect:me,onReconnectStart:se,onReconnectEnd:Se,noDragClassName:Le,noWheelClassName:be,noPanClassName:Ve,disableKeyboardA11y:ve,nodeExtent:Re,rfId:ne,viewport:ge,onViewportChange:Ce}){return mJ(e),mJ(t),Xgt(),Ugt(n),zgt(ge),a.jsx(dgt,{onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneContextMenu:ce,onPaneScroll:Z,paneClickDistance:Ee,deleteKeyCode:E,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:_,zoomOnScroll:M,zoomOnPinch:L,zoomOnDoubleClick:K,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:H,panOnDrag:F,autoPanOnSelection:W,defaultViewport:j,translateExtent:T,minZoom:N,maxZoom:A,onSelectionContextMenu:f,preventScrolling:P,noDragClassName:Le,noWheelClassName:be,noPanClassName:Ve,disableKeyboardA11y:ve,onViewportChange:Ce,isControlledViewport:!!ge,children:a.jsxs(Bgt,{children:[a.jsx($gt,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:o,onReconnect:me,onReconnectStart:se,onReconnectEnd:Se,onlyRenderVisibleElements:R,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:ye,onEdgeMouseLeave:Ne,reconnectRadius:pe,defaultMarkerColor:D,noPanClassName:Ve,disableKeyboardA11y:ve,rfId:ne}),a.jsx(Kgt,{style:b,type:g,component:v,containerStyle:y}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(xgt,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:R,noPanClassName:Ve,noDragClassName:Le,disableKeyboardA11y:ve,nodeExtent:Re,rfId:ne}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}BNe.displayName="GraphView";const Ygt=p.memo(BNe),Zgt=zje(),gJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const m=new Map,g=new Map,b=new Map,v=new Map,y=i??t??[],x=n??e??[],w=d??[0,0],O=f??YS;eNe(b,v,y);const{nodesInitialized:S}=RF(x,m,g,{nodeOrigin:w,nodeExtent:O,zIndexMode:h});let k=[0,0,1];if(o&&r&&s){const C=jC(m,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:E,y:R,zoom:_}=ZQ(C,r,s,c,u,(l==null?void 0:l.padding)??.1);k=[E,R,_]}return{rfId:"1",width:r??0,height:s??0,transform:k,nodes:x,nodesInitialized:S,nodeLookup:m,parentLookup:g,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:YS,nodeExtent:O,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ew.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...Lje},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Zgt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Mje,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Jgt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>pmt((m,g)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:w,width:O,height:S,minZoom:k,maxZoom:C}=g();y&&(await gpt({nodes:v,width:O,height:S,panZoom:y,minZoom:k,maxZoom:C},x),w==null||w.resolve(!0),m({fitViewResolver:null}))}return{...gJ({nodes:e,edges:t,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:O,fitViewQueued:S,zIndexMode:k,nodesSelectionActive:C}=g(),{nodesInitialized:E,hasSelectedNodes:R}=RF(v,y,x,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:k}),_=C&&R;S&&E?(b(),m({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:_})):m({nodes:v,nodesInitialized:E,nodesSelectionActive:_})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=g();eNe(y,x,v),m({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=g();x(v),m({hasDefaultNodes:!0})}if(y){const{setEdges:x}=g();x(y),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:w,domNode:O,nodeOrigin:S,nodeExtent:k,debug:C,fitViewQueued:E,zIndexMode:R}=g(),{changes:_,updatedInternals:j}=Fpt(v,x,w,O,S,k,R);j&&(Dpt(x,w,{nodeOrigin:S,nodeExtent:k,zIndexMode:R}),E?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(_==null?void 0:_.length)>0&&(C&&console.log("React Flow: trigger node changes",_),y==null||y(_)))},updateNodePositions:(v,y=!1)=>{const x=[];let w=[];const{nodeLookup:O,triggerNodeChanges:S,connection:k,updateConnection:C,onNodesChangeMiddlewareMap:E}=g();for(const[R,_]of v){const j=O.get(R),T=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(_!=null&&_.position)),N={id:R,type:"position",position:T?{x:Math.max(0,_.position.x),y:Math.max(0,_.position.y)}:_.position,dragging:y};if(j&&k.inProgress&&k.fromNode.id===j.id){const A=wy(j,k.fromHandle,pn.Left,!0);C({...k,from:A})}T&&j.parentId&&x.push({id:R,parentId:j.parentId,rect:{..._.internals.positionAbsolute,width:_.measured.width??0,height:_.measured.height??0}}),w.push(N)}if(x.length>0){const{parentLookup:R,nodeOrigin:_}=g(),j=sz(x,O,R,_);w.push(...j)}for(const R of E.values())w=R(w);S(w)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:w,hasDefaultNodes:O,debug:S}=g();if(v!=null&&v.length){if(O){const k=mNe(v,w);x(k)}S&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:w,hasDefaultEdges:O,debug:S}=g();if(v!=null&&v.length){if(O){const k=gNe(v,w);x(k)}S&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>yb(C,!0));O(k);return}O(Iv(w,new Set([...v]),!0)),S(Iv(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>yb(C,!0));S(k);return}S(Iv(x,new Set([...v]))),O(Iv(w,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:w,nodeLookup:O,triggerNodeChanges:S,triggerEdgeChanges:k}=g(),C=v||w,E=y||x,R=[];for(const j of C){if(!j.selected)continue;const T=O.get(j.id);T&&(T.selected=!1),R.push(yb(j.id,!1))}const _=[];for(const j of E)j.selected&&_.push(yb(j.id,!1));S(R),k(_)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=g();y==null||y.setScaleExtent([v,x]),m({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=g();y==null||y.setScaleExtent([x,v]),m({maxZoom:v})},setTranslateExtent:v=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:w,elementsSelectable:O}=g();if(!O)return;const S=y.reduce((C,E)=>E.selected?[...C,yb(E.id,!1)]:C,[]),k=v.reduce((C,E)=>E.selected?[...C,yb(E.id,!1)]:C,[]);x(S),w(k)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:w,nodeOrigin:O,elevateNodesOnSelect:S,nodeExtent:k,zIndexMode:C}=g();v[0][0]===k[0][0]&&v[0][1]===k[0][1]&&v[1][0]===k[1][0]&&v[1][1]===k[1][1]||(RF(y,x,w,{nodeOrigin:O,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:C}),m({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:w,panZoom:O,translateExtent:S}=g();return Bpt({delta:v,panZoom:O,transform:y,translateExtent:S,width:x,height:w})},setCenter:async(v,y,x)=>{const{width:w,height:O,maxZoom:S,panZoom:k}=g();if(!k)return!1;const C=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:S;return await k.setViewport({x:w/2-v*C,y:O/2-y*C,zoom:C},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{m({connection:{...Lje}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...gJ()})}},Object.is);function UNe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>Jgt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return a.jsx(mmt,{value:g,children:a.jsx(Bmt,{children:m})})}function ebt({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(SP)?a.jsx(a.Fragment,{children:e}):a.jsx(UNe,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const tbt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function nbt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:R,onNodesDelete:_,onEdgesDelete:j,onDelete:T,onSelectionChange:N,onSelectionDragStart:A,onSelectionDrag:P,onSelectionDragStop:D,onSelectionContextMenu:M,onSelectionStart:L,onSelectionEnd:U,onBeforeDelete:I,connectionMode:H,connectionLineType:K=mm.Bezier,connectionLineStyle:F,connectionLineComponent:W,connectionLineContainerStyle:V,deleteKeyCode:X="Backspace",selectionKeyCode:ie="Shift",selectionOnDrag:Q=!1,selectionMode:Z=ZS.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:Ee=tE()?"Meta":"Control",zoomActivationKeyCode:Y=tE()?"Meta":"Control",snapToGrid:G,snapGrid:te,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:Ne,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:se,nodesFocusable:Se,nodeOrigin:Le=hNe,edgesFocusable:be,edgesReconnectable:Ve,elementsSelectable:ve=!0,defaultViewport:Re=Amt,minZoom:ne=.5,maxZoom:ge=2,translateExtent:Ce=YS,preventScrolling:ke=!0,nodeExtent:Ke,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:ue=!0,zoomOnPinch:xe=!0,panOnScroll:Te=!1,panOnScrollSpeed:qe=.5,panOnScrollMode:De=Jb.Free,zoomOnDoubleClick:At=!0,panOnDrag:It=!0,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt=1,nodeClickDistance:jt=0,children:Nt,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Me,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht=10,onNodesChange:cn,onEdgesChange:hn,noDragClassName:Ge="nodrag",noWheelClassName:bt="nowheel",noPanClassName:St="nopan",fitView:dn,fitViewOptions:Rt,connectOnClick:$e,attributionPosition:ot,proOptions:vn,defaultEdgeOptions:Ye,elevateNodesOnSelect:mt=!0,elevateEdgesOnSelect:_n=!1,disableKeyboardA11y:Vt=!1,autoPanOnConnect:Ai,autoPanOnNodeDrag:jn,autoPanOnSelection:Hn=!0,autoPanSpeed:En,connectionRadius:vi,isValidConnection:Fn,onError:di,style:wr,id:mr,nodeDragThreshold:ir,connectionDragThreshold:ze,viewport:kt,onViewportChange:nn,width:Nn,height:re,colorMode:xi="light",debug:is,onScroll:$r,ariaLabelConfig:qn,zIndexMode:oi="basic",...Vi},Fr){const ea=mr||"1",za=Rmt(xi),Hr=p.useCallback(vo=>{vo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),$r==null||$r(vo)},[$r]);return a.jsx("div",{"data-testid":"rf__wrapper",...Vi,onScroll:Hr,style:{...wr,...tbt},ref:Fr,className:Mo(["react-flow",r,za]),id:mr,role:"application",children:a.jsxs(ebt,{nodes:e,edges:t,width:Nn,height:re,fitView:dn,fitViewOptions:Rt,minZoom:ne,maxZoom:ge,nodeOrigin:Le,nodeExtent:Ke,zIndexMode:oi,children:[a.jsx(Nmt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:se,nodesFocusable:Se,edgesFocusable:be,edgesReconnectable:Ve,elementsSelectable:ve,elevateNodesOnSelect:mt,elevateEdgesOnSelect:_n,minZoom:ne,maxZoom:ge,nodeExtent:Ke,onNodesChange:cn,onEdgesChange:hn,snapToGrid:G,snapGrid:te,connectionMode:H,translateExtent:Ce,connectOnClick:$e,defaultEdgeOptions:Ye,fitView:dn,fitViewOptions:Rt,onNodesDelete:_,onEdgesDelete:j,onDelete:T,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:R,onSelectionDrag:P,onSelectionDragStart:A,onSelectionDragStop:D,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:St,nodeOrigin:Le,rfId:ea,autoPanOnConnect:Ai,autoPanOnNodeDrag:jn,autoPanSpeed:En,onError:di,connectionRadius:vi,isValidConnection:Fn,selectNodesOnDrag:Ne,nodeDragThreshold:ir,connectionDragThreshold:ze,onBeforeDelete:I,debug:is,ariaLabelConfig:qn,zIndexMode:oi}),a.jsx(Ygt,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:o,connectionLineType:K,connectionLineStyle:F,connectionLineComponent:W,connectionLineContainerStyle:V,selectionKeyCode:ie,selectionOnDrag:Q,selectionMode:Z,deleteKeyCode:X,multiSelectionKeyCode:Ee,panActivationKeyCode:ce,zoomActivationKeyCode:Y,onlyRenderVisibleElements:ye,defaultViewport:Re,translateExtent:Ce,minZoom:ne,maxZoom:ge,preventScrolling:ke,zoomOnScroll:ue,zoomOnPinch:xe,zoomOnDoubleClick:At,panOnScroll:Te,panOnScrollSpeed:qe,panOnScrollMode:De,panOnDrag:It,autoPanOnSelection:Hn,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt,nodeClickDistance:jt,onSelectionContextMenu:M,onSelectionStart:L,onSelectionEnd:U,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Me,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht,defaultMarkerColor:it,noDragClassName:Ge,noWheelClassName:bt,noPanClassName:St,rfId:ea,disableKeyboardA11y:Vt,nodeExtent:Ke,viewport:kt,onViewportChange:nn}),a.jsx(Tmt,{onSelectionChange:N}),Nt,a.jsx(Omt,{proOptions:vn,position:ot}),a.jsx(wmt,{rfId:ea,disableKeyboardA11y:Vt})]})})}var ibt=bNe(nbt);const rbt=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function sbt({children:e}){const t=zi(rbt);return t?ri.createPortal(e,t):null}function obt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>mNe(r,s)),[]);return[t,n,i]}function abt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>gNe(r,s)),[]);return[t,n,i]}const lbt=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!JQ(n.userNode))return!1;return!0};function cbt(e={includeHiddenNodes:!1}){return zi(lbt(e))}function ubt({dimensions:e,lineWidth:t,variant:n,className:i}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Mo(["react-flow__background-pattern",n,i])})}function dbt({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Mo(["react-flow__background-pattern","dots",t])})}var Qm;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Qm||(Qm={}));const fbt={[Qm.Dots]:1,[Qm.Lines]:1,[Qm.Cross]:6},hbt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function QNe({id:e,variant:t=Qm.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=zi(hbt,As),g=i||fbt[t],b=t===Qm.Dots,v=t===Qm.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],w=g*h[2],O=Array.isArray(s)?s:[s,s],S=v?[w,w]:x,k=[O[0]*h[2]||1+S[0]/2,O[1]*h[2]||1+S[1]/2],C=`${m}${e||""}`;return a.jsxs("svg",{className:Mo(["react-flow__background",u]),style:{...c,...TP,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:C,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:b?a.jsx(dbt,{radius:w/2,className:d}):a.jsx(ubt,{dimensions:S,lineWidth:r,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}QNe.displayName="Background";const pbt=p.memo(QNe);function mbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function gbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function ybt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function vbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function BA({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Mo(["react-flow__controls-button",t]),...n,children:e})}const xbt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zNe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":m}){const g=_s(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=zi(xbt,As),{zoomIn:w,zoomOut:O,fitView:S}=CP(),k=()=>{w(),s==null||s()},C=()=>{O(),o==null||o()},E=()=>{S(r),l==null||l()},R=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},_=h==="horizontal"?"horizontal":"vertical";return a.jsxs(EP,{className:Mo(["react-flow__controls",_,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(BA,{onClick:k,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:a.jsx(mbt,{})}),a.jsx(BA,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:a.jsx(gbt,{})})]}),n&&a.jsx(BA,{className:"react-flow__controls-fitview",onClick:E,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:a.jsx(bbt,{})}),i&&a.jsx(BA,{className:"react-flow__controls-interactive",onClick:R,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?a.jsx(vbt,{}):a.jsx(ybt,{})}),d]})}zNe.displayName="Controls";const wbt=p.memo(zNe);function Obt({id:e,x:t,y:n,width:i,height:r,style:s,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},v=o||g||b;return a.jsx("rect",{className:Mo(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:r,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:m?y=>m(y,e):void 0})}const kbt=p.memo(Obt),Sbt=e=>e.nodes.map(t=>t.id),p5=e=>e instanceof Function?e:()=>e;function Ebt({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=kbt,onClick:o}){const l=zi(Sbt,As),c=p5(t),u=p5(e),d=p5(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(Tbt,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:o,shapeRendering:f},h))})}function Cbt({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:m}=zi(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:w,height:O}=Cp(v);return{node:v,x:y,y:x,width:w,height:O}},As);return!u||u.hidden||!JQ(u)?null:a.jsx(l,{x:d,y:f,width:h,height:m,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:r,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:c,id:u.id})}const Tbt=p.memo(Cbt);var Abt=p.memo(Ebt);const _bt=200,jbt=150,Nbt=e=>!e.hidden,Rbt=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Qje(jC(e.nodeLookup,{filter:Nbt}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ibt="react-flow__minimap-desc";function VNe({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:w=1,offsetScale:O=5}){const S=_s(),k=p.useRef(null),{boundingRect:C,viewBB:E,rfId:R,panZoom:_,translateExtent:j,flowWidth:T,flowHeight:N,ariaLabelConfig:A}=zi(Rbt,As),P=(e==null?void 0:e.width)??_bt,D=(e==null?void 0:e.height)??jbt,M=C.width/P,L=C.height/D,U=Math.max(M,L),I=U*P,H=U*D,K=O*U,F=C.x-(I-C.width)/2-K,W=C.y-(H-C.height)/2-K,V=I+K*2,X=H+K*2,ie=`${Ibt}-${R}`,Q=p.useRef(0),Z=p.useRef();Q.current=U,p.useEffect(()=>{if(k.current&&_)return Z.current=Gpt({domNode:k.current,panZoom:_,getTransform:()=>S.getState().transform,getViewScale:()=>Q.current}),()=>{var G;(G=Z.current)==null||G.destroy()}},[_]),p.useEffect(()=>{var G;(G=Z.current)==null||G.update({translateExtent:j,width:T,height:N,inversePan:x,pannable:b,zoomStep:w,zoomable:v})},[b,v,x,w,j,T,N]);const ce=m?G=>{var Ne;const[te,ye]=((Ne=Z.current)==null?void 0:Ne.pointer(G))||[0,0];m(G,{x:te,y:ye})}:void 0,Ee=g?p.useCallback((G,te)=>{const ye=S.getState().nodeLookup.get(te).internals.userNode;g(G,ye)},[]):void 0,Y=y??A["minimap.ariaLabel"];return a.jsx(EP,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*U:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Mo(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:P,height:D,viewBox:`${F} ${W} ${V} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ie,ref:k,onClick:ce,children:[Y&&a.jsx("title",{id:ie,children:Y}),a.jsx(Abt,{onClick:Ee,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-K},${W-K}h${V+K*2}v${X+K*2}h${-V-K*2}z - M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}VNe.displayName="MiniMap";p.memo(VNe);const Pbt=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Dbt={[rw.Line]:"right",[rw.Handle]:"bottom-right"};function Mbt({nodeId:e,position:t,variant:n=rw.Handle,className:i,style:r=void 0,children:s,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=wNe(),w=typeof e=="string"?e:x,O=_s(),S=p.useRef(null),k=n===rw.Handle,C=zi(p.useCallback(Pbt(k&&m),[k,m]),As),E=p.useRef(null),R=t??Dbt[n];p.useEffect(()=>{if(!(!S.current||!w))return E.current||(E.current=lmt({domNode:S.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:j,transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P,domNode:D}=O.getState();return{nodeLookup:j,transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P,paneDomNode:D}},onChange:(j,T)=>{const{triggerNodeChanges:N,nodeLookup:A,parentLookup:P,nodeOrigin:D}=O.getState(),M=[],L={x:j.x,y:j.y},U=A.get(w);if(U&&U.expandParent&&U.parentId){const I=U.origin??D,H=j.width??U.measured.width??0,K=j.height??U.measured.height??0,F={id:U.id,parentId:U.parentId,rect:{width:H,height:K,...Vje({x:j.x??U.position.x,y:j.y??U.position.y},{width:H,height:K},U.parentId,A,I)}},W=sz([F],A,P,D);M.push(...W),L.x=j.x?Math.max(I[0]*H,j.x):void 0,L.y=j.y?Math.max(I[1]*K,j.y):void 0}if(L.x!==void 0&&L.y!==void 0){const I={id:w,type:"position",position:{...L}};M.push(I)}if(j.width!==void 0&&j.height!==void 0){const H={id:w,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};M.push(H)}for(const I of T){const H={...I,type:"position"};M.push(H)}N(M)},onEnd:({width:j,height:T})=>{const N={id:w,type:"dimensions",resizing:!1,dimensions:{width:j,height:T}};O.getState().triggerNodeChanges([N])}})),E.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{var j;(j=E.current)==null||j.destroy()}},[R,l,c,u,d,f,b,v,y,g]);const _=R.split("-");return a.jsx("div",{className:Mo(["react-flow__resize-control","nodrag",..._,n,i]),ref:S,style:{...r,scale:C,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:s})}p.memo(Mbt);var HNe=Object.defineProperty,Lbt=(e,t,n)=>t in e?HNe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$bt=(e,t)=>{for(var n in t)HNe(e,n,{get:t[n],enumerable:!0})},Fbt=(e,t,n)=>Lbt(e,t+"",n),qNe={};$bt(qNe,{Graph:()=>ed,alg:()=>az,json:()=>KNe,version:()=>Qbt});var Bbt=Object.defineProperty,WNe=(e,t)=>{for(var n in t)Bbt(e,n,{get:t[n],enumerable:!0})},ed=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let i=n;i!==void 0;i=this.parent(i))if(i===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let i=new Set(n);for(let r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,o])=>{t(s)&&n.setNode(s,o)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let i={},r=s=>{let o=this.parent(s);return!o||n.hasNode(o)?(i[s]=o??void 0,o??void 0):o in i?i[o]:r(o)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,r(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((i,r)=>(n!==void 0?this.setEdge(i,r,n):this.setEdge(i,r),r)),this}setEdge(t,n,i,r){let s,o,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,o=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,o=n,l=r,arguments.length>2&&(c=i,u=!0)),s=""+s,o=""+o,l!==void 0&&(l=""+l);let d=WO(this._isDirected,s,o,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(o),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,o,l);let f=Ubt(this._isDirected,s,o,l);return s=f.v,o=f.w,Object.freeze(f),this._edgeObjs[d]=f,bJ(this._preds[o],s),bJ(this._sucs[s],o),this._in[o][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,i){let r=arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i);return this._edgeLabels[r]}edgeAsObj(t,n,i){let r=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof r!="object"?{label:r}:r}hasEdge(t,n,i){return(arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let r=arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i),s=this._edgeObjs[r];if(s){let o=s.v,l=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],yJ(this._preds[l],o),yJ(this._sucs[o],l),delete this._in[l][r],delete this._out[o][r],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,i){if(!t)return;let r=Object.values(t);return i?r.filter(s=>s.v===n&&s.w===i||s.v===i&&s.w===n):r}};function bJ(e,t){e[t]?e[t]++:e[t]=1}function yJ(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function WO(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let o=r;r=s,s=o}return r+""+s+""+(i===void 0?"\0":i)}function Ubt(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let l=r;r=s,s=l}let o={v:r,w:s};return i&&(o.name=i),o}function m5(e,t){return WO(e,t.v,t.w,t.name)}var Qbt="4.0.1",KNe={};WNe(KNe,{read:()=>qbt,write:()=>zbt});function zbt(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Vbt(e),edges:Hbt(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Vbt(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),r={v:t};return n!==void 0&&(r.value=n),i!==void 0&&(r.parent=i),r})}function Hbt(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function qbt(e){let t=new ed(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var az={};WNe(az,{CycleException:()=>IN,bellmanFord:()=>GNe,components:()=>Gbt,dijkstra:()=>RN,dijkstraAll:()=>Zbt,findCycles:()=>Jbt,floydWarshall:()=>tyt,isAcyclic:()=>iyt,postorder:()=>syt,preorder:()=>oyt,prim:()=>ayt,shortestPaths:()=>lyt,tarjan:()=>YNe,topsort:()=>ZNe});var Wbt=()=>1;function GNe(e,t,n,i){return Kbt(e,String(t),n||Wbt,i||function(r){return e.outEdges(r)})}function Kbt(e,t,n,i){let r={},s,o=0,l=e.nodes(),c=function(f){let h=n(f);r[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,i=String(e);if(!(i in n)){let r=this._arr,s=r.length;return n[i]=s,r.push({key:i,priority:t}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,r=e;n>1,!(t[i].priority1;function RN(e,t,n,i){let r=function(s){return e.outEdges(s)};return Ybt(e,String(t),n||Xbt,i||r)}function Ybt(e,t,n,i){let r={},s=new XNe,o,l,c=function(u){let d=u.v!==o?u.v:u.w,f=r[d],h=n(u),m=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);m0&&(o=s.removeMin(),l=r[o],l.distance!==Number.POSITIVE_INFINITY);)i(o).forEach(c);return r}function Zbt(e,t,n){return e.nodes().reduce(function(i,r){return i[r]=RN(e,r,t,n),i},{})}function YNe(e){let t=0,n=[],i={},r=[];function s(o){let l=i[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(c){c in i?i[c].onStack&&(l.lowlink=Math.min(l.lowlink,i[c].index)):(s(c),l.lowlink=Math.min(l.lowlink,i[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(o!==u);r.push(c)}}return e.nodes().forEach(function(o){o in i||s(o)}),r}function Jbt(e){return YNe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var eyt=()=>1;function tyt(e,t,n){return nyt(e,t||eyt,n||function(i){return e.outEdges(i)})}function nyt(e,t,n){let i={},r=e.nodes();return r.forEach(function(s){i[s]={},i[s][s]={distance:0,predecessor:""},r.forEach(function(o){s!==o&&(i[s][o]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(o){let l=o.v===s?o.w:o.v,c=t(o);i[s][l]={distance:c,predecessor:s}})}),r.forEach(function(s){let o=i[s];r.forEach(function(l){let c=i[l];r.forEach(function(u){let d=c[s],f=o[u],h=c[u],m=d.distance+f.distance;m{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},o={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);r=JNe(e,l,n==="post",o,s,i,r)}),r}function JNe(e,t,n,i,r,s,o){return t in i||(i[t]=!0,n||(o=s(o,t)),r(t).forEach(function(l){o=JNe(e,l,n,i,r,s,o)}),n&&(o=s(o,t))),o}function eRe(e,t,n){return ryt(e,t,n,function(i,r){return i.push(r),i},[])}function syt(e,t){return eRe(e,t,"post")}function oyt(e,t){return eRe(e,t,"pre")}function ayt(e,t){let n=new ed,i={},r=new XNe,s;function o(c){let u=c.v===s?c.w:c.v,d=r.priority(u);if(d!==void 0){let f=t(c);f0;){if(s=r.removeMin(),s in i)n.setEdge(s,i[s]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(s).forEach(o)}return n}function lyt(e,t,n,i){return cyt(e,t,n,i??(r=>{let s=e.outEdges(r);return s??[]}))}function cyt(e,t,n,i){if(n===void 0)return RN(e,t,n,i);let r=!1,s=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+r.weight,minlen:Math.max(i.minlen,r.minlen)})}),t}function tRe(e){let t=new ed({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function vJ(e,t){let n=e.x,i=e.y,r=t.x-n,s=t.y-i,o=e.width/2,l=e.height/2;if(!r&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*o>Math.abs(r)*l?(s<0&&(l=-l),c=l*r/s,u=l):(r<0&&(o=-o),c=o,u=o*s/r),{x:n+c,y:i+u}}function IC(e){let t=iE(iRe(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),r=i.rank;r!==void 0&&(t[r]||(t[r]=[]),t[r][i.order]=n)}),t}function dyt(e){let t=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),n=xf(Math.min,t);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function fyt(e){let t=e.nodes().map(o=>e.node(o).rank).filter(o=>o!==void 0),n=xf(Math.min,t),i=[];e.nodes().forEach(o=>{let l=e.node(o).rank-n;i[l]||(i[l]=[]),i[l].push(o)});let r=0,s=e.graph().nodeRankFactor;Array.from(i).forEach((o,l)=>{o===void 0&&l%s!==0?--r:o!==void 0&&r&&o.forEach(c=>e.node(c).rank+=r)})}function xJ(e,t,n,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=i),Gw(e,"border",r,t)}function hyt(e,t=nRe){let n=[];for(let i=0;inRe){let n=hyt(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function iRe(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return xf(Math.max,t)}function pyt(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function rRe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function sRe(e,t){return t()}var myt=0;function lz(e){let t=++myt;return e+(""+t)}function iE(e,t,n=1){t==null&&(t=e,e=0);let i=s=>sti[t]:n=t,Object.entries(e).reduce((i,[r,s])=>(i[r]=n(s,r),i),{})}function gyt(e,t){return e.reduce((n,i,r)=>(n[i]=t[r],n),{})}var _P="\0",byt="3.0.0",yyt=class{constructor(){Fbt(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return wJ(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&wJ(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,vyt)),n=n._prev;return"["+e.join(", ")+"]"}};function wJ(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function vyt(e,t){if(e!=="_next"&&e!=="_prev")return t}var xyt=yyt,wyt=()=>1;function Oyt(e,t){if(e.nodeCount()<=1)return[];let n=Syt(e,t||wyt);return kyt(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function kyt(e,t,n){var i;let r=[],s=t[t.length-1],o=t[0],l;for(;e.nodeCount();){for(;l=o.dequeue();)g5(e,t,n,l);for(;l=s.dequeue();)g5(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(i=t[c])==null?void 0:i.dequeue(),l){r=r.concat(g5(e,t,n,l,!0)||[]);break}}}return r}function g5(e,t,n,i,r){let s=[],o=r?s:void 0;return(e.inEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);r&&s.push({v:l.v,w:l.w}),u.out-=c,DF(t,n,u)}),(e.outEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,DF(t,n,d)}),e.removeNode(i.v),o}function Syt(e,t){let n=new ed,i=0,r=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);r=Math.max(r,f.out+=u),i=Math.max(i,h.in+=u)});let s=Eyt(r+i+3).map(()=>new xyt),o=i+1;return n.nodes().forEach(l=>{DF(s,o,n.node(l))}),{graph:n,buckets:s,zeroIdx:o}}function DF(e,t,n){var i,r,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(r=e[e.length-1])==null||r.enqueue(n):(i=e[0])==null||i.enqueue(n)}function Eyt(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,lz("rev"))});function t(n){return i=>n.edge(i).weight}}function Tyt(e){let t=[],n={},i={};function r(s){Object.hasOwn(i,s)||(i[s]=!0,n[s]=!0,e.outEdges(s).forEach(o=>{Object.hasOwn(n,o.w)?t.push(o):r(o.w)}),delete n[s])}return e.nodes().forEach(r),t}function Ayt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function _yt(e){e.graph().dummyChains=[],e.edges().forEach(t=>jyt(e,t))}function jyt(e,t){let n=t.v,i=e.node(n).rank,r=t.w,s=e.node(r).rank,o=t.name,l=e.edge(t),c=l.labelRank;if(s===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i{let n=e.node(t),i=n.edgeLabel,r;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}function cz(e){let t={};function n(i){let r=e.node(i);if(Object.hasOwn(t,i))return r.rank;t[i]=!0;let s=e.outEdges(i),o=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=xf(Math.min,o);return l===Number.POSITIVE_INFINITY&&(l=0),r.rank=l}e.sources().forEach(n)}function sw(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var oRe=Ryt;function Ryt(e){let t=new ed({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],r=e.nodeCount();t.setNode(i,{});let s,o;for(;Iyt(t,e){let o=s.v,l=i===o?s.w:o;!e.hasNode(l)&&!sw(t,s)&&(e.setNode(l,{}),e.setEdge(i,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Pyt(e,t){return t.edges().reduce((n,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=sw(t,i)),rt.node(i).rank+=n)}var{preorder:Myt,postorder:Lyt}=az,$yt=qy;qy.initLowLimValues=dz;qy.initCutValues=uz;qy.calcCutValue=aRe;qy.leaveEdge=cRe;qy.enterEdge=uRe;qy.exchangeEdges=dRe;function qy(e){e=uyt(e),cz(e);let t=oRe(e);dz(t),uz(t,e);let n,i;for(;n=cRe(t);)i=uRe(t,e,n),dRe(t,e,n,i)}function uz(e,t){let n=Lyt(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>Fyt(e,t,i))}function Fyt(e,t,n){let i=e.node(n).parent,r=e.edge(n,i);r.cutvalue=aRe(e,t,n)}function aRe(e,t,n){let i=e.node(n).parent,r=!0,s=t.edge(n,i),o=0;s||(r=!1,s=t.edge(i,n)),o=s.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==i){let f=u===r,h=t.edge(c).weight;if(o+=f?h:-h,Uyt(e,n,d)){let m=e.edge(n,d).cutvalue;o+=f?-m:m}}}),o}function dz(e,t){arguments.length<2&&(t=e.nodes()[0]),lRe(e,{},1,t)}function lRe(e,t,n,i,r){let s=n,o=e.node(i);t[i]=!0;let l=e.neighbors(i);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=lRe(e,t,n,c,i))}),o.low=s,o.lim=n++,r?o.parent=r:delete o.parent,n}function cRe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function uRe(e,t,n){let i=n.v,r=n.w;t.hasEdge(i,r)||(i=n.w,r=n.v);let s=e.node(i),o=e.node(r),l=s,c=!1;return s.lim>o.lim&&(l=o,c=!0),t.edges().filter(u=>c===OJ(e,e.node(u.v),l)&&c!==OJ(e,e.node(u.w),l)).reduce((u,d)=>sw(t,d)!e.node(r).parent);if(!n)return;let i=Myt(e,[n]);i=i.slice(1),i.forEach(r=>{let s=e.node(r).parent,o=t.edge(r,s),l=!1;o||(o=t.edge(s,r),l=!0),t.node(r).rank=t.node(s).rank+(l?o.minlen:-o.minlen)})}function Uyt(e,t,n){return e.hasEdge(t,n)}function OJ(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Qyt=zyt;function zyt(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":kJ(e);break;case"tight-tree":Hyt(e);break;case"longest-path":Vyt(e);break;case"none":break;default:kJ(e)}}var Vyt=cz;function Hyt(e){cz(e),oRe(e)}function kJ(e){$yt(e)}var qyt=Wyt;function Wyt(e){let t=Gyt(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),r=i.edgeObj,s=Kyt(e,t,r.v,r.w),o=s.path,l=s.lca,c=0,u=o[c],d=!0;for(;n!==r.w;){if(i=e.node(n),d){for(;(u=o[c])!==l&&e.node(u).maxRanko||l>t[c].lim));let u=c,d=i;for(;(d=e.parent(d))!==u;)s.push(d);return{path:r.concat(s.reverse()),lca:u}}function Gyt(e){let t={},n=0;function i(r){let s=n;e.children(r).forEach(i),t[r]={low:s,lim:n++}}return e.children(_P).forEach(i),t}function Xyt(e){let t=Gw(e,"root",{},"_root"),n=Yyt(e),i=Object.values(n),r=xf(Math.max,i)-1,s=2*r+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let o=Zyt(e)+1;e.children(_P).forEach(l=>fRe(e,t,s,o,r,n,l)),e.graph().nodeRankFactor=s}function fRe(e,t,n,i,r,s,o){var l;let c=e.children(o);if(!c.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let u=xJ(e,"_bt"),d=xJ(e,"_bb"),f=e.node(o);e.setParent(u,o),f.borderTop=u,e.setParent(d,o),f.borderBottom=d,c.forEach(h=>{var m;fRe(e,t,n,i,r,s,h);let g=e.node(h),b=g.borderTop?g.borderTop:h,v=g.borderBottom?g.borderBottom:h,y=g.borderTop?i:2*i,x=b!==v?1:r-((m=s[o])!=null?m:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,u,{weight:0,minlen:r+((l=s[o])!=null?l:0)})}function Yyt(e){let t={};function n(i,r){let s=e.children(i);s&&s.length&&s.forEach(o=>n(o,r+1)),t[i]=r}return e.children(_P).forEach(i=>n(i,1)),t}function Zyt(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Jyt(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var e0t=t0t;function t0t(e){function t(n){let i=e.children(n),r=e.node(n);if(i.length&&i.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let s=r.minRank,o=r.maxRank+1;sEJ(e.node(t))),e.edges().forEach(t=>EJ(e.edge(t)))}function EJ(e){let t=e.width;e.width=e.height,e.height=t}function r0t(e){e.nodes().forEach(t=>b5(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(b5),Object.hasOwn(i,"y")&&b5(i)})}function b5(e){e.y=-e.y}function s0t(e){e.nodes().forEach(t=>y5(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(y5),Object.hasOwn(i,"x")&&y5(i)})}function y5(e){let t=e.x;e.x=e.y,e.y=t}function o0t(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),i=n.map(l=>e.node(l).rank),r=xf(Math.max,i),s=iE(r+1).map(()=>[]);function o(l){if(t[l])return;t[l]=!0;let c=e.node(l);s[c.rank].push(l);let u=e.successors(l);u&&u.forEach(o)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(o),s}function a0t(e,t){let n=0;for(let i=1;id)),r=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:i[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),s=1;for(;s{let d=u.pos+s;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function c0t(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let r=i.reduce((s,o)=>{let l=e.edge(o),c=e.node(o.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}})}function u0t(e,t){let n={};e.forEach((r,s)=>{let o={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(o.barycenter=r.barycenter,o.weight=r.weight),n[r.v]=o}),t.edges().forEach(r=>{let s=n[r.v],o=n[r.w];s!==void 0&&o!==void 0&&(o.indegree++,s.out.push(o))});let i=Object.values(n).filter(r=>!r.indegree);return d0t(i)}function d0t(e){let t=[];function n(r){return s=>{s.merged||(s.barycenter===void 0||r.barycenter===void 0||s.barycenter>=r.barycenter)&&f0t(r,s)}}function i(r){return s=>{s.in.push(r),--s.indegree===0&&e.push(s)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(i(r))}return t.filter(r=>!r.merged).map(r=>PN(r,["vs","i","barycenter","weight"]))}function f0t(e,t){let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}function h0t(e,t){let n=pyt(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,r=n.rhs.sort((d,f)=>f.i-d.i),s=[],o=0,l=0,c=0;i.sort(p0t(!!t)),c=CJ(s,r,c),i.forEach(d=>{c+=d.vs.length,s.push(d.vs),o+=d.barycenter*d.weight,l+=d.weight,c=CJ(s,r,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=o/l,u.weight=l),u}function CJ(e,t,n){let i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),e.push(i.vs),n++;return n}function p0t(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function pRe(e,t,n,i){let r=e.children(t),s=e.node(t),o=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};o&&(r=r.filter(h=>h!==o&&h!==l));let u=c0t(e,r);u.forEach(h=>{if(e.children(h.v).length){let m=pRe(e,h.v,n,i);c[h.v]=m,Object.hasOwn(m,"barycenter")&&g0t(h,m)}});let d=u0t(u,n);m0t(d,c);let f=h0t(d,i);if(o&&l){f.vs=[o,f.vs,l].flat(1);let h=e.predecessors(o);if(h&&h.length){let m=e.node(h[0]),g=e.predecessors(l),b=e.node(g[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+m.order+b.order)/(f.weight+2),f.weight+=2}}return f}function m0t(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function g0t(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function b0t(e,t,n,i){i||(i=e.nodes());let r=y0t(e),s=new ed({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(o=>e.node(o));return i.forEach(o=>{let l=e.node(o),c=e.parent(o);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){s.setNode(o),s.setParent(o,c||r);let u=e[n](o);u&&u.forEach(d=>{let f=d.v===o?d.w:d.v,h=s.edge(f,o),m=h!==void 0?h.weight:0;s.setEdge(f,o,{weight:e.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(o,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function y0t(e){let t;for(;e.hasNode(t=lz("_root")););return t}function v0t(e,t,n){let i={},r;n.forEach(s=>{let o=e.parent(s),l,c;for(;o;){if(l=e.parent(o),l?(c=i[l],i[l]=o):(c=r,r=o),c&&c!==o){t.setEdge(c,o);return}o=l}})}function mRe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,mRe);return}let n=iRe(e),i=TJ(e,iE(1,n+1),"inEdges"),r=TJ(e,iE(n-1,-1,-1),"outEdges"),s=o0t(e);if(AJ(e,s),t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){x0t(u%2?i:r,u%4>=2,c),s=IC(e);let f=a0t(e,s);f{i.has(s)||i.set(s,[]),i.get(s).push(o)};for(let s of e.nodes()){let o=e.node(s);if(typeof o.rank=="number"&&r(o.rank,s),typeof o.minRank=="number"&&typeof o.maxRank=="number")for(let l=o.minRank;l<=o.maxRank;l++)l!==o.rank&&r(l,s)}return t.map(function(s){return b0t(e,s,n,i.get(s)||[])})}function x0t(e,t,n){let i=new ed;e.forEach(function(r){n.forEach(l=>i.setEdge(l.left,l.right));let s=r.graph().root,o=pRe(r,s,i,t);o.vs.forEach((l,c)=>r.node(l).order=c),v0t(r,i,o.vs)})}function AJ(e,t){Object.values(t).forEach(n=>n.forEach((i,r)=>e.node(i).order=r))}function w0t(e,t){let n={};function i(r,s){let o=0,l=0,c=r.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=k0t(e,d),m=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(g=>{let b=e.predecessors(g);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(m=>{if(m===void 0)return;let g=e.node(m);g.dummy&&(g.orderu)&&gRe(n,m,f)})}})}function r(s,o){let l=-1,c=-1,u=0;return o.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let m=h[0];if(m===void 0)return;c=e.node(m).order,i(o,u,f,l,c),u=f,l=c}}i(o,u,o.length,c,s.length)}),o}return t.length&&t.reduce(r),n}function k0t(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function gRe(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];i||(e[t]=i={}),i[n]=!0}function S0t(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];return i!==void 0&&Object.hasOwn(i,n)}function E0t(e,t,n,i){let r={},s={},o={};return t.forEach(l=>{l.forEach((c,u)=>{r[c]=c,s[c]=c,o[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=i(u);if(d&&d.length){let f=d.sort((m,g)=>{let b=o[m],v=o[g];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let m=Math.floor(h),g=Math.ceil(h);m<=g;++m){let b=f[m];if(b===void 0)continue;let v=o[b];if(v!==void 0&&s[u]===u&&c{var y;let x=(y=s[v.v])!=null?y:0,w=o.edge(v);return Math.max(b,x+(w!==void 0?w:0))},0):s[m]=0}function d(m){let g=o.outEdges(m),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((y,x)=>{let w=s[x.w],O=o.edge(x);return Math.min(y,(w!==void 0?w:0)-(O!==void 0?O:0))},Number.POSITIVE_INFINITY));let v=e.node(m);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(s[m]=Math.max(s[m]!==void 0?s[m]:0,b))}function f(m){return o.predecessors(m)||[]}function h(m){return o.successors(m)||[]}return c(u,f),c(d,h),Object.keys(i).forEach(m=>{var g;let b=n[m];b!==void 0&&(s[m]=(g=s[b])!=null?g:0)}),s}function T0t(e,t,n,i){let r=new ed,s=e.graph(),o=R0t(s.nodesep,s.edgesep,i);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(r.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=r.edge(f,d);r.setEdge(f,d,Math.max(o(e,u,c),h||0))}}c=u}})}),r}function A0t(e,t){return Object.values(t).reduce((n,i)=>{let r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([l,c])=>{let u=I0t(e,l)/2;r=Math.max(c+u,r),s=Math.min(c-u,s)});let o=r-s;return o{["l","r"].forEach(o=>{let l=s+o,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=i-xf(Math.min,u);o!=="l"&&(d=r-xf(Math.max,u)),d&&(e[l]=AP(c,f=>f+d))})})}function j0t(e,t=void 0){let n=e.ul;return n?AP(n,(i,r)=>{var s,o;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[r]!==void 0)return u[r]}let l=Object.values(e).map(c=>{let u=c[r];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((s=l[1])!=null?s:0)+((o=l[2])!=null?o:0))/2}):{}}function N0t(e){let t=IC(e),n=Object.assign(w0t(e,t),O0t(e,t)),i={},r;["u","d"].forEach(o=>{r=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(r=r.map(d=>Object.values(d).reverse()));let c=E0t(e,r,n,d=>(o==="u"?e.predecessors(d):e.successors(d))||[]),u=C0t(e,r,c.root,c.align,l==="r");l==="r"&&(u=AP(u,d=>-d)),i[o+l]=u})});let s=A0t(e,i);return _0t(i,s),j0t(i,e.graph().align)}function R0t(e,t,n){return(i,r,s)=>{let o=i.node(r),l=i.node(s),c=0,u;if(c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(o.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function I0t(e,t){return e.node(t).width}function P0t(e){e=tRe(e),D0t(e),Object.entries(N0t(e)).forEach(([t,n])=>e.node(t).x=n)}function D0t(e){let t=IC(e),n=e.graph(),i=n.ranksep,r=n.rankalign,s=0;t.forEach(o=>{let l=o.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);o.forEach(c=>{let u=e.node(c);r==="top"?u.y=s+u.height/2:r==="bottom"?u.y=s+l-u.height/2:u.y=s+l/2}),s+=l+i})}function M0t(e,t={}){let n=t.debugTiming?rRe:sRe;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>q0t(e));return n(" runLayout",()=>L0t(i,n,t)),n(" updateInputGraph",()=>$0t(e,i)),i})}function L0t(e,t,n){t(" makeSpaceForEdgeLabels",()=>W0t(e)),t(" removeSelfEdges",()=>nvt(e)),t(" acyclic",()=>Cyt(e)),t(" nestingGraph.run",()=>Xyt(e)),t(" rank",()=>Qyt(tRe(e))),t(" injectEdgeLabelProxies",()=>K0t(e)),t(" removeEmptyRanks",()=>fyt(e)),t(" nestingGraph.cleanup",()=>Jyt(e)),t(" normalizeRanks",()=>dyt(e)),t(" assignRankMinMax",()=>G0t(e)),t(" removeEdgeLabelProxies",()=>X0t(e)),t(" normalize.run",()=>_yt(e)),t(" parentDummyChains",()=>qyt(e)),t(" addBorderSegments",()=>e0t(e)),t(" order",()=>mRe(e,n)),t(" insertSelfEdges",()=>ivt(e)),t(" adjustCoordinateSystem",()=>n0t(e)),t(" position",()=>P0t(e)),t(" positionSelfEdges",()=>rvt(e)),t(" removeBorderNodes",()=>tvt(e)),t(" normalize.undo",()=>Nyt(e)),t(" fixupEdgeLabelCoords",()=>J0t(e)),t(" undoCoordinateSystem",()=>i0t(e)),t(" translateGraph",()=>Y0t(e)),t(" assignNodeIntersects",()=>Z0t(e)),t(" reversePoints",()=>evt(e)),t(" acyclic.undo",()=>Ayt(e))}function $0t(e,t){e.nodes().forEach(n=>{let i=e.node(n),r=t.node(n);i&&(i.x=r.x,i.y=r.y,i.order=r.order,i.rank=r.rank,t.children(n).length&&(i.width=r.width,i.height=r.height))}),e.edges().forEach(n=>{let i=e.edge(n),r=t.edge(n);i.points=r.points,Object.hasOwn(r,"x")&&(i.x=r.x,i.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var F0t=["nodesep","edgesep","ranksep","marginx","marginy"],B0t={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},U0t=["acyclicer","ranker","rankdir","align","rankalign"],Q0t=["width","height","rank"],_J={width:0,height:0},z0t=["minlen","weight","width","height","labeloffset"],V0t={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H0t=["labelpos"];function q0t(e){let t=new ed({multigraph:!0,compound:!0}),n=x5(e.graph());return t.setGraph(Object.assign({},B0t,v5(n,F0t),PN(n,U0t))),e.nodes().forEach(i=>{let r=x5(e.node(i)),s=v5(r,Q0t);Object.keys(_J).forEach(l=>{s[l]===void 0&&(s[l]=_J[l])}),t.setNode(i,s);let o=e.parent(i);o!==void 0&&t.setParent(i,o)}),e.edges().forEach(i=>{let r=x5(e.edge(i));t.setEdge(i,Object.assign({},V0t,v5(r,z0t),PN(r,H0t)))}),t}function W0t(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let i=e.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function K0t(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let i=e.node(t.v),r={rank:(e.node(t.w).rank-i.rank)/2+i.rank,e:t};Gw(e,"edge-proxy",r,"_ep")}})}function G0t(e){let t=0;e.nodes().forEach(n=>{let i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Math.max(t,i.maxRank))}),e.graph().maxRank=t}function X0t(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let i=n;e.edge(i.e).labelRank=n.rank,e.removeNode(t)}})}function Y0t(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,r=0,s=e.graph(),o=s.marginx||0,l=s.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,m=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),i=Math.min(i,f-m/2),r=Math.max(r,f+m/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=o,i-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=i}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=i}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=i)}),s.width=n-t+o,s.height=r-i+l}function Z0t(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),r=e.node(t.w),s,o;n.points?(s=n.points[0],o=n.points[n.points.length-1]):(n.points=[],s=r,o=i),n.points.unshift(vJ(i,s)),n.points.push(vJ(r,o))})}function J0t(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function evt(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function tvt(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),i=e.node(n.borderTop),r=e.node(n.borderBottom),s=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-s.x),n.height=Math.abs(r.y-i.y),n.x=s.x+n.width/2,n.y=i.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function nvt(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function ivt(e){IC(e).forEach(t=>{let n=0;t.forEach((i,r)=>{let s=e.node(i);s.order=r+n,(s.selfEdges||[]).forEach(o=>{Gw(e,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:r+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function rvt(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let i=n,r=e.node(i.e.v),s=r.x+r.width/2,o=r.y,l=n.x-s,c=r.height/2;e.setEdge(i.e,i.label),e.removeNode(t),i.label.points=[{x:s+2*l/3,y:o-c},{x:s+5*l/6,y:o-c},{x:s+l,y:o},{x:s+5*l/6,y:o+c},{x:s+2*l/3,y:o+c}],i.label.x=n.x,i.label.y=n.y}})}function v5(e,t){return AP(PN(e,t),Number)}function x5(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function svt(e){let t=IC(e),n=new ed({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+e.node(i).rank)}),e.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),t.forEach((i,r)=>{let s="layer"+r;n.setNode(s,{rank:"same"}),i.reduce((o,l)=>(n.setEdge(o,l,{style:"invis"}),l))}),n}var ovt={graphlib:qNe,version:byt,layout:M0t,debug:svt,util:{time:rRe,notime:sRe}},jJ=ovt;/*! For license information please see dagre.esm.js.LEGAL.txt */const KO={llm:{labelKey:"buildCanvas.patterns.llm.label",descriptionKey:"buildCanvas.patterns.llm.description",icon:EAe},sequential:{labelKey:"buildCanvas.patterns.sequential.label",descriptionKey:"buildCanvas.patterns.sequential.description",icon:oit},parallel:{labelKey:"buildCanvas.patterns.parallel.label",descriptionKey:"buildCanvas.patterns.parallel.description",icon:Bnt},loop:{labelKey:"buildCanvas.patterns.loop.label",descriptionKey:"buildCanvas.patterns.loop.description",icon:_Ae},a2a:{labelKey:"buildCanvas.patterns.a2a.label",descriptionKey:"buildCanvas.patterns.a2a.description",icon:tP}},MF=220,LF=88,NJ=96,RJ=34,Bk=64,w5=310,Pv=24,bRe=56,$F=40,IJ=40,avt=18,lvt=58,cvt=!1,uvt=e=>e==="sequential"||e==="parallel"||e==="loop";function FF(e,t){const n=e.agentType??"llm";return uvt(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function BF(e,t=[],n="horizontal",i=!1){const r=e.agentType??"llm";if(!FF(e,t))return{width:MF,height:LF};if(i&&e.subAgents.length===0)return{width:w5,height:Bk};const s=e.subAgents.map((f,h)=>BF(f,[...t,h],n,i)),o=s.length?Math.max(...s.map(f=>f.width)):0,l=s.length?Math.max(...s.map(f=>f.height)):0,c=s.length&&r!=="parallel"?bRe:Pv,u=n==="horizontal"?r!=="parallel":r==="parallel",d=s.length?r==="parallel"?avt+IJ:r==="loop"?lvt:0:IJ;return u?{width:Math.max(w5,s.reduce((f,h)=>f+h.width,0)+$F*Math.max(0,s.length-1)+c*2),height:Bk+Pv+l+d+Pv}:{width:Math.max(w5,o+Pv*2),height:Bk+c+s.reduce((f,h)=>f+h.height,0)+$F*Math.max(0,s.length-1)+d+c}}function nO(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function dvt(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function PJ(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function iO(e,t,n,i){const r=(i==null?void 0:i.tone)==="sequential"?"hsl(213 40% 40%)":(i==null?void 0:i.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${i!=null&&i.loop?"-loop":""}`,source:e,target:t,sourceHandle:i!=null&&i.loop?"loop-source":void 0,targetHandle:i!=null&&i.loop?"loop-target":void 0,label:n,type:"insertStep",data:i?{insert:i.insert,loop:i.loop,tone:i.tone}:void 0,animated:i==null?void 0:i.loop,markerEnd:{type:JS.ArrowClosed,width:16,height:16,color:r},style:{stroke:r,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function DJ(e,t,n=!1,i){const r=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:i("buildCanvas.terminals.input")},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:i("buildCanvas.terminals.output")},selectable:!1,draggable:!1}],s=[];function o(f,h,m,g,b){const v=f.agentType??"llm",y=nO(h);return FF(f,h)?(l(f,h,m,g,b),y):(r.push({id:y,type:"agent",parentId:m,extent:"parent",position:g,data:{kind:"agent",path:h,agent:f,title:v==="a2a"?i("buildCanvas.patterns.a2a.label"):f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i("buildCanvas.unnamedStep")),pattern:v,description:f.description.trim()||i(KO[v].descriptionKey),childCount:f.subAgents.length,containedIn:b}}),y)}function l(f,h,m,g={x:0,y:0},b){const v=f.agentType??"sequential",y=nO(h),x=BF(f,h,t,n);r.push({id:y,type:"group",parentId:m,extent:m?"parent":void 0,position:g,style:{width:x.width,height:x.height},data:{kind:"agent",path:h,agent:f,title:f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i(KO[v].labelKey)),pattern:v,description:f.description.trim()||i(KO[v].descriptionKey),childCount:f.subAgents.length,containedIn:b,layoutWidth:x.width,layoutHeight:x.height,compactEmptyGroup:n&&f.subAgents.length===0}});const w=f.subAgents.map((E,R)=>BF(E,[...h,R],t,n)),O=w.length&&v!=="parallel"?bRe:Pv,S=t==="horizontal"?v!=="parallel":v==="parallel";let k=O;const C=f.subAgents.map((E,R)=>{const _=w[R],j=S?{x:k,y:Bk+Pv}:{x:(x.width-_.width)/2,y:Bk+k};return k+=(S?_.width:_.height)+$F,o(E,[...h,R],y,j,v)});if(v==="sequential"||v==="loop"){for(let E=0;E1&&s.push(iO(C[C.length-1],C[0],i("buildCanvas.edges.continueLoop"),{loop:!0,tone:"loop"}))}return y}const c=(f,h)=>{const m=f.agentType??"llm",g=nO(h);if(FF(f,h))return l(f,h),[g];if(r.push({id:g,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:h,agent:f,title:m==="a2a"?i("buildCanvas.patterns.a2a.label"):f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i("buildCanvas.unnamedStep")),pattern:m,description:f.description.trim()||i(KO[m].descriptionKey),childCount:f.subAgents.length}}),f.subAgents.length===0)return[g];const b=[];return f.subAgents.forEach((v,y)=>{const x=[...h,y],w=nO(x);s.push(iO(g,w,i("buildCanvas.edges.call"),{insert:{parentPath:h,index:y}})),b.push(...c(v,x))}),b},u=nO([]),d=c(e,[]);return s.push(iO("terminal-input",u)),d.forEach(f=>s.push(iO(f,"terminal-output"))),fvt(r,s,t)}function fvt(e,t,n){const i=new jJ.graphlib.Graph().setDefaultEdgeLabel(()=>({}));i.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const r=new Set(e.filter(s=>!s.parentId).map(s=>s.id));return e.filter(s=>!s.parentId).forEach(s=>{const o=s.data.kind==="terminal";i.setNode(s.id,{width:o?NJ:s.data.layoutWidth??MF,height:o?RJ:s.data.layoutHeight??LF})}),t.filter(s=>r.has(s.source)&&r.has(s.target)).forEach(s=>i.setEdge(s.source,s.target)),jJ.layout(i),{nodes:e.map(s=>{if(s.parentId)return s;const o=i.node(s.id),l=s.data.kind==="terminal",c=l?NJ:s.data.layoutWidth??MF,u=l?RJ:s.data.layoutHeight??LF;return{...s,position:{x:o.x-c/2,y:o.y-u/2}}}),edges:t}}const jP=p.createContext(null),NP=p.createContext("horizontal");function hvt({id:e,sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:o,markerEnd:l,style:c,label:u,data:d}){const{t:f}=Ae("create"),h=p.useContext(jP),[m,g]=p.useState(!1),[b,v,y]=jN({sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:o,offset:d!=null&&d.loop?28:20});return a.jsxs(a.Fragment,{children:[a.jsx(RC,{id:e,path:b,markerEnd:l,style:c}),h&&(d==null?void 0:d.insert)&&a.jsx("path",{d:b,className:"abc-edge-hover-path",onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1)}),(u||h&&(d==null?void 0:d.insert))&&a.jsx(sbt,{children:a.jsxs("div",{className:`abc-edge-tools${h&&(d!=null&&d.insert)?" can-insert":""}${m?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${v}px, ${y}px)`},onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),children:[u&&a.jsx("span",{className:"abc-edge-label",children:u}),h&&(d==null?void 0:d.insert)&&a.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":f("buildCanvas.actions.insertHere"),title:f("buildCanvas.actions.insertHere"),onClick:x=>{x.stopPropagation(),h==null||h.onInsert(d.insert.parentPath,d.insert.index)},children:a.jsx(Tl,{})})]})})]})}function pvt({data:e,selected:t}){const{t:n}=Ae("create"),i=p.useContext(jP),r=p.useContext(NP),s=r==="vertical"?pn.Top:pn.Left,o=r==="vertical"?pn.Bottom:pn.Right,l=r==="vertical"?pn.Right:pn.Bottom,c=e.pattern??"llm",u=KO[c],d=u.icon;return a.jsxs("div",{className:`abc-node is-${c}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[a.jsx(ic,{type:"target",position:s,className:"abc-handle"}),c!=="llm"&&a.jsx("span",{className:"abc-node-icon",children:a.jsx(d,{})}),a.jsxs("span",{className:"abc-node-copy",children:[a.jsx("span",{className:"abc-node-meta",children:a.jsx("span",{children:n(u.labelKey)})}),a.jsx("strong",{children:e.title}),a.jsx("small",{children:e.description})]}),i&&e.path!==void 0&&e.path.length>0&&a.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":n("buildCanvas.actions.deleteNamed",{name:e.title}),title:n("buildCanvas.actions.deleteNode"),onClick:f=>{f.stopPropagation(),i==null||i.onDelete(e.path)},children:a.jsx(rg,{})}),a.jsx(ic,{type:"source",position:o,className:"abc-handle"}),e.containedIn==="loop"&&a.jsxs(a.Fragment,{children:[a.jsx(ic,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),a.jsx(ic,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function mvt({data:e,selected:t}){const{t:n}=Ae("create"),i=p.useContext(jP),r=p.useContext(NP),s=r==="vertical"?pn.Top:pn.Left,o=r==="vertical"?pn.Bottom:pn.Right,l=r==="vertical"?pn.Right:pn.Bottom,c=e.pattern??"sequential",u=e.childCount??0,d=n(c==="llm"?"buildCanvas.actions.addSubagent":c==="parallel"?"buildCanvas.actions.addParallelStep":c==="loop"?"buildCanvas.actions.addLoopStep":"buildCanvas.actions.addNextStep");return a.jsxs("div",{className:`abc-group is-${c}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[a.jsx(ic,{type:"target",position:s,className:"abc-handle"}),a.jsx("header",{className:"abc-group-head",children:a.jsxs("span",{children:[a.jsx("strong",{title:e.title,children:e.title}),a.jsx("small",{children:e.description})]})}),i&&e.path!==void 0&&u>0&&c!=="parallel"&&a.jsxs("div",{className:"abc-group-boundary-actions",children:[a.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":n("buildCanvas.actions.addFirst"),title:n("buildCanvas.actions.addFirst"),onClick:f=>{f.stopPropagation(),i.onInsert(e.path,0)},children:a.jsx(Tl,{})}),a.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":n("buildCanvas.actions.addLast"),title:n("buildCanvas.actions.addLast"),onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:a.jsx(Tl,{})})]}),i&&e.path!==void 0&&u>0&&c==="parallel"&&a.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[a.jsx(Tl,{}),a.jsx("span",{children:d})]}),i&&e.path!==void 0&&u===0&&a.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[a.jsx(Tl,{}),a.jsx("span",{children:d})]}),i&&e.path!==void 0&&e.path.length>0&&a.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":n("buildCanvas.actions.deleteNamed",{name:e.title}),title:n("buildCanvas.actions.deleteNode"),onClick:f=>{f.stopPropagation(),i==null||i.onDelete(e.path)},children:a.jsx(rg,{})}),a.jsx(ic,{type:"source",position:o,className:"abc-handle"}),e.containedIn==="loop"&&a.jsxs(a.Fragment,{children:[a.jsx(ic,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),a.jsx(ic,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function gvt({data:e}){const t=p.useContext(NP);return a.jsxs("div",{className:"abc-terminal",children:[a.jsx(ic,{type:"target",position:t==="vertical"?pn.Top:pn.Left,className:"abc-handle"}),a.jsx("span",{children:e.title}),a.jsx(ic,{type:"source",position:t==="vertical"?pn.Bottom:pn.Right,className:"abc-handle"})]})}const bvt={agent:pvt,group:mvt,terminal:gvt},yvt={insertStep:hvt};function vvt({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:r,onDelete:s,readOnly:o=!1,interactivePreview:l=!1,direction:c="horizontal"}){const{t:u}=Ae("create"),d=p.useMemo(()=>DJ(e,c,o,u),[]),[f,h,m]=obt(d.nodes),[g,b,v]=abt(d.edges),y=cbt(),x=p.useRef(`${c}:${o?"readonly":"editable"}:${PJ(e)}`),w=p.useRef(null),{fitView:O}=CP(),S=p.useMemo(()=>DJ(e,c,o,u),[c,e,o,u]),[k,C]=p.useState(()=>window.matchMedia("(max-width: 860px)").matches),E=p.useMemo(()=>o?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,o]),R=p.useCallback((j=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const T=w.current;if(T&&(T.clientWidth===0||T.clientHeight===0)&&j<8){R(j+1);return}O(E)})})},[E,O]);p.useEffect(()=>{const j=window.matchMedia("(max-width: 860px)"),T=N=>C(N.matches);return j.addEventListener("change",T),()=>j.removeEventListener("change",T)},[]),p.useEffect(()=>{const j=`${c}:${o?"readonly":"editable"}:${PJ(e)}`,T=j!==x.current;x.current=j,b(S.edges),h(N=>{const A=new Map(N.map(P=>[P.id,P]));return S.nodes.map(P=>{const D=A.get(P.id);return{...P,measured:!T&&D&&D.type===P.type?D.measured:void 0,position:!T&&D?D.position:P.position,selected:P.data.kind==="agent"&&!!P.data.path&&dvt(P.data.path,t)}})}),T&&R()},[S,e,R,t,b,h]),p.useEffect(()=>{R()},[k,R]),p.useEffect(()=>{y&&R()},[S,R,y]),p.useEffect(()=>{if(!o||!w.current)return;const j=new ResizeObserver(()=>R());return j.observe(w.current),R(),()=>j.disconnect()},[R,o]);const _=p.useMemo(()=>o?null:{onAdd:i,onInsert:r,onDelete:s},[i,s,r,o]);return a.jsx(NP.Provider,{value:c,children:a.jsx(jP.Provider,{value:_,children:a.jsx("section",{className:`abc-root is-${c}${o?" is-readonly":""}`,"aria-label":u(o?"buildCanvas.readOnlyLabel":"buildCanvas.label"),children:a.jsx("div",{ref:w,className:"abc-canvas",children:a.jsxs(ibt,{nodes:f,edges:g,nodeTypes:bvt,edgeTypes:yvt,onNodesChange:m,onEdgesChange:v,onNodeClick:(j,T)=>{!o&&T.data.kind==="agent"&&T.data.path&&n(T.data.path)},nodesDraggable:!o,nodesConnectable:!1,nodesFocusable:!o,elementsSelectable:!o,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!o||l,zoomOnDoubleClick:l,zoomOnPinch:!o||l,zoomOnScroll:!o||l,fitView:!0,fitViewOptions:E,onInit:()=>R(),minZoom:o?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},ariaLabelConfig:{"controls.ariaLabel":u("buildCanvas.controls.ariaLabel"),"controls.zoomIn.ariaLabel":u("buildCanvas.controls.zoomIn"),"controls.zoomOut.ariaLabel":u("buildCanvas.controls.zoomOut"),"controls.fitView.ariaLabel":u("buildCanvas.controls.fitView")},children:[a.jsx(pbt,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!o||l)&&a.jsx(wbt,{showInteractive:!1}),cvt]})})})})})}function rE(e){return a.jsx(UNe,{children:a.jsx(vvt,{...e})})}mn.hasResourceBundle("en-US","create")||mn.addResourceBundle("en-US","create",fue,!0,!0);mn.hasResourceBundle("zh-CN","create")||mn.addResourceBundle("zh-CN","create",hbe,!0,!0);function Kt(e,t={}){return mn.t(e,{...t,ns:"create"})}function PC(e,t){return e.map(n=>({...n,get label(){return Kt(`${t}.${n.id}.label`)},get desc(){return Kt(`${t}.${n.id}.description`)}}))}function Pu(e,t){const n={...e};for(const[i,r]of Object.entries(t))Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get:()=>Kt(r)});return n}const yRe="https://ark.cn-beijing.volces.com/api/v3/";Pu({key:"MODEL_AGENT_NAME",required:!1,placeholder:"doubao-seed-1-6-250615"},{comment:"traditional.catalog.env.modelAgentName.comment"});const Q_=[Pu({key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615"},{comment:"traditional.catalog.env.embeddingModelName.comment"}),{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:yRe}],DN=[],MN={get label(){return Kt("traditional.catalog.links.console")},url:"https://console.volcengine.com/vikingdb/openviking"},xvt={get label(){return Kt("traditional.catalog.links.documentation")},url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},vRe="https://api.vikingdb.cn-beijing.volces.com/openviking",wvt=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??JZ,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var v,y;if(r.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!r.current||r.current&&!u)&&qje(m))return!1;const b=tJ(m.code,l);if(s.current.add(m[b]),eJ(o,s.current,!1)){const x=((y=(v=m.composedPath)==null?void 0:v.call(m))==null?void 0:y[0])||m.target,w=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(r.current||!w)&&m.preventDefault(),i(!0)}},f=m=>{const g=tJ(m.code,l);eJ(o,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),r.current=!1},h=()=>{s.current.clear(),i(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,i]),n}function eJ(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function tJ(e,t){return t.includes(e)?"code":"key"}const Dmt=()=>{const e=_s();return p.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:s,maxZoom:o,panZoom:l}=e.getState(),c=ZQ(t,i,r,s,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return Kw(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),o=iw(t,n);return{x:o.x+r,y:o.y+s}}}),[])};function pNe(e,t){const n=[],i=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")i.set(s.id,[s]);else{const o=i.get(s.id);o?o.push(s):i.set(s.id,[s])}for(const s of t){const o=i.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...s};for(const c of o)Mmt(c,l);n.push(l)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Mmt(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function mNe(e,t){return pNe(e,t)}function gNe(e,t){return pNe(e,t)}function yb(e,t){return{id:e,type:"select",selected:t}}function Iv(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const o=t.has(r);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),i.push(yb(s.id,o)))}return i}function nJ({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const l=t.get(o.id),c=((r=l==null?void 0:l.internals)==null?void 0:r.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function iJ(e){return{id:e.id,type:"remove"}}const Lmt=zje();function $mt(e,t,n={}){return _pt(e,t,{...n,onError:n.onError??Lmt})}const rJ=e=>ppt(e),Fmt=e=>Fje(e);function bNe(e){return p.forwardRef(e)}const Bmt=typeof window<"u"?p.useLayoutEffect:p.useEffect;function sJ(e){const[t,n]=p.useState(BigInt(0)),[i]=p.useState(()=>Umt(()=>n(r=>r+BigInt(1))));return Bmt(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function Umt(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const yNe=p.createContext(null);function Qmt({children:e}){const t=_s(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=nJ({items:b,lookup:h});for(const y of g.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:w}=t.getState();y&&w(x)})},[]),i=sJ(n),r=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let m=c;for(const g of l)m=typeof g=="function"?g(m):g;d?u(m):f&&f(nJ({items:m,lookup:h}))},[]),s=sJ(r),o=p.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return a.jsx(yNe.Provider,{value:o,children:e})}function zmt(){const e=p.useContext(yNe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Vmt=e=>!!e.panZoom;function CP(){const e=Dmt(),t=_s(),n=zmt(),i=zi(Vmt),r=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=rJ(f)?f:h.get(f.id),b=g.parentId?Vje(g.position,g.measured,g.parentId,h,m):g.position,v={...g,position:b,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((x=g.measured)==null?void 0:x.height)??g.height};return nw(v)},u=(f,h,m={replace:!1})=>{o(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&rJ(v)?v:{...b,...v}}return b}))},d=(f,h,m={replace:!1})=>{l(g=>g.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return m.replace&&Fmt(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(m=>[...m,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(m=>[...m,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:m}=t.getState(),[g,b,v]=m;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:g,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:w,onBeforeDelete:O}=t.getState(),{nodes:S,edges:k}=await vpt({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:O}),C=k.length>0,E=S.length>0;if(C){const R=k.map(iJ);v==null||v(k),x(R)}if(E){const R=S.map(iJ);b==null||b(S),y(R)}return(E||C)&&(w==null||w({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(f,h=!0,m)=>{const g=PZ(f),b=g?f:c(f),v=m!==void 0;return b?(m||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!g&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const w=nw(v?y:x),O=eE(w,b);return h&&O>0||O>=w.width*w.height||O>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=PZ(f)?f:c(f);if(!b)return!1;const v=eE(b,h);return m&&v>0||v>=h.width*h.height||v>=b.width*b.height},updateNode:u,updateNodeData:(f,h,m={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:d,updateEdgeData:(f,h,m={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:m}=t.getState();return mpt(f,{nodeLookup:h,nodeOrigin:m})},getHandleConnections:({type:f,id:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??Opt();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(m=>[...m]),h.promise}}},[]);return p.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const oJ=e=>e.selected,Hmt=typeof window<"u"?window:void 0;function qmt({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=_s(),{deleteElements:i}=CP(),r=nE(e,{actInsideInputWithModifier:!1}),s=nE(t,{target:Hmt});p.useEffect(()=>{if(r){const{edges:o,nodes:l}=n.getState();i({nodes:l.filter(oJ),edges:o.filter(oJ)}),n.setState({nodesSelectionActive:!1})}},[r]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Wmt(e){const t=_s();p.useEffect(()=>{const n=()=>{var r,s,o,l;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=ez(e.current);(i.height===0||i.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Rd.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const TP={position:"absolute",width:"100%",height:"100%",top:0,left:0},Kmt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Gmt({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=Jb.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:m=!0,children:g,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:w,selectionOnDrag:O}){const S=_s(),k=p.useRef(null),{userSelectionActive:C,lib:E,connectionInProgress:R}=zi(Kmt,As),_=nE(h),j=p.useRef();Wmt(k);const T=p.useCallback(N=>{y==null||y({x:N[0],y:N[1],zoom:N[2]}),x||S.setState({transform:N})},[y,x]);return p.useEffect(()=>{if(k.current){j.current=smt({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:D=>S.setState(M=>M.paneDragging===D?M:{paneDragging:D}),onPanZoomStart:(D,M)=>{const{onViewportChangeStart:L,onMoveStart:U}=S.getState();U==null||U(D,M),L==null||L(M)},onPanZoom:(D,M)=>{const{onViewportChange:L,onMove:U}=S.getState();U==null||U(D,M),L==null||L(M)},onPanZoomEnd:(D,M)=>{const{onViewportChangeEnd:L,onMoveEnd:U}=S.getState();U==null||U(D,M),L==null||L(M)}});const{x:N,y:A,zoom:P}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[N,A,P],domNode:k.current.closest(".react-flow")}),()=>{var D;(D=j.current)==null||D.destroy()}}},[]),p.useEffect(()=>{var N;(N=j.current)==null||N.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:_,preventScrolling:m,noPanClassName:v,userSelectionActive:C,noWheelClassName:b,lib:E,onTransformChange:T,connectionInProgress:R,selectionOnDrag:O,paneClickDistance:w})},[e,t,n,i,r,s,o,l,_,m,v,C,b,E,T,R,O,w]),a.jsx("div",{className:"react-flow__renderer",ref:k,style:TP,children:g})}const Xmt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ymt(){const{userSelectionActive:e,userSelectionRect:t}=zi(Xmt,As);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const h5=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Zmt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Jmt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ZS.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:m,onPaneMouseLeave:g,children:b}){const v=p.useRef(0),y=_s(),{userSelectionActive:x,elementsSelectable:w,dragging:O,connectionInProgress:S,panBy:k,autoPanSpeed:C}=zi(Zmt,As),E=w&&(e||x),R=p.useRef(null),_=p.useRef(),j=p.useRef(new Set),T=p.useRef(new Set),N=p.useRef(!1),A=p.useRef({x:0,y:0}),P=p.useRef(!1),D=Q=>{if(N.current||S){N.current=!1;return}u==null||u(Q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=Q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Q.preventDefault();return}d==null||d(Q)},L=f?Q=>f(Q):void 0,U=Q=>{N.current&&(Q.stopPropagation(),N.current=!1)},I=Q=>{var pe,me;const{domNode:Z,transform:ce}=y.getState();if(_.current=Z==null?void 0:Z.getBoundingClientRect(),!_.current)return;const Ee=Q.target===R.current;if(!Ee&&!!Q.target.closest(".nokey")||!e||!(o&&Ee||t)||Q.button!==0||!Q.isPrimary)return;(me=(pe=Q.target)==null?void 0:pe.setPointerCapture)==null||me.call(pe,Q.pointerId),N.current=!1;const{x:te,y:ye}=kd(Q.nativeEvent,_.current),Ne=Kw({x:te,y:ye},ce);y.setState({userSelectionRect:{width:0,height:0,startX:Ne.x,startY:Ne.y,x:te,y:ye}}),Ee||(Q.stopPropagation(),Q.preventDefault())};function H(Q,Z){const{userSelectionRect:ce}=y.getState();if(!ce)return;const{transform:Ee,nodeLookup:Y,edgeLookup:G,connectionLookup:te,triggerNodeChanges:ye,triggerEdgeChanges:Ne,defaultEdgeOptions:pe}=y.getState(),me={x:ce.startX,y:ce.startY},{x:se,y:Se}=iw(me,Ee),Le={startX:me.x,startY:me.y,x:QRe.id)),T.current=new Set;const ve=(pe==null?void 0:pe.selectable)??!0;for(const Re of j.current){const ne=te.get(Re);if(ne)for(const{edgeId:ge}of ne.values()){const Ce=G.get(ge);Ce&&(Ce.selectable??ve)&&T.current.add(ge)}}if(!DZ(be,j.current)){const Re=Iv(Y,j.current,!0);ye(Re)}if(!DZ(Ve,T.current)){const Re=Iv(G,T.current);Ne(Re)}y.setState({userSelectionRect:Le,userSelectionActive:!0,nodesSelectionActive:!1})}function K(){if(!r||!_.current)return;const[Q,Z]=YQ(A.current,_.current,C);k({x:Q,y:Z}).then(ce=>{if(!N.current||!ce){v.current=requestAnimationFrame(K);return}const{x:Ee,y:Y}=A.current;H(Ee,Y),v.current=requestAnimationFrame(K)})}const F=()=>{cancelAnimationFrame(v.current),v.current=0,P.current=!1};p.useEffect(()=>()=>F(),[]);const W=Q=>{const{userSelectionRect:Z,transform:ce,resetSelectedElements:Ee}=y.getState();if(!_.current||!Z)return;const{x:Y,y:G}=kd(Q.nativeEvent,_.current);A.current={x:Y,y:G};const te=iw({x:Z.startX,y:Z.startY},ce);if(!N.current){const ye=t?0:s;if(Math.hypot(Y-te.x,G-te.y)<=ye)return;Ee(),l==null||l(Q)}N.current=!0,P.current||(K(),P.current=!0),H(Y,G)},V=Q=>{var Z,ce;Q.button===0&&((ce=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ce.call(Z,Q.pointerId),!x&&Q.target===R.current&&y.getState().userSelectionRect&&(D==null||D(Q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(c==null||c(Q),y.setState({nodesSelectionActive:j.current.size>0})),F())},X=Q=>{var Z,ce;(ce=(Z=Q.target)==null?void 0:Z.releasePointerCapture)==null||ce.call(Z,Q.pointerId),F()},ie=i===!0||Array.isArray(i)&&i.includes(0);return a.jsxs("div",{className:Mo(["react-flow__pane",{draggable:ie,dragging:O,selection:e}]),onClick:E?void 0:h5(D,R),onContextMenu:h5(M,R),onWheel:h5(L,R),onPointerEnter:E?void 0:h,onPointerMove:E?W:m,onPointerUp:E?V:void 0,onPointerCancel:E?X:void 0,onPointerDownCapture:E?I:void 0,onClickCapture:E?U:void 0,onPointerLeave:g,ref:R,style:TP,children:[b,a.jsx(Ymt,{})]})}function PF({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Rd.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function vNe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:o}){const l=_s(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=Hpt({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{PF({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:o}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,o]),c}const egt=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function xNe(){const e=_s();return p.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=egt(o),m=r?s[0]:5,g=r?s[1]:5,b=n.direction.x*m*n.factor,v=n.direction.y*g*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};r&&(x=NC(x,s));const{position:w,positionAbsolute:O}=Bje({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:l});y.position=w,y.internals.positionAbsolute=O,f.set(y.id,y)}c(f)},[])}const oz=p.createContext(null),tgt=oz.Provider;oz.Consumer;const wNe=()=>p.useContext(oz),ngt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),igt=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:o}=i,{fromHandle:l,toHandle:c,isValid:u}=o,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:s===ew.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!r,valid:d&&u}};function rgt({type:e="source",position:t=pn.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var P,D;const g=o||null,b=e==="target",v=_s(),y=wNe(),{connectOnClick:x,noPanClassName:w,rfId:O}=zi(ngt,As),{connectingFrom:S,connectingTo:k,clickConnecting:C,isPossibleEndHandle:E,connectionInProcess:R,clickConnectionInProcess:_,valid:j}=zi(igt(y,g,e),As);y||(D=(P=v.getState()).onError)==null||D.call(P,"010",Rd.error010());const T=M=>{const{defaultEdgeOptions:L,onConnect:U,hasDefaultEdges:I}=v.getState(),H={...L,...M};if(I){const{edges:K,setEdges:F,onError:W}=v.getState();F($mt(H,K,{onError:W}))}U==null||U(H),l==null||l(H)},N=M=>{if(!y)return;const L=Wje(M.nativeEvent);if(r&&(L&&M.button===0||!L)){const U=v.getState();IF.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:b,handleId:g,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...I)=>{var H,K;return(K=(H=v.getState()).onConnectEnd)==null?void 0:K.call(H,...I)},updateConnection:U.updateConnection,onConnect:T,isValidConnection:n||((...I)=>{var H,K;return((K=(H=v.getState()).isValidConnection)==null?void 0:K.call(H,...I))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}L?d==null||d(M):f==null||f(M)},A=M=>{const{onClickConnectStart:L,onClickConnectEnd:U,connectionClickStartHandle:I,connectionMode:H,isValidConnection:K,lib:F,rfId:W,nodeLookup:V,connection:X}=v.getState();if(!y||!I&&!r)return;if(!I){L==null||L(M.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const ie=Hje(M.target),Q=n||K,{connection:Z,isValid:ce}=IF.isValid(M.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:H,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:Q,flowId:W,doc:ie,lib:F,nodeLookup:V});ce&&Z&&T(Z);const Ee=structuredClone(X);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,U==null||U(M,Ee),v.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${O}-${y}-${g}-${e}`,className:Mo(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,u,{source:!b,target:b,connectable:i,connectablestart:r,connectableend:s,clickconnecting:C,connectingfrom:S,connectingto:k,valid:j,connectionindicator:i&&(!R||E)&&(R||_?s:r)}]),onMouseDown:N,onTouchStart:N,onClick:x?A:void 0,ref:m,...h,children:c})}const ic=p.memo(bNe(rgt));function sgt({data:e,isConnectable:t,sourcePosition:n=pn.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(ic,{type:"source",position:n,isConnectable:t})]})}function ogt({data:e,isConnectable:t,targetPosition:n=pn.Top,sourcePosition:i=pn.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(ic,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(ic,{type:"source",position:i,isConnectable:t})]})}function agt(){return null}function lgt({data:e,isConnectable:t,targetPosition:n=pn.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(ic,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const NN={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aJ={input:sgt,default:ogt,output:lgt,group:agt};function cgt(e){var t,n,i,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const ugt=e=>{const{width:t,height:n,x:i,y:r}=jC(e.nodeLookup,{filter:s=>!!s.selected});return{width:Od(t)?t:null,height:Od(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function dgt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=_s(),{width:r,height:s,transformString:o,userSelectionActive:l}=zi(ugt,As),c=xNe(),u=p.useRef(null);p.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&r!==null&&s!==null;if(vNe({nodeRef:u,disabled:!d}),!d)return null;const f=e?m=>{const g=i.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,h=m=>{Object.prototype.hasOwnProperty.call(NN,m.key)&&(m.preventDefault(),c({direction:NN[m.key],factor:m.shiftKey?4:1}))};return a.jsx("div",{className:Mo(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s}})})}const lJ=typeof window<"u"?window:void 0,fgt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ONe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:O,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:E,autoPanOnSelection:R,defaultViewport:_,translateExtent:j,minZoom:T,maxZoom:N,preventScrolling:A,onSelectionContextMenu:P,noWheelClassName:D,noPanClassName:M,disableKeyboardA11y:L,onViewportChange:U,isControlledViewport:I}){const{nodesSelectionActive:H,userSelectionActive:K}=zi(fgt,As),F=nE(u,{target:lJ}),W=nE(b,{target:lJ}),V=W||E,X=W||O,ie=d&&V!==!0,Q=F||K||ie;return qmt({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(Gmt,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!F&&V,defaultViewport:_,translateExtent:j,minZoom:T,maxZoom:N,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:D,noPanClassName:M,onViewportChange:U,isControlledViewport:I,paneClickDistance:l,selectionOnDrag:ie,children:a.jsxs(Jmt,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:V,autoPanOnSelection:R,isSelecting:!!Q,selectionMode:f,selectionKeyPressed:F,paneClickDistance:l,selectionOnDrag:ie,children:[e,H&&a.jsx(dgt,{onSelectionContextMenu:P,noPanClassName:M,disableKeyboardA11y:L})]})})}ONe.displayName="FlowRenderer";const hgt=p.memo(ONe),pgt=e=>t=>e?XQ(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function mgt(e){return zi(p.useCallback(pgt(e),[e]),As)}const ggt=e=>e.updateNodeInternals;function bgt(){const e=zi(ggt),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");i.set(s,{id:s,nodeElement:r.target,force:!0})}),e(i)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function ygt({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=_s(),s=p.useRef(null),o=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),d=n&&!!e.internals.handleBounds;return p.useEffect(()=>{s.current&&!e.hidden&&(!d||o.current!==s.current)&&(o.current&&(i==null||i.unobserve(o.current)),i==null||i.observe(s.current),o.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{o.current&&(i==null||i.unobserve(o.current),o.current=null)},[]),p.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(f||h||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function vgt({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:w,internals:O,isParent:S}=zi(Q=>{const Z=Q.nodeLookup.get(e),ce=Q.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ce}},As);let k=w.type||"default",C=(v==null?void 0:v[k])||aJ[k];C===void 0&&(x==null||x("003",Rd.error003(k)),k="default",C=(v==null?void 0:v.default)||aJ.default);const E=!!(w.draggable||l&&typeof w.draggable>"u"),R=!!(w.selectable||c&&typeof w.selectable>"u"),_=!!(w.connectable||u&&typeof w.connectable>"u"),j=!!(w.focusable||d&&typeof w.focusable>"u"),T=_s(),N=JQ(w),A=ygt({node:w,nodeType:k,hasDimensions:N,resizeObserver:f}),P=vNe({nodeRef:A,disabled:w.hidden||!E,noDragClassName:h,handleSelector:w.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:y}),D=xNe();if(w.hidden)return null;const M=Cp(w),L=cgt(w),U=R||E||t||n||i||r,I=n?Q=>n(Q,{...O.userNode}):void 0,H=i?Q=>i(Q,{...O.userNode}):void 0,K=r?Q=>r(Q,{...O.userNode}):void 0,F=s?Q=>s(Q,{...O.userNode}):void 0,W=o?Q=>o(Q,{...O.userNode}):void 0,V=Q=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ce}=T.getState();R&&(!Z||!E||ce>0)&&PF({id:e,store:T,nodeRef:A}),t&&t(Q,{...O.userNode})},X=Q=>{if(!(qje(Q.nativeEvent)||g)){if(Dje.includes(Q.key)&&R){const Z=Q.key==="Escape";PF({id:e,store:T,unselect:Z,nodeRef:A})}else if(E&&w.selected&&Object.prototype.hasOwnProperty.call(NN,Q.key)){Q.preventDefault();const{ariaLabelConfig:Z}=T.getState();T.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~O.positionAbsolute.x,y:~~O.positionAbsolute.y})}),D({direction:NN[Q.key],factor:Q.shiftKey?4:1})}}},ie=()=>{var te;if(g||!((te=A.current)!=null&&te.matches(":focus-visible")))return;const{transform:Q,width:Z,height:ce,autoPanOnNodeFocus:Ee,setCenter:Y}=T.getState();if(!Ee)return;XQ(new Map([[e,w]]),{x:0,y:0,width:Z,height:ce},Q,!0).length>0||Y(w.position.x+M.width/2,w.position.y+M.height/2,{zoom:Q[2]})};return a.jsx("div",{className:Mo(["react-flow__node",`react-flow__node-${k}`,{[m]:E},w.className,{selected:w.selected,selectable:R,parent:S,draggable:E,dragging:P}]),ref:A,style:{zIndex:O.z,transform:`translate(${O.positionAbsolute.x}px,${O.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:N?"visible":"hidden",...w.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:H,onMouseLeave:K,onContextMenu:F,onClick:V,onDoubleClick:W,onKeyDown:j?X:void 0,tabIndex:j?0:void 0,onFocus:j?ie:void 0,role:w.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${dNe}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:a.jsx(tgt,{value:e,children:a.jsx(C,{id:e,data:w.data,type:k,positionAbsoluteX:O.positionAbsolute.x,positionAbsoluteY:O.positionAbsolute.y,selected:w.selected??!1,selectable:R,draggable:E,deletable:w.deletable??!0,isConnectable:_,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:P,dragHandle:w.dragHandle,zIndex:O.z,parentId:w.parentId,...M})})})}var xgt=p.memo(vgt);const wgt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kNe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zi(wgt,As),o=mgt(e.onlyRenderVisibleElements),l=bgt();return a.jsx("div",{className:"react-flow__nodes",style:TP,children:o.map(c=>a.jsx(xgt,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}kNe.displayName="NodeRenderer";const Ogt=p.memo(kNe);function kgt(e){return zi(p.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const i=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),o=n.nodeLookup.get(r.target);s&&o&&Cpt({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),As)}const Sgt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Egt=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},cJ={[JS.Arrow]:Sgt,[JS.ArrowClosed]:Egt};function Cgt(e){const t=_s();return p.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(cJ,e)?cJ[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Rd.error009(e)),null)},[e])}const Tgt=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=Cgt(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},SNe=({defaultColor:e,rfId:t})=>{const n=zi(s=>s.edges),i=zi(s=>s.defaultEdgeOptions),r=p.useMemo(()=>Ppt(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return r.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:r.map(s=>a.jsx(Tgt,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};SNe.displayName="MarkerDefinitions";var Agt=p.memo(SNe);function ENe({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=Mo(["react-flow__edge-textwrapper",u]),g=p.useRef(null);return p.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[r&&a.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}ENe.displayName="EdgeText";const _gt=p.memo(ENe);function RC({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...d,d:e,fill:"none",className:Mo(["react-flow__edge-path",d.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Od(t)&&Od(n)?a.jsx(_gt,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function uJ({pos:e,x1:t,y1:n,x2:i,y2:r}){return e===pn.Left||e===pn.Right?[.5*(t+i),n]:[t,.5*(n+r)]}function CNe({sourceX:e,sourceY:t,sourcePosition:n=pn.Bottom,targetX:i,targetY:r,targetPosition:s=pn.Top}){const[o,l]=uJ({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=uJ({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,m]=Kje({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${i},${r}`,d,f,h,m]}function TNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,w,O]=CNe({sourceX:n,sourceY:i,sourcePosition:o,targetX:r,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return a.jsx(RC,{id:S,path:x,labelX:w,labelY:O,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})})}const jgt=TNe({isInternal:!1}),ANe=TNe({isInternal:!0});jgt.displayName="SimpleBezierEdge";ANe.displayName="SimpleBezierEdgeInternal";function _Ne(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:m=pn.Bottom,targetPosition:g=pn.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[w,O,S]=jN({sourceX:n,sourceY:i,sourcePosition:m,targetX:r,targetY:s,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),k=e.isInternal?void 0:t;return a.jsx(RC,{id:k,path:w,labelX:O,labelY:S,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const jNe=_Ne({isInternal:!1}),NNe=_Ne({isInternal:!0});jNe.displayName="SmoothStepEdge";NNe.displayName="SmoothStepEdgeInternal";function RNe(e){return p.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return a.jsx(jNe,{...n,id:i,pathOptions:p.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const Ngt=RNe({isInternal:!1}),INe=RNe({isInternal:!0});Ngt.displayName="StepEdge";INe.displayName="StepEdgeInternal";function PNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[v,y,x]=Yje({sourceX:n,sourceY:i,targetX:r,targetY:s}),w=e.isInternal?void 0:t;return a.jsx(RC,{id:w,path:v,labelX:y,labelY:x,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const Rgt=PNe({isInternal:!1}),DNe=PNe({isInternal:!0});Rgt.displayName="StraightEdge";DNe.displayName="StraightEdgeInternal";function MNe(e){return p.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:o=pn.Bottom,targetPosition:l=pn.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[w,O,S]=Gje({sourceX:n,sourceY:i,sourcePosition:o,targetX:r,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return a.jsx(RC,{id:k,path:w,labelX:O,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:x})})}const Igt=MNe({isInternal:!1}),LNe=MNe({isInternal:!0});Igt.displayName="BezierEdge";LNe.displayName="BezierEdgeInternal";const dJ={default:LNe,straight:DNe,step:INe,smoothstep:NNe,simplebezier:ANe},fJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Pgt=(e,t,n)=>n===pn.Left?e-t:n===pn.Right?e+t:e,Dgt=(e,t,n)=>n===pn.Top?e-t:n===pn.Bottom?e+t:e,hJ="react-flow__edgeupdater";function pJ({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:o,className:Mo([hJ,`${hJ}-${l}`]),cx:Pgt(t,i,e),cy:Dgt(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Mgt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:m}){const g=_s(),b=(O,S)=>{if(O.button!==0)return;const{autoPanOnConnect:k,domNode:C,connectionMode:E,connectionRadius:R,lib:_,onConnectStart:j,cancelConnection:T,nodeLookup:N,rfId:A,panBy:P,updateConnection:D}=g.getState(),M=S.type==="target",L=(H,K)=>{h(!1),f==null||f(H,n,S.type,K)},U=H=>u==null?void 0:u(n,H),I=(H,K)=>{h(!0),d==null||d(O,n,S.type),j==null||j(H,K)};IF.onPointerDown(O.nativeEvent,{autoPanOnConnect:k,connectionMode:E,connectionRadius:R,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:N,isTarget:M,edgeUpdaterType:S.type,lib:_,flowId:A,cancelConnection:T,panBy:P,isValidConnection:(...H)=>{var K,F;return((F=(K=g.getState()).isValidConnection)==null?void 0:F.call(K,...H))??!0},onConnect:U,onConnectStart:I,onConnectEnd:(...H)=>{var K,F;return(F=(K=g.getState()).onConnectEnd)==null?void 0:F.call(K,...H)},onReconnectEnd:L,updateConnection:D,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:O.currentTarget})},v=O=>b(O,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=O=>b(O,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>m(!0),w=()=>m(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(pJ,{position:l,centerX:i,centerY:r,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&a.jsx(pJ,{position:c,centerX:s,centerY:o,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:w,type:"target"})]})}function Lgt({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let w=zi(Y=>Y.edgeLookup.get(e));const O=zi(Y=>Y.defaultEdgeOptions);w=O?{...O,...w}:w;let S=w.type||"default",k=(b==null?void 0:b[S])||dJ[S];k===void 0&&(y==null||y("011",Rd.error011(S)),S="default",k=(b==null?void 0:b.default)||dJ.default);const C=!!(w.focusable||t&&typeof w.focusable>"u"),E=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),R=!!(w.selectable||i&&typeof w.selectable>"u"),_=p.useRef(null),[j,T]=p.useState(!1),[N,A]=p.useState(!1),P=_s(),{zIndex:D,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K}=zi(p.useCallback(Y=>{const G=Y.nodeLookup.get(w.source),te=Y.nodeLookup.get(w.target);if(!G||!te)return{zIndex:w.zIndex,...fJ};const ye=Ipt({id:e,sourceNode:G,targetNode:te,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:Y.connectionMode,onError:y});return{zIndex:Ept({selected:w.selected,zIndex:w.zIndex,sourceNode:G,targetNode:te,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...ye||fJ}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),As),F=p.useMemo(()=>w.markerStart?`url('#${NF(w.markerStart,g)}')`:void 0,[w.markerStart,g]),W=p.useMemo(()=>w.markerEnd?`url('#${NF(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||M===null||L===null||U===null||I===null)return null;const V=Y=>{var Ne;const{addSelectedEdges:G,unselectNodesAndEdges:te,multiSelectionActive:ye}=P.getState();R&&(P.setState({nodesSelectionActive:!1}),w.selected&&ye?(te({nodes:[],edges:[w]}),(Ne=_.current)==null||Ne.blur()):G([e])),r&&r(Y,w)},X=s?Y=>{s(Y,{...w})}:void 0,ie=o?Y=>{o(Y,{...w})}:void 0,Q=l?Y=>{l(Y,{...w})}:void 0,Z=c?Y=>{c(Y,{...w})}:void 0,ce=u?Y=>{u(Y,{...w})}:void 0,Ee=Y=>{var G;if(!x&&Dje.includes(Y.key)&&R){const{unselectNodesAndEdges:te,addSelectedEdges:ye}=P.getState();Y.key==="Escape"?((G=_.current)==null||G.blur(),te({edges:[w]})):ye([e])}};return a.jsx("svg",{style:{zIndex:D},children:a.jsxs("g",{className:Mo(["react-flow__edge",`react-flow__edge-${S}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!R&&!r,updating:j,selectable:R}]),onClick:V,onDoubleClick:X,onContextMenu:ie,onMouseEnter:Q,onMouseMove:Z,onMouseLeave:ce,onKeyDown:C?Ee:void 0,tabIndex:C?0:void 0,role:w.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":C?`${fNe}-${g}`:void 0,ref:_,...w.domAttributes,children:[!N&&a.jsx(k,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:R,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:F,markerEnd:W,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),E&&a.jsx(Mgt,{edge:w,isReconnectable:E,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:M,sourceY:L,targetX:U,targetY:I,sourcePosition:H,targetPosition:K,setUpdateHover:T,setReconnecting:A})]})})}var $gt=p.memo(Lgt);const Fgt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $Ne({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:w}=zi(Fgt,As),O=kgt(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(Agt,{defaultColor:e,rfId:n}),O.map(S=>a.jsx($gt,{id:S,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:r,onReconnect:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:i,disableKeyboardA11y:b},S))]})}$Ne.displayName="EdgeRenderer";const Bgt=p.memo($Ne),Ugt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Qgt({children:e}){const t=zi(Ugt);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function zgt(e){const t=CP(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Vgt=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Hgt(e){const t=zi(Vgt),n=_s();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function qgt(e){return e.connection.inProgress?{...e.connection,to:Kw(e.connection.to,e.transform)}:{...e.connection}}function Wgt(e){return qgt}function Kgt(e){const t=Wgt();return zi(t,As)}const Ggt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Xgt({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:o,isValid:l,inProgress:c}=zi(Ggt,As);return!(s&&r&&c)?null:a.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Mo(["react-flow__connection",$je(l)]),children:a.jsx(FNe,{style:t,type:n,CustomComponent:i,isValid:l})})})}const FNe=({style:e,type:t=mm.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=Kgt();if(!r)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:$je(i),toNode:d,toHandle:f,pointer:m});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case mm.Bezier:[g]=Gje(b);break;case mm.SimpleBezier:[g]=CNe(b);break;case mm.Step:[g]=jN({...b,borderRadius:0});break;case mm.SmoothStep:[g]=jN(b);break;default:[g]=Yje(b)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};FNe.displayName="ConnectionLine";const Ygt={};function mJ(e=Ygt){p.useRef(e),_s(),p.useEffect(()=>{},[e])}function Zgt(){_s(),p.useRef(!1),p.useEffect(()=>{},[])}function BNe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,deleteKeyCode:E,onlyRenderVisibleElements:R,elementsSelectable:_,defaultViewport:j,translateExtent:T,minZoom:N,maxZoom:A,preventScrolling:P,defaultMarkerColor:D,zoomOnScroll:M,zoomOnPinch:L,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:H,zoomOnDoubleClick:K,panOnDrag:F,autoPanOnSelection:W,onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneScroll:Z,onPaneContextMenu:ce,paneClickDistance:Ee,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:ye,onEdgeMouseLeave:Ne,reconnectRadius:pe,onReconnect:me,onReconnectStart:se,onReconnectEnd:Se,noDragClassName:Le,noWheelClassName:be,noPanClassName:Ve,disableKeyboardA11y:ve,nodeExtent:Re,rfId:ne,viewport:ge,onViewportChange:Ce}){return mJ(e),mJ(t),Zgt(),zgt(n),Hgt(ge),a.jsx(hgt,{onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:ie,onPaneMouseLeave:Q,onPaneContextMenu:ce,onPaneScroll:Z,paneClickDistance:Ee,deleteKeyCode:E,selectionKeyCode:x,selectionOnDrag:w,selectionMode:O,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:_,zoomOnScroll:M,zoomOnPinch:L,zoomOnDoubleClick:K,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:H,panOnDrag:F,autoPanOnSelection:W,defaultViewport:j,translateExtent:T,minZoom:N,maxZoom:A,onSelectionContextMenu:f,preventScrolling:P,noDragClassName:Le,noWheelClassName:be,noPanClassName:Ve,disableKeyboardA11y:ve,onViewportChange:Ce,isControlledViewport:!!ge,children:a.jsxs(Qgt,{children:[a.jsx(Bgt,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:o,onReconnect:me,onReconnectStart:se,onReconnectEnd:Se,onlyRenderVisibleElements:R,onEdgeContextMenu:G,onEdgeMouseEnter:te,onEdgeMouseMove:ye,onEdgeMouseLeave:Ne,reconnectRadius:pe,defaultMarkerColor:D,noPanClassName:Ve,disableKeyboardA11y:ve,rfId:ne}),a.jsx(Xgt,{style:b,type:g,component:v,containerStyle:y}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(Ogt,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:R,noPanClassName:Ve,noDragClassName:Le,disableKeyboardA11y:ve,nodeExtent:Re,rfId:ne}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}BNe.displayName="GraphView";const Jgt=p.memo(BNe),ebt=zje(),gJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const m=new Map,g=new Map,b=new Map,v=new Map,y=i??t??[],x=n??e??[],w=d??[0,0],O=f??YS;eNe(b,v,y);const{nodesInitialized:S}=RF(x,m,g,{nodeOrigin:w,nodeExtent:O,zIndexMode:h});let k=[0,0,1];if(o&&r&&s){const C=jC(m,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:E,y:R,zoom:_}=ZQ(C,r,s,c,u,(l==null?void 0:l.padding)??.1);k=[E,R,_]}return{rfId:"1",width:r??0,height:s??0,transform:k,nodes:x,nodesInitialized:S,nodeLookup:m,parentLookup:g,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:YS,nodeExtent:O,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ew.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...Lje},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ebt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Mje,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},tbt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>gmt((m,g)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:w,width:O,height:S,minZoom:k,maxZoom:C}=g();y&&(await ypt({nodes:v,width:O,height:S,panZoom:y,minZoom:k,maxZoom:C},x),w==null||w.resolve(!0),m({fitViewResolver:null}))}return{...gJ({nodes:e,edges:t,width:r,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:O,fitViewQueued:S,zIndexMode:k,nodesSelectionActive:C}=g(),{nodesInitialized:E,hasSelectedNodes:R}=RF(v,y,x,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:k}),_=C&&R;S&&E?(b(),m({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:_})):m({nodes:v,nodesInitialized:E,nodesSelectionActive:_})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=g();eNe(y,x,v),m({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=g();x(v),m({hasDefaultNodes:!0})}if(y){const{setEdges:x}=g();x(y),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:w,domNode:O,nodeOrigin:S,nodeExtent:k,debug:C,fitViewQueued:E,zIndexMode:R}=g(),{changes:_,updatedInternals:j}=Upt(v,x,w,O,S,k,R);j&&(Lpt(x,w,{nodeOrigin:S,nodeExtent:k,zIndexMode:R}),E?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(_==null?void 0:_.length)>0&&(C&&console.log("React Flow: trigger node changes",_),y==null||y(_)))},updateNodePositions:(v,y=!1)=>{const x=[];let w=[];const{nodeLookup:O,triggerNodeChanges:S,connection:k,updateConnection:C,onNodesChangeMiddlewareMap:E}=g();for(const[R,_]of v){const j=O.get(R),T=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(_!=null&&_.position)),N={id:R,type:"position",position:T?{x:Math.max(0,_.position.x),y:Math.max(0,_.position.y)}:_.position,dragging:y};if(j&&k.inProgress&&k.fromNode.id===j.id){const A=wy(j,k.fromHandle,pn.Left,!0);C({...k,from:A})}T&&j.parentId&&x.push({id:R,parentId:j.parentId,rect:{..._.internals.positionAbsolute,width:_.measured.width??0,height:_.measured.height??0}}),w.push(N)}if(x.length>0){const{parentLookup:R,nodeOrigin:_}=g(),j=sz(x,O,R,_);w.push(...j)}for(const R of E.values())w=R(w);S(w)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:w,hasDefaultNodes:O,debug:S}=g();if(v!=null&&v.length){if(O){const k=mNe(v,w);x(k)}S&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:w,hasDefaultEdges:O,debug:S}=g();if(v!=null&&v.length){if(O){const k=gNe(v,w);x(k)}S&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>yb(C,!0));O(k);return}O(Iv(w,new Set([...v]),!0)),S(Iv(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:w,triggerNodeChanges:O,triggerEdgeChanges:S}=g();if(y){const k=v.map(C=>yb(C,!0));S(k);return}S(Iv(x,new Set([...v]))),O(Iv(w,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:w,nodeLookup:O,triggerNodeChanges:S,triggerEdgeChanges:k}=g(),C=v||w,E=y||x,R=[];for(const j of C){if(!j.selected)continue;const T=O.get(j.id);T&&(T.selected=!1),R.push(yb(j.id,!1))}const _=[];for(const j of E)j.selected&&_.push(yb(j.id,!1));S(R),k(_)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=g();y==null||y.setScaleExtent([v,x]),m({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=g();y==null||y.setScaleExtent([x,v]),m({maxZoom:v})},setTranslateExtent:v=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:w,elementsSelectable:O}=g();if(!O)return;const S=y.reduce((C,E)=>E.selected?[...C,yb(E.id,!1)]:C,[]),k=v.reduce((C,E)=>E.selected?[...C,yb(E.id,!1)]:C,[]);x(S),w(k)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:w,nodeOrigin:O,elevateNodesOnSelect:S,nodeExtent:k,zIndexMode:C}=g();v[0][0]===k[0][0]&&v[0][1]===k[0][1]&&v[1][0]===k[1][0]&&v[1][1]===k[1][1]||(RF(y,x,w,{nodeOrigin:O,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:C}),m({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:w,panZoom:O,translateExtent:S}=g();return Qpt({delta:v,panZoom:O,transform:y,translateExtent:S,width:x,height:w})},setCenter:async(v,y,x)=>{const{width:w,height:O,maxZoom:S,panZoom:k}=g();if(!k)return!1;const C=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:S;return await k.setViewport({x:w/2-v*C,y:O/2-y*C,zoom:C},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{m({connection:{...Lje}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...gJ()})}},Object.is);function UNe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>tbt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return a.jsx(bmt,{value:g,children:a.jsx(Qmt,{children:m})})}function nbt({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(SP)?a.jsx(a.Fragment,{children:e}):a.jsx(UNe,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const ibt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function rbt({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:R,onNodesDelete:_,onEdgesDelete:j,onDelete:T,onSelectionChange:N,onSelectionDragStart:A,onSelectionDrag:P,onSelectionDragStop:D,onSelectionContextMenu:M,onSelectionStart:L,onSelectionEnd:U,onBeforeDelete:I,connectionMode:H,connectionLineType:K=mm.Bezier,connectionLineStyle:F,connectionLineComponent:W,connectionLineContainerStyle:V,deleteKeyCode:X="Backspace",selectionKeyCode:ie="Shift",selectionOnDrag:Q=!1,selectionMode:Z=ZS.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:Ee=tE()?"Meta":"Control",zoomActivationKeyCode:Y=tE()?"Meta":"Control",snapToGrid:G,snapGrid:te,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:Ne,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:se,nodesFocusable:Se,nodeOrigin:Le=hNe,edgesFocusable:be,edgesReconnectable:Ve,elementsSelectable:ve=!0,defaultViewport:Re=jmt,minZoom:ne=.5,maxZoom:ge=2,translateExtent:Ce=YS,preventScrolling:ke=!0,nodeExtent:Ke,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:ue=!0,zoomOnPinch:xe=!0,panOnScroll:Te=!1,panOnScrollSpeed:qe=.5,panOnScrollMode:De=Jb.Free,zoomOnDoubleClick:At=!0,panOnDrag:It=!0,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt=1,nodeClickDistance:jt=0,children:Nt,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Me,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht=10,onNodesChange:cn,onEdgesChange:hn,noDragClassName:Ge="nodrag",noWheelClassName:bt="nowheel",noPanClassName:St="nopan",fitView:dn,fitViewOptions:Rt,connectOnClick:$e,attributionPosition:ot,proOptions:vn,defaultEdgeOptions:Ye,elevateNodesOnSelect:mt=!0,elevateEdgesOnSelect:_n=!1,disableKeyboardA11y:Vt=!1,autoPanOnConnect:Ai,autoPanOnNodeDrag:jn,autoPanOnSelection:Hn=!0,autoPanSpeed:En,connectionRadius:vi,isValidConnection:Fn,onError:di,style:wr,id:mr,nodeDragThreshold:ir,connectionDragThreshold:ze,viewport:kt,onViewportChange:nn,width:Nn,height:re,colorMode:xi="light",debug:is,onScroll:$r,ariaLabelConfig:qn,zIndexMode:oi="basic",...Vi},Fr){const ea=mr||"1",za=Pmt(xi),Hr=p.useCallback(vo=>{vo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),$r==null||$r(vo)},[$r]);return a.jsx("div",{"data-testid":"rf__wrapper",...Vi,onScroll:Hr,style:{...wr,...ibt},ref:Fr,className:Mo(["react-flow",r,za]),id:mr,role:"application",children:a.jsxs(nbt,{nodes:e,edges:t,width:Nn,height:re,fitView:dn,fitViewOptions:Rt,minZoom:ne,maxZoom:ge,nodeOrigin:Le,nodeExtent:Ke,zIndexMode:oi,children:[a.jsx(Imt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:se,nodesFocusable:Se,edgesFocusable:be,edgesReconnectable:Ve,elementsSelectable:ve,elevateNodesOnSelect:mt,elevateEdgesOnSelect:_n,minZoom:ne,maxZoom:ge,nodeExtent:Ke,onNodesChange:cn,onEdgesChange:hn,snapToGrid:G,snapGrid:te,connectionMode:H,translateExtent:Ce,connectOnClick:$e,defaultEdgeOptions:Ye,fitView:dn,fitViewOptions:Rt,onNodesDelete:_,onEdgesDelete:j,onDelete:T,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:R,onSelectionDrag:P,onSelectionDragStart:A,onSelectionDragStop:D,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:St,nodeOrigin:Le,rfId:ea,autoPanOnConnect:Ai,autoPanOnNodeDrag:jn,autoPanSpeed:En,onError:di,connectionRadius:vi,isValidConnection:Fn,selectNodesOnDrag:Ne,nodeDragThreshold:ir,connectionDragThreshold:ze,onBeforeDelete:I,debug:is,ariaLabelConfig:qn,zIndexMode:oi}),a.jsx(Jgt,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:o,connectionLineType:K,connectionLineStyle:F,connectionLineComponent:W,connectionLineContainerStyle:V,selectionKeyCode:ie,selectionOnDrag:Q,selectionMode:Z,deleteKeyCode:X,multiSelectionKeyCode:Ee,panActivationKeyCode:ce,zoomActivationKeyCode:Y,onlyRenderVisibleElements:ye,defaultViewport:Re,translateExtent:Ce,minZoom:ne,maxZoom:ge,preventScrolling:ke,zoomOnScroll:ue,zoomOnPinch:xe,zoomOnDoubleClick:At,panOnScroll:Te,panOnScrollSpeed:qe,panOnScrollMode:De,panOnDrag:It,autoPanOnSelection:Hn,onPaneClick:lt,onPaneMouseEnter:Ot,onPaneMouseMove:Ct,onPaneMouseLeave:dt,onPaneScroll:yt,onPaneContextMenu:Ie,paneClickDistance:vt,nodeClickDistance:jt,onSelectionContextMenu:M,onSelectionStart:L,onSelectionEnd:U,onReconnect:ln,onReconnectStart:He,onReconnectEnd:Me,onEdgeContextMenu:We,onEdgeDoubleClick:gt,onEdgeMouseEnter:st,onEdgeMouseMove:xt,onEdgeMouseLeave:ft,reconnectRadius:Ht,defaultMarkerColor:it,noDragClassName:Ge,noWheelClassName:bt,noPanClassName:St,rfId:ea,disableKeyboardA11y:Vt,nodeExtent:Ke,viewport:kt,onViewportChange:nn}),a.jsx(_mt,{onSelectionChange:N}),Nt,a.jsx(Smt,{proOptions:vn,position:ot}),a.jsx(kmt,{rfId:ea,disableKeyboardA11y:Vt})]})})}var sbt=bNe(rbt);const obt=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function abt({children:e}){const t=zi(obt);return t?ri.createPortal(e,t):null}function lbt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>mNe(r,s)),[]);return[t,n,i]}function cbt(e){const[t,n]=p.useState(e),i=p.useCallback(r=>n(s=>gNe(r,s)),[]);return[t,n,i]}const ubt=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!JQ(n.userNode))return!1;return!0};function dbt(e={includeHiddenNodes:!1}){return zi(ubt(e))}function fbt({dimensions:e,lineWidth:t,variant:n,className:i}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Mo(["react-flow__background-pattern",n,i])})}function hbt({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Mo(["react-flow__background-pattern","dots",t])})}var Qm;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Qm||(Qm={}));const pbt={[Qm.Dots]:1,[Qm.Lines]:1,[Qm.Cross]:6},mbt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function QNe({id:e,variant:t=Qm.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=zi(mbt,As),g=i||pbt[t],b=t===Qm.Dots,v=t===Qm.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],w=g*h[2],O=Array.isArray(s)?s:[s,s],S=v?[w,w]:x,k=[O[0]*h[2]||1+S[0]/2,O[1]*h[2]||1+S[1]/2],C=`${m}${e||""}`;return a.jsxs("svg",{className:Mo(["react-flow__background",u]),style:{...c,...TP,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[a.jsx("pattern",{id:C,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:b?a.jsx(hbt,{radius:w/2,className:d}):a.jsx(fbt,{dimensions:S,lineWidth:r,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}QNe.displayName="Background";const gbt=p.memo(QNe);function bbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function ybt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function vbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function xbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function wbt(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function BA({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Mo(["react-flow__controls-button",t]),...n,children:e})}const Obt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zNe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":m}){const g=_s(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=zi(Obt,As),{zoomIn:w,zoomOut:O,fitView:S}=CP(),k=()=>{w(),s==null||s()},C=()=>{O(),o==null||o()},E=()=>{S(r),l==null||l()},R=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},_=h==="horizontal"?"horizontal":"vertical";return a.jsxs(EP,{className:Mo(["react-flow__controls",_,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(BA,{onClick:k,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:a.jsx(bbt,{})}),a.jsx(BA,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:a.jsx(ybt,{})})]}),n&&a.jsx(BA,{className:"react-flow__controls-fitview",onClick:E,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:a.jsx(vbt,{})}),i&&a.jsx(BA,{className:"react-flow__controls-interactive",onClick:R,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?a.jsx(wbt,{}):a.jsx(xbt,{})}),d]})}zNe.displayName="Controls";const kbt=p.memo(zNe);function Sbt({id:e,x:t,y:n,width:i,height:r,style:s,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},v=o||g||b;return a.jsx("rect",{className:Mo(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:r,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:m?y=>m(y,e):void 0})}const Ebt=p.memo(Sbt),Cbt=e=>e.nodes.map(t=>t.id),p5=e=>e instanceof Function?e:()=>e;function Tbt({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=Ebt,onClick:o}){const l=zi(Cbt,As),c=p5(t),u=p5(e),d=p5(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(_bt,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:o,shapeRendering:f},h))})}function Abt({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:m}=zi(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:w,height:O}=Cp(v);return{node:v,x:y,y:x,width:w,height:O}},As);return!u||u.hidden||!JQ(u)?null:a.jsx(l,{x:d,y:f,width:h,height:m,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:r,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:c,id:u.id})}const _bt=p.memo(Abt);var jbt=p.memo(Tbt);const Nbt=200,Rbt=150,Ibt=e=>!e.hidden,Pbt=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Qje(jC(e.nodeLookup,{filter:Ibt}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Dbt="react-flow__minimap-desc";function VNe({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:w=1,offsetScale:O=5}){const S=_s(),k=p.useRef(null),{boundingRect:C,viewBB:E,rfId:R,panZoom:_,translateExtent:j,flowWidth:T,flowHeight:N,ariaLabelConfig:A}=zi(Pbt,As),P=(e==null?void 0:e.width)??Nbt,D=(e==null?void 0:e.height)??Rbt,M=C.width/P,L=C.height/D,U=Math.max(M,L),I=U*P,H=U*D,K=O*U,F=C.x-(I-C.width)/2-K,W=C.y-(H-C.height)/2-K,V=I+K*2,X=H+K*2,ie=`${Dbt}-${R}`,Q=p.useRef(0),Z=p.useRef();Q.current=U,p.useEffect(()=>{if(k.current&&_)return Z.current=Ypt({domNode:k.current,panZoom:_,getTransform:()=>S.getState().transform,getViewScale:()=>Q.current}),()=>{var G;(G=Z.current)==null||G.destroy()}},[_]),p.useEffect(()=>{var G;(G=Z.current)==null||G.update({translateExtent:j,width:T,height:N,inversePan:x,pannable:b,zoomStep:w,zoomable:v})},[b,v,x,w,j,T,N]);const ce=m?G=>{var Ne;const[te,ye]=((Ne=Z.current)==null?void 0:Ne.pointer(G))||[0,0];m(G,{x:te,y:ye})}:void 0,Ee=g?p.useCallback((G,te)=>{const ye=S.getState().nodeLookup.get(te).internals.userNode;g(G,ye)},[]):void 0,Y=y??A["minimap.ariaLabel"];return a.jsx(EP,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*U:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Mo(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:P,height:D,viewBox:`${F} ${W} ${V} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ie,ref:k,onClick:ce,children:[Y&&a.jsx("title",{id:ie,children:Y}),a.jsx(jbt,{onClick:Ee,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-K},${W-K}h${V+K*2}v${X+K*2}h${-V-K*2}z + M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}VNe.displayName="MiniMap";p.memo(VNe);const Mbt=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Lbt={[rw.Line]:"right",[rw.Handle]:"bottom-right"};function $bt({nodeId:e,position:t,variant:n=rw.Handle,className:i,style:r=void 0,children:s,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=wNe(),w=typeof e=="string"?e:x,O=_s(),S=p.useRef(null),k=n===rw.Handle,C=zi(p.useCallback(Mbt(k&&m),[k,m]),As),E=p.useRef(null),R=t??Lbt[n];p.useEffect(()=>{if(!(!S.current||!w))return E.current||(E.current=umt({domNode:S.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:j,transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P,domNode:D}=O.getState();return{nodeLookup:j,transform:T,snapGrid:N,snapToGrid:A,nodeOrigin:P,paneDomNode:D}},onChange:(j,T)=>{const{triggerNodeChanges:N,nodeLookup:A,parentLookup:P,nodeOrigin:D}=O.getState(),M=[],L={x:j.x,y:j.y},U=A.get(w);if(U&&U.expandParent&&U.parentId){const I=U.origin??D,H=j.width??U.measured.width??0,K=j.height??U.measured.height??0,F={id:U.id,parentId:U.parentId,rect:{width:H,height:K,...Vje({x:j.x??U.position.x,y:j.y??U.position.y},{width:H,height:K},U.parentId,A,I)}},W=sz([F],A,P,D);M.push(...W),L.x=j.x?Math.max(I[0]*H,j.x):void 0,L.y=j.y?Math.max(I[1]*K,j.y):void 0}if(L.x!==void 0&&L.y!==void 0){const I={id:w,type:"position",position:{...L}};M.push(I)}if(j.width!==void 0&&j.height!==void 0){const H={id:w,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};M.push(H)}for(const I of T){const H={...I,type:"position"};M.push(H)}N(M)},onEnd:({width:j,height:T})=>{const N={id:w,type:"dimensions",resizing:!1,dimensions:{width:j,height:T}};O.getState().triggerNodeChanges([N])}})),E.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{var j;(j=E.current)==null||j.destroy()}},[R,l,c,u,d,f,b,v,y,g]);const _=R.split("-");return a.jsx("div",{className:Mo(["react-flow__resize-control","nodrag",..._,n,i]),ref:S,style:{...r,scale:C,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:s})}p.memo($bt);var HNe=Object.defineProperty,Fbt=(e,t,n)=>t in e?HNe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bbt=(e,t)=>{for(var n in t)HNe(e,n,{get:t[n],enumerable:!0})},Ubt=(e,t,n)=>Fbt(e,t+"",n),qNe={};Bbt(qNe,{Graph:()=>ed,alg:()=>az,json:()=>KNe,version:()=>Vbt});var Qbt=Object.defineProperty,WNe=(e,t)=>{for(var n in t)Qbt(e,n,{get:t[n],enumerable:!0})},ed=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let i=n;i!==void 0;i=this.parent(i))if(i===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let i=new Set(n);for(let r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,o])=>{t(s)&&n.setNode(s,o)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let i={},r=s=>{let o=this.parent(s);return!o||n.hasNode(o)?(i[s]=o??void 0,o??void 0):o in i?i[o]:r(o)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,r(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((i,r)=>(n!==void 0?this.setEdge(i,r,n):this.setEdge(i,r),r)),this}setEdge(t,n,i,r){let s,o,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,o=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,o=n,l=r,arguments.length>2&&(c=i,u=!0)),s=""+s,o=""+o,l!==void 0&&(l=""+l);let d=WO(this._isDirected,s,o,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(o),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,o,l);let f=zbt(this._isDirected,s,o,l);return s=f.v,o=f.w,Object.freeze(f),this._edgeObjs[d]=f,bJ(this._preds[o],s),bJ(this._sucs[s],o),this._in[o][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,i){let r=arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i);return this._edgeLabels[r]}edgeAsObj(t,n,i){let r=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof r!="object"?{label:r}:r}hasEdge(t,n,i){return(arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let r=arguments.length===1?m5(this._isDirected,t):WO(this._isDirected,t,n,i),s=this._edgeObjs[r];if(s){let o=s.v,l=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],yJ(this._preds[l],o),yJ(this._sucs[o],l),delete this._in[l][r],delete this._out[o][r],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,i){if(!t)return;let r=Object.values(t);return i?r.filter(s=>s.v===n&&s.w===i||s.v===i&&s.w===n):r}};function bJ(e,t){e[t]?e[t]++:e[t]=1}function yJ(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function WO(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let o=r;r=s,s=o}return r+""+s+""+(i===void 0?"\0":i)}function zbt(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let l=r;r=s,s=l}let o={v:r,w:s};return i&&(o.name=i),o}function m5(e,t){return WO(e,t.v,t.w,t.name)}var Vbt="4.0.1",KNe={};WNe(KNe,{read:()=>Kbt,write:()=>Hbt});function Hbt(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:qbt(e),edges:Wbt(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function qbt(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),r={v:t};return n!==void 0&&(r.value=n),i!==void 0&&(r.parent=i),r})}function Wbt(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function Kbt(e){let t=new ed(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var az={};WNe(az,{CycleException:()=>IN,bellmanFord:()=>GNe,components:()=>Ybt,dijkstra:()=>RN,dijkstraAll:()=>eyt,findCycles:()=>tyt,floydWarshall:()=>iyt,isAcyclic:()=>syt,postorder:()=>ayt,preorder:()=>lyt,prim:()=>cyt,shortestPaths:()=>uyt,tarjan:()=>YNe,topsort:()=>ZNe});var Gbt=()=>1;function GNe(e,t,n,i){return Xbt(e,String(t),n||Gbt,i||function(r){return e.outEdges(r)})}function Xbt(e,t,n,i){let r={},s,o=0,l=e.nodes(),c=function(f){let h=n(f);r[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,i=String(e);if(!(i in n)){let r=this._arr,s=r.length;return n[i]=s,r.push({key:i,priority:t}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,r=e;n>1,!(t[i].priority1;function RN(e,t,n,i){let r=function(s){return e.outEdges(s)};return Jbt(e,String(t),n||Zbt,i||r)}function Jbt(e,t,n,i){let r={},s=new XNe,o,l,c=function(u){let d=u.v!==o?u.v:u.w,f=r[d],h=n(u),m=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);m0&&(o=s.removeMin(),l=r[o],l.distance!==Number.POSITIVE_INFINITY);)i(o).forEach(c);return r}function eyt(e,t,n){return e.nodes().reduce(function(i,r){return i[r]=RN(e,r,t,n),i},{})}function YNe(e){let t=0,n=[],i={},r=[];function s(o){let l=i[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(c){c in i?i[c].onStack&&(l.lowlink=Math.min(l.lowlink,i[c].index)):(s(c),l.lowlink=Math.min(l.lowlink,i[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(o!==u);r.push(c)}}return e.nodes().forEach(function(o){o in i||s(o)}),r}function tyt(e){return YNe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var nyt=()=>1;function iyt(e,t,n){return ryt(e,t||nyt,n||function(i){return e.outEdges(i)})}function ryt(e,t,n){let i={},r=e.nodes();return r.forEach(function(s){i[s]={},i[s][s]={distance:0,predecessor:""},r.forEach(function(o){s!==o&&(i[s][o]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(o){let l=o.v===s?o.w:o.v,c=t(o);i[s][l]={distance:c,predecessor:s}})}),r.forEach(function(s){let o=i[s];r.forEach(function(l){let c=i[l];r.forEach(function(u){let d=c[s],f=o[u],h=c[u],m=d.distance+f.distance;m{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},o={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);r=JNe(e,l,n==="post",o,s,i,r)}),r}function JNe(e,t,n,i,r,s,o){return t in i||(i[t]=!0,n||(o=s(o,t)),r(t).forEach(function(l){o=JNe(e,l,n,i,r,s,o)}),n&&(o=s(o,t))),o}function eRe(e,t,n){return oyt(e,t,n,function(i,r){return i.push(r),i},[])}function ayt(e,t){return eRe(e,t,"post")}function lyt(e,t){return eRe(e,t,"pre")}function cyt(e,t){let n=new ed,i={},r=new XNe,s;function o(c){let u=c.v===s?c.w:c.v,d=r.priority(u);if(d!==void 0){let f=t(c);f0;){if(s=r.removeMin(),s in i)n.setEdge(s,i[s]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(s).forEach(o)}return n}function uyt(e,t,n,i){return dyt(e,t,n,i??(r=>{let s=e.outEdges(r);return s??[]}))}function dyt(e,t,n,i){if(n===void 0)return RN(e,t,n,i);let r=!1,s=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+r.weight,minlen:Math.max(i.minlen,r.minlen)})}),t}function tRe(e){let t=new ed({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function vJ(e,t){let n=e.x,i=e.y,r=t.x-n,s=t.y-i,o=e.width/2,l=e.height/2;if(!r&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*o>Math.abs(r)*l?(s<0&&(l=-l),c=l*r/s,u=l):(r<0&&(o=-o),c=o,u=o*s/r),{x:n+c,y:i+u}}function IC(e){let t=iE(iRe(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),r=i.rank;r!==void 0&&(t[r]||(t[r]=[]),t[r][i.order]=n)}),t}function hyt(e){let t=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),n=xf(Math.min,t);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function pyt(e){let t=e.nodes().map(o=>e.node(o).rank).filter(o=>o!==void 0),n=xf(Math.min,t),i=[];e.nodes().forEach(o=>{let l=e.node(o).rank-n;i[l]||(i[l]=[]),i[l].push(o)});let r=0,s=e.graph().nodeRankFactor;Array.from(i).forEach((o,l)=>{o===void 0&&l%s!==0?--r:o!==void 0&&r&&o.forEach(c=>e.node(c).rank+=r)})}function xJ(e,t,n,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=i),Gw(e,"border",r,t)}function myt(e,t=nRe){let n=[];for(let i=0;inRe){let n=myt(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function iRe(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return xf(Math.max,t)}function gyt(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function rRe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function sRe(e,t){return t()}var byt=0;function lz(e){let t=++byt;return e+(""+t)}function iE(e,t,n=1){t==null&&(t=e,e=0);let i=s=>sti[t]:n=t,Object.entries(e).reduce((i,[r,s])=>(i[r]=n(s,r),i),{})}function yyt(e,t){return e.reduce((n,i,r)=>(n[i]=t[r],n),{})}var _P="\0",vyt="3.0.0",xyt=class{constructor(){Ubt(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return wJ(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&wJ(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,wyt)),n=n._prev;return"["+e.join(", ")+"]"}};function wJ(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function wyt(e,t){if(e!=="_next"&&e!=="_prev")return t}var Oyt=xyt,kyt=()=>1;function Syt(e,t){if(e.nodeCount()<=1)return[];let n=Cyt(e,t||kyt);return Eyt(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function Eyt(e,t,n){var i;let r=[],s=t[t.length-1],o=t[0],l;for(;e.nodeCount();){for(;l=o.dequeue();)g5(e,t,n,l);for(;l=s.dequeue();)g5(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(i=t[c])==null?void 0:i.dequeue(),l){r=r.concat(g5(e,t,n,l,!0)||[]);break}}}return r}function g5(e,t,n,i,r){let s=[],o=r?s:void 0;return(e.inEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);r&&s.push({v:l.v,w:l.w}),u.out-=c,DF(t,n,u)}),(e.outEdges(i.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,DF(t,n,d)}),e.removeNode(i.v),o}function Cyt(e,t){let n=new ed,i=0,r=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);r=Math.max(r,f.out+=u),i=Math.max(i,h.in+=u)});let s=Tyt(r+i+3).map(()=>new Oyt),o=i+1;return n.nodes().forEach(l=>{DF(s,o,n.node(l))}),{graph:n,buckets:s,zeroIdx:o}}function DF(e,t,n){var i,r,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(r=e[e.length-1])==null||r.enqueue(n):(i=e[0])==null||i.enqueue(n)}function Tyt(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,lz("rev"))});function t(n){return i=>n.edge(i).weight}}function _yt(e){let t=[],n={},i={};function r(s){Object.hasOwn(i,s)||(i[s]=!0,n[s]=!0,e.outEdges(s).forEach(o=>{Object.hasOwn(n,o.w)?t.push(o):r(o.w)}),delete n[s])}return e.nodes().forEach(r),t}function jyt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function Nyt(e){e.graph().dummyChains=[],e.edges().forEach(t=>Ryt(e,t))}function Ryt(e,t){let n=t.v,i=e.node(n).rank,r=t.w,s=e.node(r).rank,o=t.name,l=e.edge(t),c=l.labelRank;if(s===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i{let n=e.node(t),i=n.edgeLabel,r;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}function cz(e){let t={};function n(i){let r=e.node(i);if(Object.hasOwn(t,i))return r.rank;t[i]=!0;let s=e.outEdges(i),o=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=xf(Math.min,o);return l===Number.POSITIVE_INFINITY&&(l=0),r.rank=l}e.sources().forEach(n)}function sw(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var oRe=Pyt;function Pyt(e){let t=new ed({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],r=e.nodeCount();t.setNode(i,{});let s,o;for(;Dyt(t,e){let o=s.v,l=i===o?s.w:o;!e.hasNode(l)&&!sw(t,s)&&(e.setNode(l,{}),e.setEdge(i,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Myt(e,t){return t.edges().reduce((n,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=sw(t,i)),rt.node(i).rank+=n)}var{preorder:$yt,postorder:Fyt}=az,Byt=qy;qy.initLowLimValues=dz;qy.initCutValues=uz;qy.calcCutValue=aRe;qy.leaveEdge=cRe;qy.enterEdge=uRe;qy.exchangeEdges=dRe;function qy(e){e=fyt(e),cz(e);let t=oRe(e);dz(t),uz(t,e);let n,i;for(;n=cRe(t);)i=uRe(t,e,n),dRe(t,e,n,i)}function uz(e,t){let n=Fyt(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>Uyt(e,t,i))}function Uyt(e,t,n){let i=e.node(n).parent,r=e.edge(n,i);r.cutvalue=aRe(e,t,n)}function aRe(e,t,n){let i=e.node(n).parent,r=!0,s=t.edge(n,i),o=0;s||(r=!1,s=t.edge(i,n)),o=s.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==i){let f=u===r,h=t.edge(c).weight;if(o+=f?h:-h,zyt(e,n,d)){let m=e.edge(n,d).cutvalue;o+=f?-m:m}}}),o}function dz(e,t){arguments.length<2&&(t=e.nodes()[0]),lRe(e,{},1,t)}function lRe(e,t,n,i,r){let s=n,o=e.node(i);t[i]=!0;let l=e.neighbors(i);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=lRe(e,t,n,c,i))}),o.low=s,o.lim=n++,r?o.parent=r:delete o.parent,n}function cRe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function uRe(e,t,n){let i=n.v,r=n.w;t.hasEdge(i,r)||(i=n.w,r=n.v);let s=e.node(i),o=e.node(r),l=s,c=!1;return s.lim>o.lim&&(l=o,c=!0),t.edges().filter(u=>c===OJ(e,e.node(u.v),l)&&c!==OJ(e,e.node(u.w),l)).reduce((u,d)=>sw(t,d)!e.node(r).parent);if(!n)return;let i=$yt(e,[n]);i=i.slice(1),i.forEach(r=>{let s=e.node(r).parent,o=t.edge(r,s),l=!1;o||(o=t.edge(s,r),l=!0),t.node(r).rank=t.node(s).rank+(l?o.minlen:-o.minlen)})}function zyt(e,t,n){return e.hasEdge(t,n)}function OJ(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Vyt=Hyt;function Hyt(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":kJ(e);break;case"tight-tree":Wyt(e);break;case"longest-path":qyt(e);break;case"none":break;default:kJ(e)}}var qyt=cz;function Wyt(e){cz(e),oRe(e)}function kJ(e){Byt(e)}var Kyt=Gyt;function Gyt(e){let t=Yyt(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),r=i.edgeObj,s=Xyt(e,t,r.v,r.w),o=s.path,l=s.lca,c=0,u=o[c],d=!0;for(;n!==r.w;){if(i=e.node(n),d){for(;(u=o[c])!==l&&e.node(u).maxRanko||l>t[c].lim));let u=c,d=i;for(;(d=e.parent(d))!==u;)s.push(d);return{path:r.concat(s.reverse()),lca:u}}function Yyt(e){let t={},n=0;function i(r){let s=n;e.children(r).forEach(i),t[r]={low:s,lim:n++}}return e.children(_P).forEach(i),t}function Zyt(e){let t=Gw(e,"root",{},"_root"),n=Jyt(e),i=Object.values(n),r=xf(Math.max,i)-1,s=2*r+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let o=e0t(e)+1;e.children(_P).forEach(l=>fRe(e,t,s,o,r,n,l)),e.graph().nodeRankFactor=s}function fRe(e,t,n,i,r,s,o){var l;let c=e.children(o);if(!c.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let u=xJ(e,"_bt"),d=xJ(e,"_bb"),f=e.node(o);e.setParent(u,o),f.borderTop=u,e.setParent(d,o),f.borderBottom=d,c.forEach(h=>{var m;fRe(e,t,n,i,r,s,h);let g=e.node(h),b=g.borderTop?g.borderTop:h,v=g.borderBottom?g.borderBottom:h,y=g.borderTop?i:2*i,x=b!==v?1:r-((m=s[o])!=null?m:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,u,{weight:0,minlen:r+((l=s[o])!=null?l:0)})}function Jyt(e){let t={};function n(i,r){let s=e.children(i);s&&s.length&&s.forEach(o=>n(o,r+1)),t[i]=r}return e.children(_P).forEach(i=>n(i,1)),t}function e0t(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function t0t(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var n0t=i0t;function i0t(e){function t(n){let i=e.children(n),r=e.node(n);if(i.length&&i.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let s=r.minRank,o=r.maxRank+1;sEJ(e.node(t))),e.edges().forEach(t=>EJ(e.edge(t)))}function EJ(e){let t=e.width;e.width=e.height,e.height=t}function o0t(e){e.nodes().forEach(t=>b5(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(b5),Object.hasOwn(i,"y")&&b5(i)})}function b5(e){e.y=-e.y}function a0t(e){e.nodes().forEach(t=>y5(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(y5),Object.hasOwn(i,"x")&&y5(i)})}function y5(e){let t=e.x;e.x=e.y,e.y=t}function l0t(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),i=n.map(l=>e.node(l).rank),r=xf(Math.max,i),s=iE(r+1).map(()=>[]);function o(l){if(t[l])return;t[l]=!0;let c=e.node(l);s[c.rank].push(l);let u=e.successors(l);u&&u.forEach(o)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(o),s}function c0t(e,t){let n=0;for(let i=1;id)),r=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:i[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),s=1;for(;s{let d=u.pos+s;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function d0t(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let r=i.reduce((s,o)=>{let l=e.edge(o),c=e.node(o.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}})}function f0t(e,t){let n={};e.forEach((r,s)=>{let o={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(o.barycenter=r.barycenter,o.weight=r.weight),n[r.v]=o}),t.edges().forEach(r=>{let s=n[r.v],o=n[r.w];s!==void 0&&o!==void 0&&(o.indegree++,s.out.push(o))});let i=Object.values(n).filter(r=>!r.indegree);return h0t(i)}function h0t(e){let t=[];function n(r){return s=>{s.merged||(s.barycenter===void 0||r.barycenter===void 0||s.barycenter>=r.barycenter)&&p0t(r,s)}}function i(r){return s=>{s.in.push(r),--s.indegree===0&&e.push(s)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(i(r))}return t.filter(r=>!r.merged).map(r=>PN(r,["vs","i","barycenter","weight"]))}function p0t(e,t){let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}function m0t(e,t){let n=gyt(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,r=n.rhs.sort((d,f)=>f.i-d.i),s=[],o=0,l=0,c=0;i.sort(g0t(!!t)),c=CJ(s,r,c),i.forEach(d=>{c+=d.vs.length,s.push(d.vs),o+=d.barycenter*d.weight,l+=d.weight,c=CJ(s,r,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=o/l,u.weight=l),u}function CJ(e,t,n){let i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),e.push(i.vs),n++;return n}function g0t(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function pRe(e,t,n,i){let r=e.children(t),s=e.node(t),o=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};o&&(r=r.filter(h=>h!==o&&h!==l));let u=d0t(e,r);u.forEach(h=>{if(e.children(h.v).length){let m=pRe(e,h.v,n,i);c[h.v]=m,Object.hasOwn(m,"barycenter")&&y0t(h,m)}});let d=f0t(u,n);b0t(d,c);let f=m0t(d,i);if(o&&l){f.vs=[o,f.vs,l].flat(1);let h=e.predecessors(o);if(h&&h.length){let m=e.node(h[0]),g=e.predecessors(l),b=e.node(g[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+m.order+b.order)/(f.weight+2),f.weight+=2}}return f}function b0t(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function y0t(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function v0t(e,t,n,i){i||(i=e.nodes());let r=x0t(e),s=new ed({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(o=>e.node(o));return i.forEach(o=>{let l=e.node(o),c=e.parent(o);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){s.setNode(o),s.setParent(o,c||r);let u=e[n](o);u&&u.forEach(d=>{let f=d.v===o?d.w:d.v,h=s.edge(f,o),m=h!==void 0?h.weight:0;s.setEdge(f,o,{weight:e.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(o,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function x0t(e){let t;for(;e.hasNode(t=lz("_root")););return t}function w0t(e,t,n){let i={},r;n.forEach(s=>{let o=e.parent(s),l,c;for(;o;){if(l=e.parent(o),l?(c=i[l],i[l]=o):(c=r,r=o),c&&c!==o){t.setEdge(c,o);return}o=l}})}function mRe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,mRe);return}let n=iRe(e),i=TJ(e,iE(1,n+1),"inEdges"),r=TJ(e,iE(n-1,-1,-1),"outEdges"),s=l0t(e);if(AJ(e,s),t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){O0t(u%2?i:r,u%4>=2,c),s=IC(e);let f=c0t(e,s);f{i.has(s)||i.set(s,[]),i.get(s).push(o)};for(let s of e.nodes()){let o=e.node(s);if(typeof o.rank=="number"&&r(o.rank,s),typeof o.minRank=="number"&&typeof o.maxRank=="number")for(let l=o.minRank;l<=o.maxRank;l++)l!==o.rank&&r(l,s)}return t.map(function(s){return v0t(e,s,n,i.get(s)||[])})}function O0t(e,t,n){let i=new ed;e.forEach(function(r){n.forEach(l=>i.setEdge(l.left,l.right));let s=r.graph().root,o=pRe(r,s,i,t);o.vs.forEach((l,c)=>r.node(l).order=c),w0t(r,i,o.vs)})}function AJ(e,t){Object.values(t).forEach(n=>n.forEach((i,r)=>e.node(i).order=r))}function k0t(e,t){let n={};function i(r,s){let o=0,l=0,c=r.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=E0t(e,d),m=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(g=>{let b=e.predecessors(g);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(m=>{if(m===void 0)return;let g=e.node(m);g.dummy&&(g.orderu)&&gRe(n,m,f)})}})}function r(s,o){let l=-1,c=-1,u=0;return o.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let m=h[0];if(m===void 0)return;c=e.node(m).order,i(o,u,f,l,c),u=f,l=c}}i(o,u,o.length,c,s.length)}),o}return t.length&&t.reduce(r),n}function E0t(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function gRe(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];i||(e[t]=i={}),i[n]=!0}function C0t(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];return i!==void 0&&Object.hasOwn(i,n)}function T0t(e,t,n,i){let r={},s={},o={};return t.forEach(l=>{l.forEach((c,u)=>{r[c]=c,s[c]=c,o[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=i(u);if(d&&d.length){let f=d.sort((m,g)=>{let b=o[m],v=o[g];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let m=Math.floor(h),g=Math.ceil(h);m<=g;++m){let b=f[m];if(b===void 0)continue;let v=o[b];if(v!==void 0&&s[u]===u&&c{var y;let x=(y=s[v.v])!=null?y:0,w=o.edge(v);return Math.max(b,x+(w!==void 0?w:0))},0):s[m]=0}function d(m){let g=o.outEdges(m),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((y,x)=>{let w=s[x.w],O=o.edge(x);return Math.min(y,(w!==void 0?w:0)-(O!==void 0?O:0))},Number.POSITIVE_INFINITY));let v=e.node(m);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(s[m]=Math.max(s[m]!==void 0?s[m]:0,b))}function f(m){return o.predecessors(m)||[]}function h(m){return o.successors(m)||[]}return c(u,f),c(d,h),Object.keys(i).forEach(m=>{var g;let b=n[m];b!==void 0&&(s[m]=(g=s[b])!=null?g:0)}),s}function _0t(e,t,n,i){let r=new ed,s=e.graph(),o=P0t(s.nodesep,s.edgesep,i);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(r.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=r.edge(f,d);r.setEdge(f,d,Math.max(o(e,u,c),h||0))}}c=u}})}),r}function j0t(e,t){return Object.values(t).reduce((n,i)=>{let r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([l,c])=>{let u=D0t(e,l)/2;r=Math.max(c+u,r),s=Math.min(c-u,s)});let o=r-s;return o{["l","r"].forEach(o=>{let l=s+o,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=i-xf(Math.min,u);o!=="l"&&(d=r-xf(Math.max,u)),d&&(e[l]=AP(c,f=>f+d))})})}function R0t(e,t=void 0){let n=e.ul;return n?AP(n,(i,r)=>{var s,o;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[r]!==void 0)return u[r]}let l=Object.values(e).map(c=>{let u=c[r];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((s=l[1])!=null?s:0)+((o=l[2])!=null?o:0))/2}):{}}function I0t(e){let t=IC(e),n=Object.assign(k0t(e,t),S0t(e,t)),i={},r;["u","d"].forEach(o=>{r=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(r=r.map(d=>Object.values(d).reverse()));let c=T0t(e,r,n,d=>(o==="u"?e.predecessors(d):e.successors(d))||[]),u=A0t(e,r,c.root,c.align,l==="r");l==="r"&&(u=AP(u,d=>-d)),i[o+l]=u})});let s=j0t(e,i);return N0t(i,s),R0t(i,e.graph().align)}function P0t(e,t,n){return(i,r,s)=>{let o=i.node(r),l=i.node(s),c=0,u;if(c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(o.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function D0t(e,t){return e.node(t).width}function M0t(e){e=tRe(e),L0t(e),Object.entries(I0t(e)).forEach(([t,n])=>e.node(t).x=n)}function L0t(e){let t=IC(e),n=e.graph(),i=n.ranksep,r=n.rankalign,s=0;t.forEach(o=>{let l=o.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);o.forEach(c=>{let u=e.node(c);r==="top"?u.y=s+u.height/2:r==="bottom"?u.y=s+l-u.height/2:u.y=s+l/2}),s+=l+i})}function $0t(e,t={}){let n=t.debugTiming?rRe:sRe;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>K0t(e));return n(" runLayout",()=>F0t(i,n,t)),n(" updateInputGraph",()=>B0t(e,i)),i})}function F0t(e,t,n){t(" makeSpaceForEdgeLabels",()=>G0t(e)),t(" removeSelfEdges",()=>rvt(e)),t(" acyclic",()=>Ayt(e)),t(" nestingGraph.run",()=>Zyt(e)),t(" rank",()=>Vyt(tRe(e))),t(" injectEdgeLabelProxies",()=>X0t(e)),t(" removeEmptyRanks",()=>pyt(e)),t(" nestingGraph.cleanup",()=>t0t(e)),t(" normalizeRanks",()=>hyt(e)),t(" assignRankMinMax",()=>Y0t(e)),t(" removeEdgeLabelProxies",()=>Z0t(e)),t(" normalize.run",()=>Nyt(e)),t(" parentDummyChains",()=>Kyt(e)),t(" addBorderSegments",()=>n0t(e)),t(" order",()=>mRe(e,n)),t(" insertSelfEdges",()=>svt(e)),t(" adjustCoordinateSystem",()=>r0t(e)),t(" position",()=>M0t(e)),t(" positionSelfEdges",()=>ovt(e)),t(" removeBorderNodes",()=>ivt(e)),t(" normalize.undo",()=>Iyt(e)),t(" fixupEdgeLabelCoords",()=>tvt(e)),t(" undoCoordinateSystem",()=>s0t(e)),t(" translateGraph",()=>J0t(e)),t(" assignNodeIntersects",()=>evt(e)),t(" reversePoints",()=>nvt(e)),t(" acyclic.undo",()=>jyt(e))}function B0t(e,t){e.nodes().forEach(n=>{let i=e.node(n),r=t.node(n);i&&(i.x=r.x,i.y=r.y,i.order=r.order,i.rank=r.rank,t.children(n).length&&(i.width=r.width,i.height=r.height))}),e.edges().forEach(n=>{let i=e.edge(n),r=t.edge(n);i.points=r.points,Object.hasOwn(r,"x")&&(i.x=r.x,i.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var U0t=["nodesep","edgesep","ranksep","marginx","marginy"],Q0t={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},z0t=["acyclicer","ranker","rankdir","align","rankalign"],V0t=["width","height","rank"],_J={width:0,height:0},H0t=["minlen","weight","width","height","labeloffset"],q0t={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},W0t=["labelpos"];function K0t(e){let t=new ed({multigraph:!0,compound:!0}),n=x5(e.graph());return t.setGraph(Object.assign({},Q0t,v5(n,U0t),PN(n,z0t))),e.nodes().forEach(i=>{let r=x5(e.node(i)),s=v5(r,V0t);Object.keys(_J).forEach(l=>{s[l]===void 0&&(s[l]=_J[l])}),t.setNode(i,s);let o=e.parent(i);o!==void 0&&t.setParent(i,o)}),e.edges().forEach(i=>{let r=x5(e.edge(i));t.setEdge(i,Object.assign({},q0t,v5(r,H0t),PN(r,W0t)))}),t}function G0t(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let i=e.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function X0t(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let i=e.node(t.v),r={rank:(e.node(t.w).rank-i.rank)/2+i.rank,e:t};Gw(e,"edge-proxy",r,"_ep")}})}function Y0t(e){let t=0;e.nodes().forEach(n=>{let i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Math.max(t,i.maxRank))}),e.graph().maxRank=t}function Z0t(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let i=n;e.edge(i.e).labelRank=n.rank,e.removeNode(t)}})}function J0t(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,r=0,s=e.graph(),o=s.marginx||0,l=s.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,m=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),i=Math.min(i,f-m/2),r=Math.max(r,f+m/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=o,i-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=i}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=i}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=i)}),s.width=n-t+o,s.height=r-i+l}function evt(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),r=e.node(t.w),s,o;n.points?(s=n.points[0],o=n.points[n.points.length-1]):(n.points=[],s=r,o=i),n.points.unshift(vJ(i,s)),n.points.push(vJ(r,o))})}function tvt(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function nvt(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function ivt(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),i=e.node(n.borderTop),r=e.node(n.borderBottom),s=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-s.x),n.height=Math.abs(r.y-i.y),n.x=s.x+n.width/2,n.y=i.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function rvt(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function svt(e){IC(e).forEach(t=>{let n=0;t.forEach((i,r)=>{let s=e.node(i);s.order=r+n,(s.selfEdges||[]).forEach(o=>{Gw(e,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:r+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function ovt(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let i=n,r=e.node(i.e.v),s=r.x+r.width/2,o=r.y,l=n.x-s,c=r.height/2;e.setEdge(i.e,i.label),e.removeNode(t),i.label.points=[{x:s+2*l/3,y:o-c},{x:s+5*l/6,y:o-c},{x:s+l,y:o},{x:s+5*l/6,y:o+c},{x:s+2*l/3,y:o+c}],i.label.x=n.x,i.label.y=n.y}})}function v5(e,t){return AP(PN(e,t),Number)}function x5(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function avt(e){let t=IC(e),n=new ed({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+e.node(i).rank)}),e.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),t.forEach((i,r)=>{let s="layer"+r;n.setNode(s,{rank:"same"}),i.reduce((o,l)=>(n.setEdge(o,l,{style:"invis"}),l))}),n}var lvt={graphlib:qNe,version:vyt,layout:$0t,debug:avt,util:{time:rRe,notime:sRe}},jJ=lvt;/*! For license information please see dagre.esm.js.LEGAL.txt */const KO={llm:{labelKey:"buildCanvas.patterns.llm.label",descriptionKey:"buildCanvas.patterns.llm.description",icon:EAe},sequential:{labelKey:"buildCanvas.patterns.sequential.label",descriptionKey:"buildCanvas.patterns.sequential.description",icon:lit},parallel:{labelKey:"buildCanvas.patterns.parallel.label",descriptionKey:"buildCanvas.patterns.parallel.description",icon:Qnt},loop:{labelKey:"buildCanvas.patterns.loop.label",descriptionKey:"buildCanvas.patterns.loop.description",icon:_Ae},a2a:{labelKey:"buildCanvas.patterns.a2a.label",descriptionKey:"buildCanvas.patterns.a2a.description",icon:tP}},MF=220,LF=88,NJ=96,RJ=34,Bk=64,w5=310,Pv=24,bRe=56,$F=40,IJ=40,cvt=18,uvt=58,dvt=!1,fvt=e=>e==="sequential"||e==="parallel"||e==="loop";function FF(e,t){const n=e.agentType??"llm";return fvt(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function BF(e,t=[],n="horizontal",i=!1){const r=e.agentType??"llm";if(!FF(e,t))return{width:MF,height:LF};if(i&&e.subAgents.length===0)return{width:w5,height:Bk};const s=e.subAgents.map((f,h)=>BF(f,[...t,h],n,i)),o=s.length?Math.max(...s.map(f=>f.width)):0,l=s.length?Math.max(...s.map(f=>f.height)):0,c=s.length&&r!=="parallel"?bRe:Pv,u=n==="horizontal"?r!=="parallel":r==="parallel",d=s.length?r==="parallel"?cvt+IJ:r==="loop"?uvt:0:IJ;return u?{width:Math.max(w5,s.reduce((f,h)=>f+h.width,0)+$F*Math.max(0,s.length-1)+c*2),height:Bk+Pv+l+d+Pv}:{width:Math.max(w5,o+Pv*2),height:Bk+c+s.reduce((f,h)=>f+h.height,0)+$F*Math.max(0,s.length-1)+d+c}}function nO(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function hvt(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function PJ(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function iO(e,t,n,i){const r=(i==null?void 0:i.tone)==="sequential"?"hsl(213 40% 40%)":(i==null?void 0:i.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${i!=null&&i.loop?"-loop":""}`,source:e,target:t,sourceHandle:i!=null&&i.loop?"loop-source":void 0,targetHandle:i!=null&&i.loop?"loop-target":void 0,label:n,type:"insertStep",data:i?{insert:i.insert,loop:i.loop,tone:i.tone}:void 0,animated:i==null?void 0:i.loop,markerEnd:{type:JS.ArrowClosed,width:16,height:16,color:r},style:{stroke:r,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function DJ(e,t,n=!1,i){const r=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:i("buildCanvas.terminals.input")},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:i("buildCanvas.terminals.output")},selectable:!1,draggable:!1}],s=[];function o(f,h,m,g,b){const v=f.agentType??"llm",y=nO(h);return FF(f,h)?(l(f,h,m,g,b),y):(r.push({id:y,type:"agent",parentId:m,extent:"parent",position:g,data:{kind:"agent",path:h,agent:f,title:v==="a2a"?i("buildCanvas.patterns.a2a.label"):f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i("buildCanvas.unnamedStep")),pattern:v,description:f.description.trim()||i(KO[v].descriptionKey),childCount:f.subAgents.length,containedIn:b}}),y)}function l(f,h,m,g={x:0,y:0},b){const v=f.agentType??"sequential",y=nO(h),x=BF(f,h,t,n);r.push({id:y,type:"group",parentId:m,extent:m?"parent":void 0,position:g,style:{width:x.width,height:x.height},data:{kind:"agent",path:h,agent:f,title:f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i(KO[v].labelKey)),pattern:v,description:f.description.trim()||i(KO[v].descriptionKey),childCount:f.subAgents.length,containedIn:b,layoutWidth:x.width,layoutHeight:x.height,compactEmptyGroup:n&&f.subAgents.length===0}});const w=f.subAgents.map((E,R)=>BF(E,[...h,R],t,n)),O=w.length&&v!=="parallel"?bRe:Pv,S=t==="horizontal"?v!=="parallel":v==="parallel";let k=O;const C=f.subAgents.map((E,R)=>{const _=w[R],j=S?{x:k,y:Bk+Pv}:{x:(x.width-_.width)/2,y:Bk+k};return k+=(S?_.width:_.height)+$F,o(E,[...h,R],y,j,v)});if(v==="sequential"||v==="loop"){for(let E=0;E1&&s.push(iO(C[C.length-1],C[0],i("buildCanvas.edges.continueLoop"),{loop:!0,tone:"loop"}))}return y}const c=(f,h)=>{const m=f.agentType??"llm",g=nO(h);if(FF(f,h))return l(f,h),[g];if(r.push({id:g,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:h,agent:f,title:m==="a2a"?i("buildCanvas.patterns.a2a.label"):f.name.trim()||(h.length===0?i("buildCanvas.rootAgent"):i("buildCanvas.unnamedStep")),pattern:m,description:f.description.trim()||i(KO[m].descriptionKey),childCount:f.subAgents.length}}),f.subAgents.length===0)return[g];const b=[];return f.subAgents.forEach((v,y)=>{const x=[...h,y],w=nO(x);s.push(iO(g,w,i("buildCanvas.edges.call"),{insert:{parentPath:h,index:y}})),b.push(...c(v,x))}),b},u=nO([]),d=c(e,[]);return s.push(iO("terminal-input",u)),d.forEach(f=>s.push(iO(f,"terminal-output"))),pvt(r,s,t)}function pvt(e,t,n){const i=new jJ.graphlib.Graph().setDefaultEdgeLabel(()=>({}));i.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const r=new Set(e.filter(s=>!s.parentId).map(s=>s.id));return e.filter(s=>!s.parentId).forEach(s=>{const o=s.data.kind==="terminal";i.setNode(s.id,{width:o?NJ:s.data.layoutWidth??MF,height:o?RJ:s.data.layoutHeight??LF})}),t.filter(s=>r.has(s.source)&&r.has(s.target)).forEach(s=>i.setEdge(s.source,s.target)),jJ.layout(i),{nodes:e.map(s=>{if(s.parentId)return s;const o=i.node(s.id),l=s.data.kind==="terminal",c=l?NJ:s.data.layoutWidth??MF,u=l?RJ:s.data.layoutHeight??LF;return{...s,position:{x:o.x-c/2,y:o.y-u/2}}}),edges:t}}const jP=p.createContext(null),NP=p.createContext("horizontal");function mvt({id:e,sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:o,markerEnd:l,style:c,label:u,data:d}){const{t:f}=Ae("create"),h=p.useContext(jP),[m,g]=p.useState(!1),[b,v,y]=jN({sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:o,offset:d!=null&&d.loop?28:20});return a.jsxs(a.Fragment,{children:[a.jsx(RC,{id:e,path:b,markerEnd:l,style:c}),h&&(d==null?void 0:d.insert)&&a.jsx("path",{d:b,className:"abc-edge-hover-path",onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1)}),(u||h&&(d==null?void 0:d.insert))&&a.jsx(abt,{children:a.jsxs("div",{className:`abc-edge-tools${h&&(d!=null&&d.insert)?" can-insert":""}${m?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${v}px, ${y}px)`},onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),children:[u&&a.jsx("span",{className:"abc-edge-label",children:u}),h&&(d==null?void 0:d.insert)&&a.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":f("buildCanvas.actions.insertHere"),title:f("buildCanvas.actions.insertHere"),onClick:x=>{x.stopPropagation(),h==null||h.onInsert(d.insert.parentPath,d.insert.index)},children:a.jsx(Tl,{})})]})})]})}function gvt({data:e,selected:t}){const{t:n}=Ae("create"),i=p.useContext(jP),r=p.useContext(NP),s=r==="vertical"?pn.Top:pn.Left,o=r==="vertical"?pn.Bottom:pn.Right,l=r==="vertical"?pn.Right:pn.Bottom,c=e.pattern??"llm",u=KO[c],d=u.icon;return a.jsxs("div",{className:`abc-node is-${c}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[a.jsx(ic,{type:"target",position:s,className:"abc-handle"}),c!=="llm"&&a.jsx("span",{className:"abc-node-icon",children:a.jsx(d,{})}),a.jsxs("span",{className:"abc-node-copy",children:[a.jsx("span",{className:"abc-node-meta",children:a.jsx("span",{children:n(u.labelKey)})}),a.jsx("strong",{children:e.title}),a.jsx("small",{children:e.description})]}),i&&e.path!==void 0&&e.path.length>0&&a.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":n("buildCanvas.actions.deleteNamed",{name:e.title}),title:n("buildCanvas.actions.deleteNode"),onClick:f=>{f.stopPropagation(),i==null||i.onDelete(e.path)},children:a.jsx(rg,{})}),a.jsx(ic,{type:"source",position:o,className:"abc-handle"}),e.containedIn==="loop"&&a.jsxs(a.Fragment,{children:[a.jsx(ic,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),a.jsx(ic,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function bvt({data:e,selected:t}){const{t:n}=Ae("create"),i=p.useContext(jP),r=p.useContext(NP),s=r==="vertical"?pn.Top:pn.Left,o=r==="vertical"?pn.Bottom:pn.Right,l=r==="vertical"?pn.Right:pn.Bottom,c=e.pattern??"sequential",u=e.childCount??0,d=n(c==="llm"?"buildCanvas.actions.addSubagent":c==="parallel"?"buildCanvas.actions.addParallelStep":c==="loop"?"buildCanvas.actions.addLoopStep":"buildCanvas.actions.addNextStep");return a.jsxs("div",{className:`abc-group is-${c}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[a.jsx(ic,{type:"target",position:s,className:"abc-handle"}),a.jsx("header",{className:"abc-group-head",children:a.jsxs("span",{children:[a.jsx("strong",{title:e.title,children:e.title}),a.jsx("small",{children:e.description})]})}),i&&e.path!==void 0&&u>0&&c!=="parallel"&&a.jsxs("div",{className:"abc-group-boundary-actions",children:[a.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":n("buildCanvas.actions.addFirst"),title:n("buildCanvas.actions.addFirst"),onClick:f=>{f.stopPropagation(),i.onInsert(e.path,0)},children:a.jsx(Tl,{})}),a.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":n("buildCanvas.actions.addLast"),title:n("buildCanvas.actions.addLast"),onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:a.jsx(Tl,{})})]}),i&&e.path!==void 0&&u>0&&c==="parallel"&&a.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[a.jsx(Tl,{}),a.jsx("span",{children:d})]}),i&&e.path!==void 0&&u===0&&a.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:f=>{f.stopPropagation(),i.onAdd(e.path)},children:[a.jsx(Tl,{}),a.jsx("span",{children:d})]}),i&&e.path!==void 0&&e.path.length>0&&a.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":n("buildCanvas.actions.deleteNamed",{name:e.title}),title:n("buildCanvas.actions.deleteNode"),onClick:f=>{f.stopPropagation(),i==null||i.onDelete(e.path)},children:a.jsx(rg,{})}),a.jsx(ic,{type:"source",position:o,className:"abc-handle"}),e.containedIn==="loop"&&a.jsxs(a.Fragment,{children:[a.jsx(ic,{id:"loop-target",type:"target",position:l,className:"abc-handle abc-loop-handle"}),a.jsx(ic,{id:"loop-source",type:"source",position:l,className:"abc-handle abc-loop-handle"})]})]})}function yvt({data:e}){const t=p.useContext(NP);return a.jsxs("div",{className:"abc-terminal",children:[a.jsx(ic,{type:"target",position:t==="vertical"?pn.Top:pn.Left,className:"abc-handle"}),a.jsx("span",{children:e.title}),a.jsx(ic,{type:"source",position:t==="vertical"?pn.Bottom:pn.Right,className:"abc-handle"})]})}const vvt={agent:gvt,group:bvt,terminal:yvt},xvt={insertStep:mvt};function wvt({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:r,onDelete:s,readOnly:o=!1,interactivePreview:l=!1,direction:c="horizontal"}){const{t:u}=Ae("create"),d=p.useMemo(()=>DJ(e,c,o,u),[]),[f,h,m]=lbt(d.nodes),[g,b,v]=cbt(d.edges),y=dbt(),x=p.useRef(`${c}:${o?"readonly":"editable"}:${PJ(e)}`),w=p.useRef(null),{fitView:O}=CP(),S=p.useMemo(()=>DJ(e,c,o,u),[c,e,o,u]),[k,C]=p.useState(()=>window.matchMedia("(max-width: 860px)").matches),E=p.useMemo(()=>o?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,o]),R=p.useCallback((j=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const T=w.current;if(T&&(T.clientWidth===0||T.clientHeight===0)&&j<8){R(j+1);return}O(E)})})},[E,O]);p.useEffect(()=>{const j=window.matchMedia("(max-width: 860px)"),T=N=>C(N.matches);return j.addEventListener("change",T),()=>j.removeEventListener("change",T)},[]),p.useEffect(()=>{const j=`${c}:${o?"readonly":"editable"}:${PJ(e)}`,T=j!==x.current;x.current=j,b(S.edges),h(N=>{const A=new Map(N.map(P=>[P.id,P]));return S.nodes.map(P=>{const D=A.get(P.id);return{...P,measured:!T&&D&&D.type===P.type?D.measured:void 0,position:!T&&D?D.position:P.position,selected:P.data.kind==="agent"&&!!P.data.path&&hvt(P.data.path,t)}})}),T&&R()},[S,e,R,t,b,h]),p.useEffect(()=>{R()},[k,R]),p.useEffect(()=>{y&&R()},[S,R,y]),p.useEffect(()=>{if(!o||!w.current)return;const j=new ResizeObserver(()=>R());return j.observe(w.current),R(),()=>j.disconnect()},[R,o]);const _=p.useMemo(()=>o?null:{onAdd:i,onInsert:r,onDelete:s},[i,s,r,o]);return a.jsx(NP.Provider,{value:c,children:a.jsx(jP.Provider,{value:_,children:a.jsx("section",{className:`abc-root is-${c}${o?" is-readonly":""}`,"aria-label":u(o?"buildCanvas.readOnlyLabel":"buildCanvas.label"),children:a.jsx("div",{ref:w,className:"abc-canvas",children:a.jsxs(sbt,{nodes:f,edges:g,nodeTypes:vvt,edgeTypes:xvt,onNodesChange:m,onEdgesChange:v,onNodeClick:(j,T)=>{!o&&T.data.kind==="agent"&&T.data.path&&n(T.data.path)},nodesDraggable:!o,nodesConnectable:!1,nodesFocusable:!o,elementsSelectable:!o,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!o||l,zoomOnDoubleClick:l,zoomOnPinch:!o||l,zoomOnScroll:!o||l,fitView:!0,fitViewOptions:E,onInit:()=>R(),minZoom:o?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},ariaLabelConfig:{"controls.ariaLabel":u("buildCanvas.controls.ariaLabel"),"controls.zoomIn.ariaLabel":u("buildCanvas.controls.zoomIn"),"controls.zoomOut.ariaLabel":u("buildCanvas.controls.zoomOut"),"controls.fitView.ariaLabel":u("buildCanvas.controls.fitView")},children:[a.jsx(gbt,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!o||l)&&a.jsx(kbt,{showInteractive:!1}),dvt]})})})})})}function rE(e){return a.jsx(UNe,{children:a.jsx(wvt,{...e})})}mn.hasResourceBundle("en-US","create")||mn.addResourceBundle("en-US","create",fue,!0,!0);mn.hasResourceBundle("zh-CN","create")||mn.addResourceBundle("zh-CN","create",hbe,!0,!0);function Kt(e,t={}){return mn.t(e,{...t,ns:"create"})}function PC(e,t){return e.map(n=>({...n,get label(){return Kt(`${t}.${n.id}.label`)},get desc(){return Kt(`${t}.${n.id}.description`)}}))}function Pu(e,t){const n={...e};for(const[i,r]of Object.entries(t))Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get:()=>Kt(r)});return n}const yRe="https://ark.cn-beijing.volces.com/api/v3/";Pu({key:"MODEL_AGENT_NAME",required:!1,placeholder:"doubao-seed-1-6-250615"},{comment:"traditional.catalog.env.modelAgentName.comment"});const Q_=[Pu({key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615"},{comment:"traditional.catalog.env.embeddingModelName.comment"}),{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:yRe}],DN=[],MN={get label(){return Kt("traditional.catalog.links.console")},url:"https://console.volcengine.com/vikingdb/openviking"},Ovt={get label(){return Kt("traditional.catalog.links.documentation")},url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},vRe="https://api.vikingdb.cn-beijing.volces.com/openviking",kvt=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,Ovt=[{key:"DATABASE_VIKING_PROJECT",required:!1,placeholder:"default"},{key:"DATABASE_VIKING_REGION",required:!1},{key:"DATABASE_VIKING_COLLECTION_KIND",required:!1},{key:"DATABASE_VIKING_RESOURCE_ID",required:!1}],kvt=[Pu({key:"DATABASE_VIKINGMEM_PROJECT",required:!1,placeholder:"default",hidden:!0},{comment:"traditional.catalog.env.vikingMemoryProject.comment"}),Pu({key:"DATABASE_VIKING_REGION",required:!1,hidden:!0},{comment:"traditional.catalog.env.vikingMemoryRegion.comment"}),Pu({key:"DATABASE_VIKINGMEM_MEMORY_TYPE",required:!1,placeholder:"sys_event_v1,sys_profile_v1",hidden:!0},{comment:"traditional.catalog.env.vikingMemoryType.comment"})],GO=[Pu({key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx"},{comment:"traditional.catalog.env.feishuAppId.comment"}),Pu({key:"FEISHU_APP_SECRET",required:!0,secret:!0},{placeholder:"traditional.catalog.env.feishuAppSecret.placeholder",comment:"traditional.catalog.env.feishuAppSecret.comment"})],ax={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"};function RP(e){if(e==="byteplus"){const t="ap-southeast-1";return{topK:ax.topK,region:t,endpoint:`https://agentkit.${t}.byteplusapi.com/`}}return ax}const xRe=[Pu({key:"REGISTRY_SPACE_ID",required:!0},{placeholder:"traditional.catalog.env.registrySpaceId.placeholder",comment:"traditional.catalog.env.registrySpaceId.comment"}),Pu({key:"REGISTRY_TOP_K",required:!1,placeholder:ax.topK},{comment:"traditional.catalog.env.registryTopK.comment"}),Pu({key:"REGISTRY_REGION",required:!1,placeholder:ax.region},{comment:"traditional.catalog.env.registryRegion.comment"}),Pu({key:"REGISTRY_ENDPOINT",required:!1,placeholder:ax.endpoint},{comment:"traditional.catalog.env.registryEndpoint.comment"})],Xw=PC([{id:"web_search",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:DN},{id:"parallel_web_search",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:DN},{id:"link_reader",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",get comment(){return Kt("traditional.catalog.env.agentKitToolId.comment")}},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",get comment(){return Kt("traditional.catalog.env.agentKitToolRegion.comment")}}]},{id:"vesearch",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],"traditional.catalog"),Svt=new Set(["web_scraper","text_to_speech","vesearch"]),Evt=new Set(["web_search","parallel_web_search"]),Cvt=Xw.filter(e=>!Svt.has(e.id));function wRe(e="volcengine"){const t=e==="byteplus"?Evt:new Set;return Cvt.filter(n=>!t.has(n.id))}const lx=PC([{id:"local",env:[]},{id:"sqlite",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],"traditional.backends.shortTerm"),UF=PC([{id:"local",env:Q_,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Q_],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...Q_],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",env:kvt},{id:"openviking",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:vRe,get comment(){return Kt("traditional.catalog.env.openVikingUrl.comment")},link:MN},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:MN},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",get comment(){return Kt("traditional.catalog.env.openVikingMemoryUserId.comment")},get help(){return Kt("traditional.catalog.env.openVikingMemoryUserId.help")}},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:wvt,get comment(){return Kt("traditional.catalog.env.openVikingMemoryPolicy.comment")},multiline:!0,format:"json",get help(){return Kt("traditional.catalog.env.openVikingMemoryPolicy.help")},link:xvt}]},{id:"mem0",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],"traditional.backends.longTerm"),zm="viking",QF=PC([{id:"viking",env:Ovt},{id:"opensearch",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Q_],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",env:[...DN,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]},{id:"openviking",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:vRe,get comment(){return Kt("traditional.catalog.env.openVikingUrl.comment")},link:MN},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:MN},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",get comment(){return Kt("traditional.catalog.env.openVikingKnowledgeUserId.comment")},get help(){return Kt("traditional.catalog.env.openVikingKnowledgeUserId.help")}},{key:"DATABASE_OPENVIKING_TARGET_URI",required:!1,placeholder:"viking://user/default/resources//",get comment(){return Kt("traditional.catalog.env.openVikingTargetUri.comment")},get help(){return Kt("traditional.catalog.env.openVikingTargetUri.help")}}]}],"traditional.backends.knowledge"),Tvt=PC([{id:"apmplus",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",enableFlag:"ENABLE_TLS",env:[...DN,Pu({key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1},{comment:"traditional.catalog.env.tlsServiceName.comment"})]}],"traditional.exporters");function eu(e="volcengine"){return{name:"",description:Kt("defaults.description"),instruction:Kt("defaults.instruction"),dynamicAgentDelegation:!1,agentType:"llm",cloudProvider:e,maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:lp(e),modelFallbacks:[],modelSource:"ark",modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",longTermMemoryIndex:"",autoSaveSession:!1,knowledgebaseBackend:zm,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],cloudEnvironment:{environmentId:"",environmentVersionId:""},deployment:{feishuEnabled:!1,modelApiKeyId:"",modelApiKeyName:""}}}function rO(e){return{id:e,get displayName(){return Kt(`traditional.optimization.options.${e}.label`)},get description(){return Kt(`traditional.optimization.options.${e}.description`)}}}const fz=[rO("context_engine"),rO("compressor"),rO("verifier"),rO("long_run_control"),rO("mcp_resilience")],Avt=[{id:"quality",get displayName(){return Kt("traditional.optimization.groups.quality")},componentIds:["context_engine","verifier"]},{id:"cost",get displayName(){return Kt("traditional.optimization.groups.cost")},componentIds:["compressor"]},{id:"stability",get displayName(){return Kt("traditional.optimization.groups.stability")},componentIds:["long_run_control","mcp_resilience"]}],Yw=fz.map(e=>e.id);function _vt(e){return e==="byteplus"?Kt("traditional.optimization.bytePlusUnavailable"):null}const ORe=["context_engine","compressor","verifier","long_run_control"],jvt=new Set(["1","true","yes","on"]),hz=[{id:"default",get displayName(){return Kt("traditional.optimization.profiles.default.label")},get description(){return Kt("traditional.optimization.profiles.default.description")},defaultComponents:[],autoAddedComponents:[]},{id:"ops",get displayName(){return Kt("traditional.optimization.profiles.ops.label")},get description(){return Kt("traditional.optimization.profiles.ops.description")},defaultComponents:["context_engine","verifier","long_run_control","mcp_resilience"],autoAddedComponents:["sql_readonly"]}];function z_(e){var t;return((t=fz.find(n=>n.id===e))==null?void 0:t.displayName)??e}function Nvt(e){var t;return((t=hz.find(n=>n.id===e))==null?void 0:t.displayName)??e}function pz(e){const t=hz.find(n=>n.id===e);return t?[...t.defaultComponents]:[]}function Ib(e,t="default"){const n=new Set(e);return{enabled:n.size>0,profile:t,componentOverrides:Object.fromEntries(Yw.map(r=>[r,n.has(r)]))}}function mz(e){if(!e)return;const t=e.profile==="ops"?"ops":"default",n=t==="ops"?pz(t):Yw.filter(i=>{var r;return((r=e.componentOverrides)==null?void 0:r[i])===!0});return{...Ib(n,t),...e.catalogVersion?{catalogVersion:e.catalogVersion}:{},...e.planHash?{planHash:e.planHash}:{}}}function O5(e){return jvt.has((e==null?void 0:e.trim().toLowerCase())??"")}function Rvt(e){if(!e)return null;try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function Ivt(e){var o;const t=new Map((e==null?void 0:e.map(({key:l,value:c})=>[l,c]))??[]),n=t.get("HARNESS_SIDECAR_ENABLED");if(n===void 0)return null;const i=((o=t.get("HARNESS_PROFILE"))==null?void 0:o.trim())==="ops"?"ops":"default";if(!O5(n))return Ib([],i);const r=Rvt(t.get("HARNESS_SIDECAR_COMPONENT_OVERRIDES"));if(r){const l={...Ib(Yw.filter(c=>r[c]===!0),i),enabled:!0};return i==="ops"?mz(l)??l:l}if(i==="ops")return Ib(pz(i),i);const s=[...O5(t.get("HARNESS_MODEL_PROXY_ENABLED"))?ORe:[],...O5(t.get("HARNESS_MCP_GATEWAY_ENABLED"))?["mcp_resilience"]:[]];return{...Ib(s,i),enabled:!0}}function Pvt(e,t){return{...e,modelName:t.modelName||e.modelName,description:t.description,instruction:t.instruction}}function Dvt(e){var t;return((t=e.harnessSidecar)==null?void 0:t.profile)??"default"}function LN(e){var n;const t=(n=e.harnessSidecar)==null?void 0:n.componentOverrides;return t?Yw.filter(i=>t[i]):[]}function Mvt(e){const t=new Set(LN(e));return ORe.filter(n=>t.has(n))}function Lvt(e,t){const n=i=>({...i,mcpTools:(i.mcpTools??[]).map(r=>{var o,l;const s=!!(r.authTokenEnv&&(t.has(r.authTokenEnv)||r.authToken));return{...r,credentialConfigured:s,...s?{credentialSourceUrl:((o=r.url)==null?void 0:o.trim())??"",credentialSourceAuthTokenEnv:((l=r.authTokenEnv)==null?void 0:l.trim())??""}:{}}}),subAgents:i.subAgents.map(n),...i.workflow?{workflow:{...i.workflow,nodes:i.workflow.nodes.map(r=>({...r,agent:n(r.agent)}))}}:{}});return n(e)}function Wy(e){const t=(e==null?void 0:e.trim())??"",n=t.indexOf("/");return n<=0||n===t.length-1?{modelName:t,modelProvider:""}:{modelName:t.slice(n+1),modelProvider:t.slice(0,n)}}function gz(e){return Wy(e).modelName}function kRe(e,t,n,i=!1){var c,u,d,f;const r=Wy((t==null?void 0:t.model)||(n==null?void 0:n.model)),s=(t==null?void 0:t.children)??[],o=t==null?void 0:t.type,l=e.agentType==="a2a"&&((c=e.a2aRegistry)!=null&&c.enabled)&&o==="llm"?"a2a":o??e.agentType;return{...e,name:((u=t==null?void 0:t.name)==null?void 0:u.trim())||((d=n==null?void 0:n.name)==null?void 0:d.trim())||e.name,description:(t==null?void 0:t.description)??e.description,instruction:i?e.instruction:(t==null?void 0:t.instruction)??e.instruction,agentType:l,modelName:r.modelName||e.modelName,modelProvider:r.modelProvider||e.modelProvider,skills:((f=t==null?void 0:t.skills)==null?void 0:f.map(h=>h.name))??e.skills,subAgents:e.subAgents.map((h,m)=>kRe(h,s[m],void 0,i))}}function $vt(e,t){const n=new Map(t.map(({key:o,value:l})=>[o,l]));if(!["REGISTRY_SPACE_ID","REGISTRY_TOP_K","REGISTRY_REGION","REGISTRY_ENDPOINT"].some(o=>n.has(o)))return e;const r=(o,l)=>n.has(o)?n.get(o)??"":l??"",s=o=>{var l;return{...o,...(l=o.a2aRegistry)!=null&&l.enabled?{a2aRegistry:{...o.a2aRegistry,registrySpaceId:r("REGISTRY_SPACE_ID",o.a2aRegistry.registrySpaceId),registryTopK:r("REGISTRY_TOP_K",o.a2aRegistry.registryTopK),registryRegion:r("REGISTRY_REGION",o.a2aRegistry.registryRegion),registryEndpoint:r("REGISTRY_ENDPOINT",o.a2aRegistry.registryEndpoint)}}:{},subAgents:o.subAgents.map(s)}};return s(e)}function zF(e,t){var c,u,d;const n=e.cloudProvider??t,i=eu(n),r=e.deployment,s=r==null?void 0:r.network,o=e.cloudEnvironment,l=e.a2aRegistry;return{...i,...e,name:e.name??i.name,description:e.description??i.description,instruction:e.instruction??i.instruction,agentType:e.agentType??i.agentType,cloudProvider:n,maxIterations:e.maxIterations??i.maxIterations,a2aUrl:e.a2aUrl??i.a2aUrl,model:e.model??void 0,modelSource:e.modelSource==="ark"||e.modelSource==="custom"?e.modelSource:void 0,modelName:e.modelName??i.modelName,modelProvider:e.modelProvider??i.modelProvider,modelApiBase:e.modelApiBase??i.modelApiBase,memory:{shortTerm:((c=e.memory)==null?void 0:c.shortTerm)??i.memory.shortTerm,longTerm:((u=e.memory)==null?void 0:u.longTerm)??i.memory.longTerm},tools:[...e.tools??[]],skills:[...e.skills??[]],knowledgebase:e.knowledgebase??i.knowledgebase,tracing:e.tracing??i.tracing,harnessSidecar:mz(e.harnessSidecar),subAgents:(e.subAgents??[]).map(f=>zF(f,n)),builtinTools:[...e.builtinTools??[]],customTools:[...e.customTools??[]],mcpTools:[...e.mcpTools??[]],a2aRegistry:{...i.a2aRegistry,...l??{},enabled:(l==null?void 0:l.enabled)??!1,registrySpaceId:(l==null?void 0:l.registrySpaceId)??"",registryTopK:(l==null?void 0:l.registryTopK)??"",registryRegion:(l==null?void 0:l.registryRegion)??"",registryEndpoint:(l==null?void 0:l.registryEndpoint)??""},shortTermBackend:e.shortTermBackend??i.shortTermBackend,longTermBackend:e.longTermBackend??i.longTermBackend,longTermMemoryIndex:e.longTermMemoryIndex??i.longTermMemoryIndex,autoSaveSession:e.autoSaveSession??i.autoSaveSession,knowledgebaseBackend:e.knowledgebaseBackend??i.knowledgebaseBackend,knowledgebaseIndex:e.knowledgebaseIndex??i.knowledgebaseIndex,tracingExporters:[...e.tracingExporters??[]],selectedSkills:[...e.selectedSkills??[]],cloudEnvironment:{...i.cloudEnvironment,...o??{},cliTools:[...(o==null?void 0:o.cliTools)??[]],dockerfile:typeof(o==null?void 0:o.dockerfile)=="string"?o.dockerfile:void 0},deployment:{...i.deployment,...r??{},feishuEnabled:(r==null?void 0:r.feishuEnabled)??!1,runtimeName:(r==null?void 0:r.runtimeName)??void 0,runtimeNameCustomized:(r==null?void 0:r.runtimeNameCustomized)??((d=i.deployment)==null?void 0:d.runtimeNameCustomized),network:s?{...s,vpcId:s.vpcId??"",subnetIds:s.subnetIds??"",enableSharedInternetAccess:s.enableSharedInternetAccess??!1}:void 0,modelApiKeyId:(r==null?void 0:r.modelApiKeyId)??"",modelApiKeyName:(r==null?void 0:r.modelApiKeyName)??"",envValues:(r==null?void 0:r.envValues)??void 0},...e.workflow?{workflow:{...e.workflow,nodes:e.workflow.nodes.map(f=>({...f,agent:zF(f.agent,n)}))}}:{}}}const Fvt=["动态子智能体协作规则:","Dynamic sub-agent collaboration rules:"],Bvt=["collect_resources","create_agents","handoff_to"];function Uvt(e){return e.replace(/\\([\\`*_[\]{}()<>#+\-.!|])/g,"$1")}function Qvt(e){const t=Fvt.flatMap(i=>{const r=[];let s=0;for(;si-r),n=t.find((i,r)=>{const s=t[r+1]??e.length,o=Uvt(e.slice(i,s));return Bvt.every(l=>o.includes(l))});return n===void 0?e:e.slice(0,n).trimEnd()}function zvt(e){const t=n=>({...n,instruction:n.dynamicAgentDelegation===!0?Qvt(n.instruction):n.instruction,subAgents:n.subAgents.map(t),...n.workflow?{workflow:{...n.workflow,nodes:n.workflow.nodes.map(i=>({...i,agent:t(i.agent)}))}}:{}});return t(e)}function SRe(e,t){var l,c;const n=eu(t),i=[...e.tools??[]],r=Xw.filter(u=>u.toolNames.some(d=>i.includes(d))),s=new Set(r.flatMap(u=>u.toolNames)),o=Wy(e.model);return{...n,modelSource:void 0,name:((l=e.name)==null?void 0:l.trim())??"",description:e.description??"",instruction:e.instruction||n.instruction,agentType:e.type??"llm",modelName:o.modelName,modelProvider:o.modelProvider,tools:i.filter(u=>!s.has(u)),builtinTools:r.map(u=>u.id),skills:((c=e.skills)==null?void 0:c.map(u=>u.name))??[],subAgents:(e.children??[]).map(u=>SRe(u,t))}}function bz(e,t,n=[]){var l,c,u,d;const i=((l=e.draft)==null?void 0:l.cloudProvider)??t,r=Wy(e.model),s=e.draft?zF(e.draft,i):e.graph?SRe(e.graph,i):{...eu(i),modelSource:void 0,name:((c=e.name)==null?void 0:c.trim())||e.appName.trim(),description:e.description??"",instruction:e.instruction||eu(i).instruction,agentType:e.type??"llm",modelName:r.modelName,modelProvider:r.modelProvider,tools:[...e.tools??[]],skills:((u=e.skills)==null?void 0:u.map(f=>f.name))??[]},o=e.draft&&s.dynamicAgentDelegation===!0?zvt(s):s;return Lvt(kRe(o,e.graph,{name:((d=e.name)==null?void 0:d.trim())||e.appName.trim(),model:e.model},!!e.draft),new Set(n))}function Vvt(e,t){const n=i=>{var s;const r=((s=i.modelName)==null?void 0:s.trim())??"";return{...i,modelSource:i.agentType==="llm"||!i.agentType?t.has(r)?"ark":"custom":i.modelSource,subAgents:i.subAgents.map(n),...i.workflow?{workflow:{...i.workflow,nodes:i.workflow.nodes.map(o=>({...o,agent:n(o.agent)}))}}:{}}};return n(e)}function MJ({className:e="icon"}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),a.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),a.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),a.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const Hvt={coding:"studioTools.labels.coding",get_city_weather:"studioTools.labels.get_city_weather",get_location_weather:"studioTools.labels.get_location_weather",web_fetch:"studioTools.labels.web_fetch"};function ERe(e,t){const n=Xw.find(r=>r.id===e||r.toolNames.includes(e)),i=Hvt[e];return i?t(i):(n==null?void 0:n.label)??e}function qvt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Wvt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),a.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Kvt({agentName:e,tools:t,selectedIds:n,loading:i,disabled:r,unavailableReason:s,onChange:o,onClose:l}){const{t:c}=Ae("workspaceTools"),[u,d]=p.useState(""),f=p.useMemo(()=>new Set(n),[n]),h=p.useRef(`studio-tool-${Math.random().toString(36).slice(2)}`),m=p.useMemo(()=>{const b=u.trim().toLowerCase();return b?t.filter(v=>`${v.name} ${v.id} ${v.description}`.toLowerCase().includes(b)):t},[u,t]);p.useEffect(()=>{const b=document.body.style.overflow;document.body.style.overflow="hidden";const v=y=>{y.key==="Escape"&&l()};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v),document.body.style.overflow=b}},[l]);const g=b=>{const v=new Set(f);v.has(b)?v.delete(b):v.add(b),o([...v])};return ri.createPortal(a.jsxs("div",{className:"studio-tool-dialog-layer",children:[a.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":c("studioTools.closeDialog"),onClick:l}),a.jsxs("section",{className:"studio-tool-dialog",role:"dialog","aria-modal":"true","aria-labelledby":h.current,children:[a.jsxs("header",{className:"studio-tool-dialog-head",children:[a.jsx("span",{className:"studio-tool-dialog-mark",children:a.jsx(MJ,{})}),a.jsxs("div",{children:[a.jsx("h2",{id:h.current,children:c("studioTools.title")}),a.jsx("p",{children:c("studioTools.description",{agentName:e})})]}),a.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":c("studioTools.close"),onClick:l,children:a.jsx(qvt,{})})]}),a.jsxs("div",{className:"studio-tool-dialog-body",children:[a.jsxs("label",{className:"studio-tool-search",children:[a.jsx(Wvt,{}),a.jsx("input",{value:u,"aria-label":c("studioTools.searchAria"),placeholder:c("studioTools.searchPlaceholder"),autoFocus:!0,onChange:b=>d(b.target.value)})]}),a.jsx("div",{className:"studio-tool-picker",role:"list","aria-label":c("studioTools.availableAria"),children:i?a.jsx("div",{className:"studio-tool-empty",children:c("studioTools.loading")}):s?a.jsx("div",{className:"studio-tool-empty",children:s}):m.length===0?a.jsx("div",{className:"studio-tool-empty",children:c("studioTools.noMatch")}):m.map(b=>{const v=f.has(b.id);return a.jsxs("article",{className:"studio-tool-option",role:"listitem",children:[a.jsx("span",{className:"studio-tool-option-icon",children:a.jsx(MJ,{})}),a.jsxs("span",{className:"studio-tool-option-copy",children:[a.jsx("strong",{children:b.name||ERe(b.id,c)}),a.jsx("code",{children:b.id}),a.jsx("span",{children:b.description})]}),a.jsx("button",{type:"button",disabled:r,"aria-pressed":v,onClick:()=>g(b.id),children:c(v?"studioTools.remove":"studioTools.add")})]},b.id)})})]})]})]}),document.body)}const $N=[{id:"ubuntu-22.04",label:"Ubuntu 22.04",image:"ubuntu:22.04"},{id:"ubuntu-24.04",label:"Ubuntu 24.04",image:"ubuntu:24.04"}],CRe=[{id:"aio-sandbox",label:"AIO Sandbox",description:"内置 Sandbox Shell 能力 · Ubuntu 22.04"},{id:"codex-sandbox",label:"Codex Sandbox",description:"内置 Codex CLI、浏览器与代码执行环境"},{id:"ubuntu",label:"Ubuntu",description:"标准 Linux 基础镜像"}],yz="agentkit-cli-2107625663-cn-beijing.cr.volces.com/agentkit/agent-native-requirements-aio:0.2.1-20260831",TRe={volcengine:"enterprise-public-cn-beijing.cr.volces.com/vefaas-public/codexenv:1.1.0",byteplus:"enterprise-public-ap-southeast-1.cr.volces.com/vefaas-public/codexenv:1.1.0"},ARe=[{id:"python-3.10",label:"Python 3.10"},{id:"python-3.12",label:"Python 3.12"}],Gvt={"python-3.10":"3.10.18","python-3.12":"3.12.11"},vz=[{id:"tools",label:"工具",description:"常用 CLI 与内容处理工具",options:[{id:"lark-cli",label:"lark-cli",description:"飞书开放平台命令行工具",installer:"pip",packageName:"lark-cli"},{id:"pandoc",label:"pandoc",description:"文档格式转换工具",installer:"apt",packageName:"pandoc"},{id:"opencli",label:"opencli",description:"将网站与桌面应用转换为命令行工具",installer:"npm",packageName:"@jackwener/opencli@1.8.7"}]},{id:"productivity",label:"效率",description:"加速依赖安装、检索和协作",options:[{id:"uv",label:"uv",description:"快速 Python 包与项目管理器",installer:"pip",packageName:"uv"},{id:"ripgrep",label:"ripgrep",description:"高性能文本检索工具",installer:"apt",packageName:"ripgrep"},{id:"jq",label:"jq",description:"JSON 查询与转换工具",installer:"apt",packageName:"jq"},{id:"github-cli",label:"GitHub CLI",description:"在终端中管理 GitHub 工作流",installer:"apt",packageName:"gh"}]},{id:"browser",label:"浏览器自动化",description:"网页操作、测试与内容采集",options:[{id:"playwright",label:"Playwright",description:"浏览器自动化与端到端测试",installer:"pip",packageName:"playwright"},{id:"chromium",label:"Chromium",description:"无头浏览器运行时",installer:"apt",packageName:"chromium"}]},{id:"system",label:"系统与媒体",description:"基础开发、网络和媒体处理能力",options:[{id:"git",label:"Git",description:"代码版本管理",installer:"apt",packageName:"git"},{id:"curl",label:"curl",description:"网络请求与文件下载",installer:"apt",packageName:"curl"},{id:"ffmpeg",label:"FFmpeg",description:"音视频转码与处理",installer:"apt",packageName:"ffmpeg"},{id:"imagemagick",label:"ImageMagick",description:"图片转换与批处理",installer:"apt",packageName:"imagemagick"}]}],Xvt=vz.flatMap(e=>e.options),Yvt=["build-essential","curl","libbz2-dev","libffi-dev","libgdbm-dev","liblzma-dev","libncursesw5-dev","libreadline-dev","libsqlite3-dev","libssl-dev","tk-dev","uuid-dev","zlib1g-dev"],Zvt=["xvfb","fonts-noto-color-emoji","fonts-unifont","libfontconfig1","libfreetype6","xfonts-cyrillic","xfonts-scalable","fonts-liberation","fonts-ipafont-gothic","fonts-wqy-zenhei","fonts-tlwg-loma-otf","fonts-freefont-ttf"],Jvt={"ubuntu-22.04":["libasound2","libatk-bridge2.0-0","libatk1.0-0","libatspi2.0-0","libcairo2","libcups2","libdbus-1-3","libdrm2","libgbm1","libglib2.0-0","libnspr4","libnss3","libpango-1.0-0","libwayland-client0","libx11-6","libxcb1","libxcomposite1","libxdamage1","libxext6","libxfixes3","libxkbcommon0","libxrandr2"],"ubuntu-24.04":["libasound2t64","libatk-bridge2.0-0t64","libatk1.0-0t64","libatspi2.0-0t64","libcairo2","libcups2t64","libdbus-1-3","libdrm2","libgbm1","libglib2.0-0t64","libnspr4","libnss3","libpango-1.0-0","libx11-6","libxcb1","libxcomposite1","libxdamage1","libxext6","libxfixes3","libxkbcommon0","libxrandr2"]};function sO(e,t){for(const n of t)e.includes(n)||e.push(n)}function ext(e,t,n,i,r){const s=["ca-certificates"];r||sO(s,i?[`python${n}`,`python${n}-venv`]:Yvt);for(const o of t)o.id==="playwright"||o.id==="chromium"||(o.installer==="apt"&&sO(s,[o.packageName]),o.id==="opencli"&&sO(s,["curl","xz-utils"]));return e.optionIds.some(o=>o==="playwright"||o==="chromium")&&(sO(s,Zvt),sO(s,Jvt[e.operatingSystem])),s}const k5={name:"",description:"",baseEnvironment:"aio-sandbox",operatingSystem:"ubuntu-22.04",language:"python-3.12",optionIds:[],selectedSkills:[]};function Xh(e){var t;return((t=ARe.find(n=>n.id===e))==null?void 0:t.label)??e}function VF(e){var t;return((t=$N.find(n=>n.id===e))==null?void 0:t.label)??e}function HF(e){var t;return((t=CRe.find(n=>n.id===e))==null?void 0:t.label)??e}function txt(e){var n;const t=((n=e.match(/^\s*FROM\s+(.+)$/im))==null?void 0:n[1])??"";return{baseEnvironment:/\/codexenv:/i.test(t)?"codex-sandbox":/aio\.sandbox/i.test(e)?"aio-sandbox":"ubuntu",operatingSystem:/ubuntu:24\.04/i.test(t)?"ubuntu-24.04":"ubuntu-22.04"}}function xz(e,t="volcengine"){const n=Xvt.filter(b=>e.optionIds.includes(b.id)),i=e.baseEnvironment==="aio-sandbox",r=e.baseEnvironment==="codex-sandbox",s=i||r,o=s?"python-3.12":e.language,l=o.replace("python-",""),c=Gvt[o],u=$N.find(b=>b.id===e.operatingSystem)??$N[0],d=e.operatingSystem==="ubuntu-22.04"&&l==="3.10"||e.operatingSystem==="ubuntu-24.04"&&l==="3.12",f=ext(e,n,l,d,s),h=i?[`ARG AIO_BASE_IMAGE=${yz}`,"ARG AIO_BASE_PLATFORM=linux/amd64","",`# Base environment: AIO Sandbox (${u.label})`,"FROM --platform=${AIO_BASE_PLATFORM} ${AIO_BASE_IMAGE}"]:r?[`ARG CODEX_BASE_IMAGE=${TRe[t]}`,"ARG CODEX_BASE_PLATFORM=linux/amd64","","# Base environment: Codex Sandbox","FROM --platform=${CODEX_BASE_PLATFORM} ${CODEX_BASE_IMAGE}"]:[`# Operating system: ${u.label}`,`FROM ${u.image}`];h.push("","ARG DEBIAN_FRONTEND=noninteractive","ARG APT_MIRROR_URL=http://archive.ubuntu.com/ubuntu","ARG PIP_INDEX_URL=https://pypi.org/simple","ARG PYTHON_SOURCE_BASE_URL=https://www.python.org/ftp/python","ARG PLAYWRIGHT_DOWNLOAD_HOST=https://cdn.playwright.dev","ARG PIP_DEFAULT_TIMEOUT=300","ARG PIP_RETRIES=10","","# Install all system dependencies in one transaction from the provider-local mirror.","RUN set -eux; \\",' mirror="${APT_MIRROR_URL%/}"; \\'," for source_file in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do \\",' [ -f "$source_file" ] || continue; \\',' sed -i -E "s#https?://(archive|security).ubuntu.com/ubuntu/?#${mirror}#g" "$source_file"; \\'," done; \\",` printf 'Acquire::Retries "5";\\nAcquire::ForceIPv4 "true";\\nAcquire::http::Timeout "60";\\nAcquire::https::Timeout "60";\\n' > /etc/apt/apt.conf.d/80-veadk-network; \\`," apt-get update; \\"," apt-get install -y --no-install-recommends \\",...f.map(b=>" "+b+" \\")," ; rm -rf /var/lib/apt/lists/*","","ENV PYTHONDONTWRITEBYTECODE=1 \\"," PYTHONUNBUFFERED=1 \\"," PIP_NO_CACHE_DIR=1","",`# Python ${l}`),i?h.push("# Keep Studio dependencies isolated from AIO's system interpreter.","RUN /opt/python3.12/bin/python -m venv /opt/veadk-environment/.venv","","ENV VIRTUAL_ENV=/opt/veadk-environment/.venv \\"," BASH_VENV_PATH=/opt/veadk-environment/.venv \\",' PATH="/opt/veadk-environment/.venv/bin:$PATH"'):r?h.push("# Keep Studio dependencies isolated from the Codex runtime.","RUN python3 -m venv /opt/veadk-environment/.venv","","ENV VIRTUAL_ENV=/opt/veadk-environment/.venv \\",' PATH="/opt/veadk-environment/.venv/bin:$PATH"'):d?h.push(`RUN python${l} -m venv /opt/venv`):h.push(`RUN curl --retry 5 --retry-all-errors --connect-timeout 30 -fsSL "\${PYTHON_SOURCE_BASE_URL}/${c}/Python-${c}.tgz" -o /tmp/python.tgz \\`," && mkdir -p /tmp/python-source \\"," && tar -xzf /tmp/python.tgz --strip-components=1 -C /tmp/python-source \\"," && cd /tmp/python-source \\"," && ./configure --prefix=/opt/python --with-ensurepip=install \\",' && make -j"$(nproc)" \\'," && make install \\",` && /opt/python/bin/python${l} -m venv /opt/venv \\`," && rm -rf /tmp/python-source /tmp/python.tgz"),s||h.push("",'ENV PATH="/opt/venv/bin:$PATH"');const m=new Set(e.optionIds);(m.has("playwright")||m.has("chromium"))&&h.push("","ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \\"," PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=300000"),h.push("","WORKDIR /workspace","","# VeADK","RUN python -m pip install --upgrade veadk-python");let g=!1;for(const b of n)h.push("",`# ${b.label}`),b.id==="opencli"?h.push('RUN node_arch="$(dpkg --print-architecture)" \\',' && case "$node_arch" in amd64) node_arch=x64 ;; arm64) node_arch=arm64 ;; *) echo "Unsupported architecture: $node_arch" >&2; exit 1 ;; esac \\',' && curl --retry 5 --connect-timeout 30 -fsSL "https://nodejs.org/dist/v22.18.0/node-v22.18.0-linux-${node_arch}.tar.xz" -o /tmp/node.tar.xz \\'," && tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \\",` && npm install --global ${b.packageName} \\`," && npm cache clean --force \\"," && rm -f /tmp/node.tar.xz"):b.id==="playwright"||b.id==="chromium"?g||(h.push("RUN python -m pip install --upgrade playwright"),h.push("RUN python -m playwright install chromium"),g=!0):b.installer!=="apt"&&h.push(`RUN python -m pip install --upgrade ${b.packageName}`);return i?h.push("","# Keep AIO's inherited /opt/gem/run.sh startup chain and shell API.","EXPOSE 8080"):r||h.push("",'CMD ["/bin/bash"]'),h.join(` -`)}function nxt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function ixt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),a.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function qF(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M5 7.25A2.25 2.25 0 0 1 7.25 5h9.5A2.25 2.25 0 0 1 19 7.25v9.5A2.25 2.25 0 0 1 16.75 19h-9.5A2.25 2.25 0 0 1 5 16.75v-9.5Z",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M8.5 9.25 11 12l-2.5 2.75M12.75 14.75h2.75",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})}function _Re(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M4.75 7.25A2.25 2.25 0 0 1 7 5h3l1.5 2h5.5a2.25 2.25 0 0 1 2.25 2.25v7.5A2.25 2.25 0 0 1 17 19H7a2.25 2.25 0 0 1-2.25-2.25v-9.5Z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),a.jsx("path",{d:"M8 11.25h8M8 14.75h5.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function rxt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M12 6.5v11M6.5 12h11",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function LJ(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function $J(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.25 2.75 2.75 6.25-6.25",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wl(e){return`${e.environment_id}\0${e.environment_version_id}`}function Uk(e){return e.latestVersion?{environment_id:e.id,environment_version_id:e.latestVersion.versionId}:null}function V_(e,t){return e.environmentIds.flatMap(n=>{const i=t.get(n),r=i?Uk(i):null;return r?[r]:[]})}function sxt({environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,error:s,onConfirm:o,onClose:l}){const{t:c}=Ae("workspaceTools"),[u,d]=p.useState(""),[f,h]=p.useState(!1),[m,g]=p.useState(""),b=p.useId(),v=p.useMemo(()=>new Map(e.map(T=>[T.id,T])),[e]),[y,x]=p.useState(()=>new Set(i)),[w,O]=p.useState(()=>{const T=new Set(t.filter(N=>i.includes(N.id)).flatMap(N=>N.environmentIds));return new Set(n.filter(N=>!T.has(N.environment_id)).map(Wl))}),S=p.useMemo(()=>new Set(t.filter(T=>y.has(T.id)).flatMap(T=>T.environmentIds)),[y,t]),k=p.useMemo(()=>{const T=new Set(w);for(const N of t)if(y.has(N.id))for(const A of V_(N,v))T.add(Wl(A));return T},[w,y,v,t]),C=p.useMemo(()=>{const T=u.trim().toLocaleLowerCase();return T?e.filter(N=>`${N.name} ${N.description} ${Xh(N.language)}`.toLocaleLowerCase().includes(T)):e},[e,u]),E=p.useMemo(()=>{const T=u.trim().toLocaleLowerCase();return T?t.filter(N=>{const A=N.environmentIds.map(P=>{var D;return((D=v.get(P))==null?void 0:D.name)??""}).join(" ");return`${N.name} ${N.description} ${A}`.toLocaleLowerCase().includes(T)}):t},[v,u,t]);p.useEffect(()=>{const T=document.body.style.overflow,N=A=>{A.key==="Escape"&&!f&&l()};return document.body.style.overflow="hidden",document.addEventListener("keydown",N),()=>{document.body.style.overflow=T,document.removeEventListener("keydown",N)}},[l,f]);const R=T=>{const N=Uk(T);if(!N)return;const A=Wl(N);S.has(T.id)||O(P=>{const D=new Set(P);return D.has(A)?D.delete(A):D.add(A),D})},_=T=>{const N=V_(T,v);N.length!==0&&(x(A=>{const P=new Set(A);return P.has(T.id)?P.delete(T.id):P.add(T.id),P}),O(A=>{const P=new Set(A);for(const D of N)P.delete(Wl(D));return P}))},j=async()=>{const T=new Map(n.map(A=>[Wl(A),A])),N=e.flatMap(A=>{const P=Uk(A);if(!P||!k.has(Wl(P)))return[];const D=T.get(Wl(P));return[{...P,mount_instance_id:(D==null?void 0:D.mount_instance_id)||crypto.randomUUID()}]});h(!0),g("");try{await o(N,[...y]),l()}catch(A){g(A instanceof Error?A.message:c("sessionEnvironment.mountFailed"))}finally{h(!1)}};return ri.createPortal(a.jsxs("div",{className:"studio-tool-dialog-layer",children:[a.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":c("sessionEnvironment.closeDialog"),disabled:f,onClick:l}),a.jsxs("section",{className:"studio-tool-dialog session-environment-dialog",role:"dialog","aria-modal":"true","aria-labelledby":b,children:[a.jsxs("header",{className:"studio-tool-dialog-head",children:[a.jsx("span",{className:"studio-tool-dialog-mark",children:a.jsx(qF,{})}),a.jsxs("div",{children:[a.jsx("h2",{id:b,children:c("sessionEnvironment.addTitle")}),a.jsx("p",{children:c("sessionEnvironment.description")})]}),a.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":c("sessionEnvironment.closeAdd"),disabled:f,onClick:l,children:a.jsx(nxt,{})})]}),a.jsxs("div",{className:"studio-tool-dialog-body",children:[a.jsxs("label",{className:"studio-tool-search",children:[a.jsx(ixt,{}),a.jsx("input",{value:u,"aria-label":c("sessionEnvironment.searchAria"),placeholder:c("sessionEnvironment.searchPlaceholder"),autoFocus:!0,onChange:T=>d(T.target.value)})]}),a.jsx("div",{className:"studio-tool-picker session-environment-picker",role:"group","aria-label":c("sessionEnvironment.availableAria"),children:r?a.jsx("div",{className:"studio-tool-empty",children:c("sessionEnvironment.loading")}):s?a.jsx("div",{className:"studio-tool-empty",children:s}):C.length===0&&E.length===0?a.jsx("div",{className:"studio-tool-empty",children:c("sessionEnvironment.noMatch")}):a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${b}-workspaces`,children:[a.jsx("h3",{id:`${b}-workspaces`,children:c("sessionEnvironment.workspaces")}),E.map(T=>{const N=V_(T,v),A=y.has(T.id),P=N.length===0;return a.jsxs("label",{className:`studio-tool-option session-environment-option is-workspace${A?" is-selected":""}${P?" is-disabled":""}`,children:[a.jsx("span",{className:"studio-tool-option-icon",children:a.jsx(_Re,{})}),a.jsxs("span",{className:"studio-tool-option-copy",children:[a.jsx("strong",{children:T.name}),a.jsx("span",{children:T.description||c("sessionEnvironment.reuseAll")}),a.jsx("small",{children:c("sessionEnvironment.availableEnvironmentCount",{count:N.length})})]}),a.jsx("input",{type:"checkbox",checked:A,disabled:P,"aria-label":c("sessionEnvironment.selectWorkspace",{name:T.name}),onChange:()=>_(T)}),a.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:a.jsx($J,{})})]},T.id)})]}),C.length>0&&a.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${b}-environments`,children:[a.jsx("h3",{id:`${b}-environments`,children:c("sessionEnvironment.environments")}),C.map(T=>{const N=Uk(T);if(!N)return null;const A=t.filter(M=>y.has(M.id)&&M.environmentIds.includes(T.id)),P=A.length>0,D=k.has(Wl(N));return a.jsxs("label",{className:`studio-tool-option session-environment-option${D?" is-selected":""}${P?" is-covered":""}`,children:[a.jsx("span",{className:"studio-tool-option-icon",children:a.jsx(qF,{})}),a.jsxs("span",{className:"studio-tool-option-copy",children:[a.jsx("strong",{children:T.name}),a.jsx("span",{children:P?c("sessionEnvironment.includedByWorkspaces",{names:A.map(M=>M.name).join(c("sessionEnvironment.nameSeparator"))}):T.description||Xh(T.language)}),a.jsxs("small",{children:[Xh(T.language)," · ",N.environment_version_id]})]}),a.jsx("input",{type:"checkbox",checked:D,disabled:P,"aria-label":c("sessionEnvironment.selectEnvironment",{name:T.name}),onChange:()=>R(T)}),a.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:a.jsx($J,{})})]},Wl(N))})]})]})})]}),a.jsxs("footer",{className:"session-environment-dialog__footer",children:[a.jsx("span",{className:m?"is-error":"",role:m?"alert":void 0,children:m||c("sessionEnvironment.selectionSummary",{workspaces:c("sessionEnvironment.selectedWorkspaceCount",{count:y.size}),environments:c("sessionEnvironment.coveredEnvironmentCount",{count:k.size})})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",disabled:f,onClick:l,children:c("sessionEnvironment.cancel")}),a.jsx("button",{type:"button",className:"is-primary",disabled:r||f||!!s,onClick:()=>void j(),children:c(f?"sessionEnvironment.mounting":"sessionEnvironment.confirm")})]})]})]})]}),document.body)}function oxt({environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,disabled:s=!1,error:o="",onChange:l,onRefresh:c}){const{t:u}=Ae("workspaceTools"),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,b]=p.useState(""),v=p.useRef(null),y=p.useMemo(()=>new Map(e.flatMap(E=>{const R=Uk(E);return R?[[Wl(R),E]]:[]})),[e]),x=p.useMemo(()=>new Map(e.map(E=>[E.id,E])),[e]),w=t.filter(E=>i.includes(E.id)),O=new Set(w.flatMap(E=>E.environmentIds)),S=n.filter(E=>!O.has(E.environment_id)),k=()=>{f(!1),requestAnimationFrame(()=>{var E;return(E=v.current)==null?void 0:E.focus()})},C=async(E,R)=>{if(l){m(!0),b("");try{await l(E,R)}catch(_){b(_ instanceof Error?_.message:u("sessionEnvironment.mountFailed"))}finally{m(!1)}}};return a.jsxs("div",{className:"session-environment-select",children:[n.length>0&&a.jsxs("div",{className:"session-environment-list",role:"list","aria-label":u("sessionEnvironment.mountedAria"),children:[w.map(E=>{const R=new Set(V_(E,x).map(_=>_.environment_id));return a.jsxs("div",{className:"session-environment-item is-workspace",role:"listitem",children:[a.jsx("span",{className:"session-environment-item__icon",children:a.jsx(_Re,{})}),a.jsxs("span",{className:"session-environment-item__copy",children:[a.jsx("strong",{children:E.name}),a.jsx("small",{children:u("sessionEnvironment.environmentCount",{count:R.size})})]}),l&&a.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":u("sessionEnvironment.removeWorkspace",{name:E.name}),title:u("sessionEnvironment.remove"),disabled:s||h,onClick:()=>{const _=i.filter(T=>T!==E.id),j=new Set(t.filter(T=>_.includes(T.id)).flatMap(T=>T.environmentIds));C(n.filter(T=>!R.has(T.environment_id)||j.has(T.environment_id)),_)},children:a.jsx(LJ,{})})]},`workspace:${E.id}`)}),S.map(E=>{const R=y.get(Wl(E));return a.jsxs("div",{className:"session-environment-item",role:"listitem",children:[a.jsx("span",{className:"session-environment-item__icon",children:a.jsx(qF,{})}),a.jsxs("span",{className:"session-environment-item__copy",children:[a.jsx("strong",{children:(R==null?void 0:R.name)??E.environment_id}),a.jsx("small",{children:R?Xh(R.language):E.environment_version_id})]}),l&&a.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":u("sessionEnvironment.removeEnvironment",{name:(R==null?void 0:R.name)??E.environment_id}),title:u("sessionEnvironment.remove"),disabled:s||h,onClick:()=>void C(n.filter(_=>Wl(_)!==Wl(E)),[...i]),children:a.jsx(LJ,{})})]},Wl(E))})]}),l&&a.jsxs("button",{ref:v,type:"button",className:"topo-capability-add-slot","aria-label":u("sessionEnvironment.add"),disabled:s||r||h,onClick:()=>{b(""),f(!0),c==null||c()},children:[a.jsx(rxt,{}),a.jsx("span",{children:n.length>0?u("sessionEnvironment.addMore"):u("sessionEnvironment.addForSession")})]}),g&&a.jsx("p",{className:"is-error",role:"alert",children:g}),(r||o||e.length===0)&&a.jsx("p",{className:o?"is-error":void 0,role:o?"alert":void 0,children:r?u("sessionEnvironment.loadingAvailable"):o||u("sessionEnvironment.empty")}),d&&a.jsx(sxt,{environments:e,workspaces:t,value:n,selectedWorkspaceIds:i,loading:r,error:o,onConfirm:(E,R)=>l==null?void 0:l(E,R),onClose:k})]})}function jRe(e){return 1+e.children.reduce((t,n)=>t+jRe(n),0)}function NRe(e){return e.id||e.name}function axt(e,t,n){const i=NRe(e);if(e.id&&e.name&&e.name!==i)return e.name;if(t&&i==="agent")return n("agentTopology.mainAgent");const r=/^agent_sub_(\d+)$/.exec(i);return r?n("agentTopology.subAgent",{index:r[1]}):e.name||i}function RRe(e,t,n=!0){return{...e,id:NRe(e),name:axt(e,n,t),children:e.children.map(i=>RRe(i,t,!1))}}function IRe(e){const t=eu(),n=Wy(e.model);return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:n.modelName,modelProvider:n.modelProvider,tools:e.tools??[],skills:(e.skills??[]).map(i=>i.name),subAgents:e.children.map(IRe)}}function lxt(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}const cxt=new Set(["StudioExternalToolset"]);function uxt(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function UA({title:e,count:t}){const{t:n}=Ae("workspaceTools");return a.jsxs("div",{className:"topo-module-title",children:[a.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&a.jsx("span",{className:"topo-section-count","aria-label":n("agentTopology.itemCount",{count:t}),children:t})]})}function dxt({appName:e,info:t,loading:n,variant:i="rail",studioTools:r=[],selectedStudioToolIds:s=[],managedStudioToolIds:o=[],studioToolsLoading:l=!1,studioToolsDisabled:c=!1,studioToolsUnavailableReason:u="",onStudioToolsChange:d,environments:f=[],workspaces:h=[],selectedEnvironments:m=[],selectedEnvironmentWorkspaceIds:g=[],environmentsLoading:b=!1,environmentsDisabled:v=!1,environmentsError:y="",onEnvironmentsChange:x,onEnvironmentsRefresh:w}){const{t:O}=Ae("workspaceTools"),[S,k]=p.useState(null),[C,E]=p.useState(!1),R=p.useRef(null),_=()=>{E(!1),window.requestAnimationFrame(()=>{var F;return(F=R.current)==null?void 0:F.focus()})};if(p.useEffect(()=>{if(!C)return;const F=document.body.style.overflow,W=V=>{V.key==="Escape"&&_()};return document.body.style.overflow="hidden",document.addEventListener("keydown",W),()=>{document.body.style.overflow=F,document.removeEventListener("keydown",W)}},[C]),n&&!t)return a.jsx("aside",{className:`topo is-loading${i==="drawer"?" is-drawer":""}`,"aria-label":O("agentTopology.info"),"aria-live":"polite",children:a.jsx(yn,{as:"span",className:"topo-loading-label",duration:2.2,children:O("agentTopology.loadingInfo")})});if(!t)return null;const j=gz(t.model),T=RRe(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:j,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]},O),N=lxt(t.tools).filter(F=>!cxt.has(F)).map(F=>({id:`base:tool:${F}`,name:F,label:ERe(F,O),custom:!1,removable:!1})),A=new Set(N.map(F=>F.name)),P=new Set(s),D=new Set(o),M=r.filter(F=>P.has(F.id)&&!A.has(F.id)).map(F=>({id:`studio:tool:${F.id}`,name:F.id,label:F.name,custom:!0,removable:!D.has(F.id)})),L=[...N,...M],U=uxt(t.skills),I=!!d,H=IRe(T),K=F=>a.jsx(rE,{draft:H,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},F);return a.jsxs(a.Fragment,{children:[a.jsxs("aside",{className:`topo${i==="drawer"?" is-drawer":""}`,"aria-label":O("agentTopology.infoAndTopology"),children:[a.jsxs("section",{className:"topo-agent-card","aria-label":O("agentTopology.info"),children:[a.jsxs("div",{className:"topo-agent-heading",children:[a.jsx("h2",{title:t.name,children:t.name||O("agentTopology.unnamedAgent")}),j&&a.jsx("span",{title:j,children:j})]}),t.description&&a.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),a.jsxs("div",{className:"topo-module-stack",children:[a.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":O("agentTopology.tools"),children:[a.jsx(UA,{title:O("agentTopology.tools"),count:L.length}),a.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":O("agentTopology.toolList"),tabIndex:0,children:L.length>0?a.jsx("div",{className:"topo-tool-list",children:L.map(F=>a.jsxs("div",{className:"topo-tool",title:F.name,children:[a.jsxs("span",{className:"topo-capability-title",children:[a.jsxs("span",{className:"topo-capability-copy",children:[a.jsx("span",{className:"topo-capability-name",children:F.label}),a.jsx("code",{children:F.name})]}),F.custom&&a.jsx("span",{className:"topo-custom-badge",children:O("agentTopology.studioTool")})]}),F.custom&&F.removable&&a.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":O("agentTopology.removeTool",{name:F.name}),title:O("agentTopology.remove"),disabled:c,onClick:()=>d==null?void 0:d(s.filter(W=>W!==F.name)),children:"×"})]},F.id))}):a.jsx("div",{className:"topo-empty",children:O("agentTopology.notConfigured")})}),I&&a.jsx("div",{className:"topo-capability-add-dock",children:a.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":O("agentTopology.addStudioTool"),disabled:c,onClick:()=>k("tool"),children:[a.jsx("span",{"aria-hidden":"true",children:"+"}),a.jsx("span",{children:O("agentTopology.addStudioToolHere")})]})})]}),a.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":O("agentTopology.skills"),children:[a.jsx(UA,{title:O("agentTopology.skills"),count:t.skillsPreviewSupported?U.length:void 0}),a.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":O("agentTopology.skillList"),tabIndex:0,children:t.skillsPreviewSupported?U.length>0?a.jsx("div",{className:"topo-skill-list",children:U.map(F=>a.jsxs("div",{className:"topo-skill",title:F.description||F.name,children:[a.jsx("div",{className:"topo-skill-title",children:a.jsx("span",{className:"topo-skill-name",children:F.name})}),F.description&&a.jsx("span",{className:"topo-skill-description",children:F.description})]},`${F.name}:${F.description}`))}):a.jsx("div",{className:"topo-empty",children:O("agentTopology.notConfigured")}):a.jsx("div",{className:"topo-empty",children:O("agentTopology.previewUnsupported")})})]}),(x||m.length>0)&&a.jsxs("section",{className:"topo-module-card topo-environment-card","aria-label":O("agentTopology.sessionEnvironment"),children:[a.jsx(UA,{title:O("agentTopology.environment"),count:m.length}),a.jsx(oxt,{environments:f,workspaces:h,value:m,selectedWorkspaceIds:g,loading:b,disabled:v,error:y,onChange:x,onRefresh:w})]}),a.jsxs("section",{className:"topo-module-card topo-topology","aria-label":O("agentTopology.agentCanvas"),children:[a.jsxs("div",{className:"topo-canvas-heading",children:[a.jsx(UA,{title:O("agentTopology.topology"),count:jRe(T)}),a.jsx("button",{ref:R,type:"button",className:"topo-canvas-expand","aria-label":O("agentTopology.viewCanvasFullscreen"),title:O("agentTopology.viewFullscreen"),onClick:()=>E(!0),children:a.jsx(nx,{"aria-hidden":"true"})})]}),a.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":O("agentTopology.executionCanvas"),children:K(`conversation-canvas:${e}`)})]})]}),S==="tool"&&d&&a.jsx(Kvt,{agentName:t.name,tools:r.filter(F=>!A.has(F.id)&&!D.has(F.id)),selectedIds:s,loading:l,disabled:c,unavailableReason:u,onChange:d,onClose:()=>k(null)})]}),C&&ri.createPortal(a.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":O("agentTopology.fullscreenExecutionCanvas"),children:[a.jsxs("header",{className:"topo-canvas-dialog-header",children:[a.jsxs("div",{children:[a.jsx("strong",{children:O("agentTopology.executionCanvas")}),a.jsx("span",{children:t.name})]}),a.jsx("button",{type:"button","aria-label":O("agentTopology.closeFullscreenCanvas"),title:O("agentTopology.close"),onClick:_,autoFocus:!0,children:a.jsx(xa,{"aria-hidden":"true"})})]}),a.jsx("div",{className:"topo-canvas-dialog-body",children:K(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}const DC={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function FJ(e){return a.jsxs("svg",{...DC,...e,children:[a.jsx("rect",{x:"3.75",y:"5.25",width:"16.5",height:"13.5",rx:"2"}),a.jsx("path",{d:"m10.25 9 4.8 3-4.8 3V9Z"})]})}function fxt(e){return a.jsxs("svg",{...DC,...e,children:[a.jsx("path",{d:"M12 3.75v10.5M8.4 10.8 12 14.4l3.6-3.6"}),a.jsx("path",{d:"M5 17.25v2h14v-2"})]})}function hxt(e){return a.jsxs("svg",{...DC,...e,children:[a.jsx("path",{d:"M8.75 8.75 6.9 10.6a3.4 3.4 0 0 0 4.8 4.8l1.85-1.85"}),a.jsx("path",{d:"m15.25 15.25 1.85-1.85a3.4 3.4 0 0 0-4.8-4.8l-1.85 1.85"}),a.jsx("path",{d:"m9.4 14.6 5.2-5.2"})]})}function FN(e){return a.jsxs("svg",{...DC,...e,children:[a.jsx("path",{d:"M5 19h3.2L18.6 8.6a1.7 1.7 0 0 0 0-2.4l-.8-.8a1.7 1.7 0 0 0-2.4 0L5 15.8V19Z"}),a.jsx("path",{d:"m13.9 6.9 3.2 3.2M5 15.8 8.2 19"})]})}function PRe(e){return a.jsx("svg",{...DC,...e,children:a.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}const pxt=180,BJ=500,S5=10,UJ=32;function mxt(e){return Array.from(new Set(e.split(/[,,]/).map(t=>t.trim()).filter(Boolean)))}function gxt({artifact:e,busy:t,error:n,onClose:i,onSave:r}){const{t:s}=Ae("workspaceTools"),[o,l]=p.useState(e.name),[c,u]=p.useState(e.description??""),[d,f]=p.useState((e.tags??[]).join(",")),[h,m]=p.useState(""),g=p.useId(),b=p.useId(),v=p.useRef(null),y=p.useRef(null),x=p.useRef(t),w=p.useRef(i);p.useEffect(()=>{x.current=t,w.current=i},[t,i]),p.useEffect(()=>{var R,_;const k=document.body.style.overflow,C=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(R=y.current)==null||R.focus(),(_=y.current)==null||_.select();const E=j=>{if(j.key==="Escape"&&!x.current){j.preventDefault(),w.current();return}if(j.key!=="Tab")return;const T=v.current;if(!T)return;const N=Array.from(T.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(D=>D.getClientRects().length>0);if(N.length===0){j.preventDefault();return}const A=N[0],P=N[N.length-1];j.shiftKey&&document.activeElement===A?(j.preventDefault(),P.focus()):!j.shiftKey&&document.activeElement===P&&(j.preventDefault(),A.focus())};return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E),document.body.style.overflow=k,C!=null&&C.isConnected&&C.focus()}},[]);const O=k=>{var R;k.preventDefault();const C=o.trim(),E=mxt(d);if(!C){m(s("artifactEdit.nameRequired")),(R=y.current)==null||R.focus();return}if(E.length>S5){m(s("artifactEdit.tooManyTags",{max:S5}));return}if(E.some(_=>_.length>UJ)){m(s("artifactEdit.tagTooLong",{max:UJ}));return}m(""),r({name:C,description:c.trim(),tags:E})},S=h||n;return ri.createPortal(a.jsx("div",{className:"artifact-edit-backdrop",onMouseDown:k=>{k.target===k.currentTarget&&!t&&i()},children:a.jsxs("section",{ref:v,className:"artifact-edit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":g,"aria-describedby":b,"aria-busy":t||void 0,children:[a.jsxs("header",{className:"artifact-edit-dialog__header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:g,children:s("artifactEdit.title")}),a.jsx("p",{id:b,children:s("artifactEdit.subtitle")})]}),a.jsx("button",{type:"button",onClick:i,disabled:t,"aria-label":s("artifactEdit.close"),children:a.jsx(PRe,{})})]}),a.jsxs("form",{onSubmit:O,children:[a.jsxs("div",{className:"artifact-edit-dialog__body",children:[a.jsxs("label",{className:"artifact-edit-field",children:[a.jsx("span",{children:s("artifactEdit.name")}),a.jsx("input",{ref:y,value:o,maxLength:pxt,disabled:t,"aria-invalid":!!S||void 0,onChange:k=>{l(k.target.value),m("")}})]}),a.jsxs("label",{className:"artifact-edit-field",children:[a.jsx("span",{children:s("artifactEdit.description")}),a.jsx("textarea",{value:c,maxLength:BJ,disabled:t,rows:4,placeholder:s("artifactEdit.descriptionPlaceholder"),onChange:k=>u(k.target.value)}),a.jsxs("small",{children:[c.length,"/",BJ]})]}),a.jsxs("label",{className:"artifact-edit-field",children:[a.jsx("span",{children:s("artifactEdit.tags")}),a.jsx("input",{value:d,disabled:t,placeholder:s("artifactEdit.tagsPlaceholder",{max:S5}),onChange:k=>{f(k.target.value),m("")}})]}),S?a.jsx("div",{className:"artifact-edit-error",role:"alert",children:S}):null]}),a.jsxs("footer",{className:"artifact-edit-dialog__actions",children:[a.jsx("button",{type:"button",onClick:i,disabled:t,children:s("artifactEdit.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:t,children:s(t?"artifactEdit.saving":"artifactEdit.save")})]})]})]})}),document.body)}function DRe({label:e,menuLabel:t,items:n,placement:i="bottom-end"}){return a.jsxs(Pr,{children:[a.jsx(Pr.Trigger,{children:a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"md",iconSize:"sm",uniform:!0,"aria-label":e,title:e,disabled:n.length===0,children:a.jsx(xnt,{"aria-hidden":"true"})})}),a.jsxs(Pr.Content,{side:i==="top-end"?"top":"bottom",align:"end",minWidth:148,children:[a.jsx("span",{className:"sr-only",children:t}),n.map(r=>a.jsx(Pr.Item,{disabled:r.disabled,onSelect:r.onSelect,children:a.jsx("span",{title:r.title,children:r.label})},r.label))]})]})}const bxt="_Alert_1tr02_1",yxt="_Content_1tr02_145",vxt="_Indicator_1tr02_156",xxt="_Message_1tr02_159",wxt="_Title_1tr02_162",Oxt="_Description_1tr02_168",kxt="_Actions_1tr02_173",Jg={Alert:bxt,Content:yxt,Indicator:vxt,Message:xxt,Title:wxt,Description:Oxt,Actions:kxt},Oy=({color:e="primary",variant:t="outline",title:n,description:i,actions:r,actionsPlacement:s,indicator:o,className:l,actionsClassName:c,ref:u,...d})=>{const f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState("end"),{width:b}=QAe({ref:f});return p.useEffect(()=>{var y;const v=((y=h.current)==null?void 0:y.clientWidth)??0;if(v&&b){const x=v>b/3?"bottom":"end";g(x)}},[b]),a.jsxs("div",{ref:EC([u,f]),className:Ti(Jg.Alert,l),"data-variant":t,"data-color":e,role:e==="danger"?"alert":void 0,"data-actions-placement":s??m,...d,children:[o===!1?null:a.jsx("div",{className:Jg.Indicator,children:o??a.jsx(Sxt,{color:e})}),a.jsxs("div",{className:Jg.Content,children:[a.jsxs("div",{className:Jg.Message,children:[n&&a.jsx("div",{className:Jg.Title,children:n}),i&&a.jsx("div",{className:Jg.Description,children:i})]}),r&&a.jsx("div",{className:Ti(Jg.Actions,c),ref:h,children:r})]})]})},Sxt=({color:e})=>{switch(e){case"warning":case"caution":case"danger":return a.jsx(wAe,{});case"success":return a.jsx(bAe,{});default:return a.jsx(yAe,{})}};function Gu({title:e,description:t,error:n,confirmLabel:i,cancelLabel:r,closeLabel:s,variant:o="warning",busy:l=!1,onCancel:c,onConfirm:u}){const{t:d}=Ae("shell"),f=r??d("confirm.cancel"),h=s??d("confirm.close"),m=p.useId(),g=p.useId(),b=p.useRef(null),v=p.useRef(l),y=p.useRef(c);return p.useEffect(()=>{v.current=l,y.current=c},[l,c]),p.useEffect(()=>{var S;const x=document.body.style.overflow,w=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(S=b.current)==null||S.focus();const O=k=>{k.key==="Escape"&&!v.current&&y.current()};return window.addEventListener("keydown",O),()=>{document.body.style.overflow=x,window.removeEventListener("keydown",O),w!=null&&w.isConnected&&w.focus()}},[]),ri.createPortal(a.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!l&&c()},children:a.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${o}`,role:"alertdialog","aria-modal":"true","aria-labelledby":m,"aria-describedby":g,"aria-busy":l||void 0,children:[a.jsxs("header",{className:"studio-confirm-head",children:[a.jsxs("div",{className:"studio-confirm-title-wrap",children:[a.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:a.jsx(wAe,{})}),a.jsx("h2",{id:m,children:e})]}),a.jsx(Dt,{type:"button",className:"studio-confirm-close",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:c,disabled:l,"aria-label":h,children:a.jsx(ZU,{})})]}),a.jsxs("div",{className:"studio-confirm-body",children:[a.jsx("p",{id:g,children:t}),n?a.jsx(Oy,{className:"studio-confirm-error",color:"danger",variant:"soft",description:n}):null]}),a.jsxs("footer",{className:"studio-confirm-actions",children:[a.jsx(Dt,{ref:b,type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:c,disabled:l,children:f}),a.jsx(Dt,{type:"button",className:"studio-confirm-primary",color:o==="danger"?"danger":"primary",size:"lg",pill:!1,loading:l,onClick:u,disabled:l,children:i})]})]})}),document.body)}const Ext="_Container_1a6nz_1",Cxt="_Input_1a6nz_229",QJ={Container:Ext,Input:Cxt},hs=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,type:o="text",variant:l="outline",size:c="md",gutterSize:u,className:d,autoComplete:f,disabled:h=!1,readOnly:m=!1,invalid:g=!1,allowAutofillExtensions:b=o==="password"||!!s||!!f&&f!=="off",onFocus:v,onBlur:y,onAnimationStart:x,onAutofill:w,autoSelect:O,startAdornment:S,endAdornment:k,pill:C,opticallyAlign:E,ref:R,..._}=e,j=P=>{const D=t.current;if(!P.target||!(P.target instanceof Element)||!D||D.contains(P.target)||P.target.closest("button, [type='button'], [role='button'], [role='menuitem']"))return;P.preventDefault(),document.activeElement!==D&&D.focus();const{left:M,top:L}=D.getBoundingClientRect(),{clientX:U,clientY:I}=P,H=I{var P;O&&((P=t.current)==null||P.select())},[O]);const A=P=>{x==null||x(P),P.animationName==="native-autofill-in"&&(w==null||w())};return a.jsxs("div",{className:Ti(QJ.Container,d),"data-variant":l,"data-size":c,"data-gutter-size":u,"data-focused":T,"data-disabled":h?"":void 0,"data-readonly":m?"":void 0,"data-invalid":g?"":void 0,"data-pill":C?"":void 0,"data-optically-align":E,"data-has-start-adornment":S?"":void 0,"data-has-end-adornment":k?"":void 0,onMouseDown:j,children:[S,a.jsx("input",{..._,ref:EC([R,t]),id:r||(b?void 0:i),className:QJ.Input,type:o,name:s,autoComplete:f,readOnly:m,disabled:h,onFocus:P=>{N(!0),v==null||v(P)},onBlur:P=>{N(!1),y==null||y(P)},onAnimationStart:A,"data-lpignore":b?void 0:!0,"data-1p-ignore":b?void 0:!0}),k]})},Txt="_SelectControl_1tyi7_1",Axt="_Clear_1tyi7_436",_xt="_DropdownIcon_1tyi7_437",jxt="_TriggerText_1tyi7_468",Nxt="_IndicatorWrapper_1tyi7_476",Rxt="_StartIcon_1tyi7_482",Ixt="_DropdownIconChevron_1tyi7_534",Pxt="_LoadingIndicator_1tyi7_537",Eh={SelectControl:Txt,Clear:Axt,DropdownIcon:_xt,TriggerText:jxt,IndicatorWrapper:Nxt,StartIcon:Rxt,DropdownIconChevron:Ixt,LoadingIndicator:Pxt},Dxt=({ref:e,onPointerDown:t,onKeyDown:n,onPointerEnter:i,onInteract:r,invalid:s,disabled:o,children:l,className:c,variant:u="outline",size:d="md",block:f,opticallyAlign:h,pill:m=!0,loading:g,onClearClick:b,selected:v=!1,StartIcon:y,dropdownIconType:x="dropdown",...w})=>{const O=p.useRef(null),k=!!b&&v&&!g&&!o,C=x&&x!=="none"&&!g,E=k||g||C,R=!g&&!o,_=T=>{var N;switch(T.key){case"ArrowDown":case"ArrowUp":case" ":T.stopPropagation(),T.preventDefault(),r?r():(N=O.current)==null||N.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse"}));break;case"Enter":break;default:n==null||n(T)}},j=T=>{var N;T.button!==2&&(T.stopPropagation(),r?(T.preventDefault(),r()):(t==null||t(T),(N=w.onClick)==null||N.call(w,T)))};return a.jsxs("span",{ref:EC([O,e]),className:Ti(Eh.SelectControl,c),role:"button",tabIndex:o?-1:0,onPointerEnter:T=>{sQ(T),i==null||i(T)},onPointerDown:R?j:void 0,onKeyDown:R?_:void 0,"data-variant":u,"data-block":f?"":void 0,"data-pill":m?"":void 0,"data-size":d,"data-optically-align":h,"aria-busy":g?"true":void 0,"data-selected":v,"data-loading":g?"":void 0,"data-invalid":s?"":void 0,"data-disabled":o?"":void 0,"aria-disabled":o,...w,onClick:void 0,children:[y&&a.jsx(y,{className:Eh.StartIcon}),a.jsx("span",{className:Eh.TriggerText,children:l}),E&&a.jsxs("div",{className:Eh.IndicatorWrapper,children:[k&&a.jsx(Dt,{"aria-label":"Clear current value",className:Eh.Clear,onPointerDown:T=>{T.stopPropagation()},onClick:T=>{T.stopPropagation(),T.preventDefault(),b()},color:"secondary",variant:C?"ghost":"solid",size:"3xs",uniform:!0,pill:m,"data-only-child":C?void 0:"",children:a.jsx(ZU,{})}),g&&a.jsx(yC,{className:Eh.LoadingIndicator}),C&&a.jsx(Mxt,{iconType:x})]})]})},Mxt=({iconType:e})=>e==="chevronDown"?a.jsx(mnt,{className:Ti(Eh.DropdownIcon,Eh.DropdownIconChevron)}):a.jsx(wnt,{className:Eh.DropdownIcon}),Lxt="_Menu_n4tw6_3",$xt="_MenuList_n4tw6_5",Fxt="_MenuInner_n4tw6_50",Bxt="_OptionsList_n4tw6_64",Uxt="_Option_n4tw6_64",Qxt="_PressableInner_n4tw6_111",zxt="_OptionInner_n4tw6_113",Vxt="_OptionCheck_n4tw6_118",Hxt="_OptionIndicatorSlot_n4tw6_123",qxt="_OptionGroupHeading_n4tw6_128",Wxt="_OptionHardLimitHeading_n4tw6_140",Kxt="_OptionsLimit_n4tw6_147",Gxt="_Action_n4tw6_152",Xxt="_ActionInner_n4tw6_218",Yxt="_ActionsContainer_n4tw6_224",Zxt="_Search_n4tw6_244",Jxt="_SearchEmpty_n4tw6_247",es={Menu:Lxt,MenuList:$xt,MenuInner:Fxt,OptionsList:Bxt,Option:Uxt,PressableInner:Qxt,OptionInner:zxt,OptionCheck:Vxt,OptionIndicatorSlot:Hxt,OptionGroupHeading:qxt,OptionHardLimitHeading:Wxt,OptionsLimit:Kxt,Action:Gxt,ActionInner:Xxt,ActionsContainer:Yxt,Search:Zxt,SearchEmpty:Jxt},MRe=p.createContext(null),Ng=()=>{const e=p.use(MRe);if(!e)throw new Error("Select components must be wrapped in ");return e},nwt=({label:e})=>a.jsx(a.Fragment,{children:e}),iwt=({label:e})=>a.jsx(a.Fragment,{children:e}),rwt=({values:e,selectedAll:t})=>{const n=t?"All selected":e.length===0?"Select...":e.length===1?e[0].label:`${e.length} selected`;return a.jsx(a.Fragment,{children:n})},Xs=e=>{const{id:t,required:n,value:i,name:r,multiple:s,variant:o="outline",size:l="md",dropdownIconType:c="dropdown",loading:u=!1,clearable:d=!1,disabled:f=!1,placeholder:h="Select...",loadingPlaceholder:m="Loading...",pill:g=!0,listWidth:b,options:v,actions:y=[],side:x="bottom",avoidCollisions:w=!0,onChange:O,optionClassName:S,OptionView:k=nwt,TriggerStartIcon:C,triggerClassName:E,opticallyAlign:R,TriggerView:_,searchPlaceholder:j="",searchPredicate:T=gwt,searchEmptyMessage:N="No results found.",listMaxWidth:A="auto"}=e,P=e.block??o!=="ghost",D=e.align??(P?"center":"start"),M=e.alignOffset??(D==="center"?0:-5),L=e.listMinWidth??(P?"auto":300),U=lg((ce,Ee)=>{if(s){if(!ce.value){O([]);return}if(Ee){const Y=i.filter(te=>te!==ce.value),G=WF(v,Y);O(G)}else{const Y=WF(v,i);O(Y.concat(ce))}}else O(ce)}),I=p.useRef(T);I.current=T;const H=p.useMemo(()=>y,[y.length]),K=p.useRef(y);K.current=y;const F=p.useCallback(ce=>{var Ee;(Ee=K.current.find(Y=>Y.id===ce))==null||Ee.onSelect(ce)},[]),W=p.useMemo(()=>wz(v)?v.reduce((ce,Ee)=>ce+Ee.options.length,0):v.length,[v]),X=`select-trigger-${p.useId()}`,ie=W>15,Q=p.useMemo(()=>s?{multiple:!0,value:i,TriggerView:_??rwt}:{multiple:!1,value:i,TriggerView:_??iwt},[s,i,_]),Z=p.useMemo(()=>({...Q,triggerId:X,id:t,name:r,required:n,options:v,placeholder:h,loadingPlaceholder:m,loading:u,clearable:d,variant:o,pill:g,size:l,dropdownIconType:c,block:P,align:D,alignOffset:M,side:x,avoidCollisions:w,listWidth:b,listMinWidth:L,listMaxWidth:A,searchPlaceholder:j,searchEmptyMessage:N,TriggerStartIcon:C,triggerClassName:E,opticallyAlign:R,optionClassName:S,OptionView:k,actions:H,onActionSelect:F,onSelectRef:U,searchPredicateRef:I,searchable:ie,disabled:f}),[Q,X,t,n,r,v,h,m,u,d,o,g,l,c,P,D,M,x,w,b,L,A,j,N,C,E,R,S,k,H,F,U,ie,f]);return a.jsx(MRe.Provider,{value:Z,children:a.jsx(owt,{})})},swt=e=>{const{triggerId:t,id:n,required:i,value:r,multiple:s,options:o,loading:l,disabled:c,clearable:u,name:d,variant:f,pill:h,size:m,dropdownIconType:g,placeholder:b,loadingPlaceholder:v,block:y,opticallyAlign:x,triggerClassName:w,TriggerStartIcon:O,TriggerView:S,onSelectRef:k}=Ng(),{onOpenChange:C,...E}=e,R=s?r[0]:r,_=l?v:b,j=p.useMemo(()=>ywt(o,R)||{value:"",label:_},[R,o,_]),T=s?r.length>0:!!r,N=l||!T,A=p.useMemo(()=>QRe(),[]),P=p.useMemo(()=>{if(!s)return{values:[],selectedAll:!1};const L=WF(o,r),U=o.flatMap(I=>"options"in I?I.options:I);return{values:L.length?L:[{value:"",label:_}],selectedAll:U.length<=r.length}},[s,o,r,_]),D=L=>{const U=L.key;if(!s&&zRe(U)){const I=A(U);L.stopPropagation();const H=VRe(o,I,R);H&&k.current(H)}},M=()=>{k.current({value:"",label:""}),C==null||C(!1)};return a.jsxs(Lxt,{id:t,className:w,selected:!N,variant:f,pill:h,block:y,size:m,disabled:c,loading:l,StartIcon:O,opticallyAlign:x,dropdownIconType:g,onClearClick:u?M:void 0,onInteract:C,onKeyDown:D,...E,children:[s?a.jsx(S,{...P}):a.jsx(S,{...j}),(d||n)&&a.jsx("input",{id:n,name:d,value:R,tabIndex:-1,onFocus:()=>{var L;(L=document.getElementById(t))==null||L.focus()},onChange:()=>{},required:i,className:"sr-only w-full h-0 left-0 bottom-0 pointer-events-none","aria-hidden":"true"})]})},owt=()=>{const{triggerId:e,loading:t,side:n,align:i,alignOffset:r,avoidCollisions:s,listWidth:o,listMinWidth:l,listMaxWidth:c}=Ng(),[u,d]=p.useState(!1),f=p.useRef(null),h=m=>{const g=m===void 0?!u:m;d(g),g||setTimeout(()=>{var v;if(!f.current)return;const b=document.activeElement;b&&!f.current.contains(b)||(v=document.getElementById(e))==null||v.focus()})};return SC(u,()=>{h(!1)}),a.jsxs(v_e,{open:u,onOpenChange:m=>{t&&m||h(m)},modal:!1,children:[a.jsx(x_e,{asChild:!0,children:a.jsx(swt,{onOpenChange:h})}),a.jsx(w_e,{forceMount:!0,children:a.jsx(Ww,{className:es.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:u&&a.jsx(O_e,{ref:f,forceMount:!0,className:es.MenuList,side:n,sideOffset:5,align:i,alignOffset:r,avoidCollisions:s,collisionPadding:{bottom:30,top:30},onOpenAutoFocus:Kh,onCloseAutoFocus:Kh,onEscapeKeyDown:Kh,style:zy({"select-list-width":o,"select-list-min-width":l,"select-list-max-width":c}),children:a.jsx(awt,{onOpenChange:h})},"dropdown")})})]})},LRe=p.createContext(null),Zw=()=>{const e=p.use(LRe);if(!e)throw new Error("CustomSelectMenu components must be wrapped in ");return e},awt=({onOpenChange:e})=>{const{multiple:t,value:n,options:i,searchable:r,searchPredicateRef:s}=Ng(),o=p.useRef(()=>e(!1)),l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(""),[h,m]=p.useState(()=>{var R;return((t?n[0]:n)||((R=QA(i))==null?void 0:R.value))??""}),g=p.useMemo(()=>QRe(),[]),v=`select-list-${p.useId()}`,y=p.useRef(t?"":n),x=p.useMemo(()=>d.trim().toLocaleLowerCase(),[d]),w=p.useMemo(()=>bwt(i,x,s.current),[i,x,s]),O=p.useMemo(()=>QA(w),[w]),S=p.useRef(!1),k=E=>{const R=E.key,_=t?n[0]:n,j=h||(O==null?void 0:O.value)||_,T=document.activeElement===u.current,N=l.current;if(!N)return;const A=()=>{const M=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,pointerType:"mouse"}),L=kh(h,N);L==null||L.dispatchEvent(M)},P=(M,L)=>{m(M),L.scrollIntoView({block:"nearest"})},D=()=>{const M=t?n[0]:n;if(M){const U=kh(M,N);if(U){P(M,U);return}}const L=QA(i);if(L){const U=kh(L.value,N);U&&P(L.value,U)}};switch(R){case"ArrowDown":{if(E.preventDefault(),!h||!kh(h,N)){D();return}const M=vwt(h,N),L=M==null?void 0:M.getAttribute("data-option-id");M&&L&&P(L,M);return}case"ArrowUp":{if(E.preventDefault(),!h||!kh(h,N)){D();return}const M=xwt(j,N),L=M==null?void 0:M.getAttribute("data-option-id");M&&L&&P(L,M);return}case"Enter":E.preventDefault(),A();return;case" ":if(x&&T)return;E.preventDefault(),A();return}if(zRe(R)){if(T)return;const M=g(R);E.stopPropagation();const L=VRe(i,M,h);if(L){const U=kh(L.value,N);U&&(m(L.value),U.scrollIntoView({block:"nearest"}))}}},C=p.useMemo(()=>({valueRef:y,listId:v,highlightedValue:h,setHighlightedValue:m,requestCloseRef:o,searchTerm:d,setSearchTerm:f,searchInputRef:u,listRef:c}),[v,h,m,d,f]);return p.useEffect(()=>{xN(()=>{if(!l.current)return;const R=kh(h,l.current);R==null||R.scrollIntoView({block:"center"})});const E=u.current||l.current;return E==null||E.focus({preventScroll:!0}),()=>{S.current=!1}},[]),p.useLayoutEffect(()=>{if(!S.current){S.current=!0;return}if(!c.current)return;c.current.scrollTop=0;const E=QA(w);E&&m(E.value)},[w]),a.jsx(LRe,{value:C,children:a.jsxs("div",{id:v,className:es.MenuInner,onKeyDown:k,ref:l,tabIndex:0,children:[r&&a.jsx(lwt,{value:d,onChange:f}),a.jsx(cwt,{filteredOptions:w}),a.jsx(pwt,{})]})})},lwt=({value:e,onChange:t})=>{const{searchPlaceholder:n}=Ng(),{listId:i,searchInputRef:r}=Zw(),s=o=>{t(o.target.value)};return a.jsx("div",{className:es.Search,children:a.jsx(hs,{startAdornment:a.jsx(Int,{width:16,height:16,className:"fill-secondary"}),ref:r,value:e,placeholder:n,onChange:s,autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-controls":i,"aria-expanded":!0})})},MC=e=>"options"in e,wz=e=>e[0]&&MC(e[0]),cx=300,cwt=({filteredOptions:e})=>{const{searchEmptyMessage:t}=Ng(),{listRef:n}=Zw();if(!e.length)return typeof t=="string"?a.jsx("p",{className:es.SearchEmpty,"data-text-only":!0,children:t}):a.jsx("div",{className:es.SearchEmpty,children:t});const i=wz(e),r=!i&&e.length>cx,s=i?e.map(o=>a.jsx(dwt,{...o},o.label)):e.slice(0,cx).map(o=>a.jsx(FRe,{...o},o.value));return a.jsxs("div",{className:es.OptionsList,ref:n,children:[s,r&&a.jsx($Re,{numHidden:e.length-cx})]})},uwt={limit:100,label:"Show all"},dwt=({label:e,options:t,optionsLimit:n=uwt})=>{const i=p.useId(),{searchTerm:r,setHighlightedValue:s}=Zw(),[o,l]=p.useState(!1),c=n.limit{l(!0),s(t[n.limit].value)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:es.OptionGroupHeading,children:[a.jsx("div",{className:es.OptionIndicatorSlot}),e]}),d.map(h=>a.jsx(FRe,{...h},h.value)),c&&a.jsx(fwt,{value:`group-limit-${i}`,label:n.label,onPointerUp:f}),u&&a.jsx($Re,{numHidden:t.length-cx})]})},$Re=({numHidden:e})=>a.jsxs("div",{className:es.OptionHardLimitHeading,children:[a.jsx("div",{className:es.OptionIndicatorSlot}),`…and ${e.toLocaleString()} more options. Use search to refine results further.`]}),fwt=({value:e,label:t,onPointerUp:n})=>{const{highlightedValue:i,setHighlightedValue:r}=Zw(),s=e===i,o=()=>{s||r(e)},l=()=>{r(c=>c!==e?c:"")};return a.jsx("div",{className:Ti(es.Option,es.OptionsLimit),"data-option-id":e,"data-highlight":s?"":void 0,role:"option","aria-selected":s,onPointerUp:n,onPointerMove:o,onPointerLeave:l,children:a.jsxs("div",{className:Ti(es.PressableInner,es.OptionInner),children:[a.jsx("div",{className:es.OptionIndicatorSlot}),t]})})},hwt="data-option-id",FRe=e=>{const{optionClassName:t,OptionView:n,value:i,multiple:r,onSelectRef:s}=Ng(),{valueRef:o,requestCloseRef:l,highlightedValue:c,setHighlightedValue:u}=Zw(),{value:d,disabled:f,tooltip:h}=e,m=o.current,g=r?i.includes(d):d===m,b=d===c,v=()=>{var w;r?s.current(e,g):(s.current(e),(w=l.current)==null||w.call(l))},y=()=>{b||u(d)},x=()=>{u(w=>w!==d?w:"")};return a.jsx("div",{className:Ti(es.Option,t),"data-highlight":b?"":void 0,role:"option","aria-selected":b,"data-selected":g?"":void 0,[hwt]:d,onPointerUp:f?void 0:v,onPointerMove:f?void 0:y,onPointerLeave:f?void 0:x,"aria-disabled":f,"data-disabled":f?"":void 0,children:a.jsxs("div",{className:es.PressableInner,children:[a.jsxs("div",{className:es.OptionInner,children:[a.jsx("div",{className:es.OptionIndicatorSlot,children:g&&a.jsx(Gx,{className:es.OptionCheck})}),a.jsx(n,{...e}),h&&a.jsx(uo,{content:h.content,maxWidth:h.maxWidth,side:"right",children:a.jsx(yAe,{})})]}),e.description&&a.jsxs("div",{className:es.OptionInner,children:[a.jsx("div",{className:es.OptionIndicatorSlot}),e.description]})]})})},pwt=()=>{const{actions:e}=Ng();return e.length===0?null:a.jsx("div",{className:es.ActionsContainer,children:e.map(t=>a.jsx(mwt,{...t},t.id))})},mwt=({id:e,label:t,Icon:n,className:i})=>{const{onActionSelect:r}=Ng(),{requestCloseRef:s}=Zw(),o=c=>{switch(c.key){case"Tab":break;case"Enter":case" ":c.stopPropagation(),l();break;default:c.stopPropagation()}},l=()=>{var c;r(e),(c=s.current)==null||c.call(s)};return a.jsx("div",{className:es.Action,onPointerUp:l,onKeyDown:o,tabIndex:0,children:a.jsxs("div",{className:Ti(es.ActionInner,i),children:[n&&a.jsx(n,{role:"presentation"}),t]})})},gwt=(e,t)=>e.label.toLowerCase().includes(t),bwt=(e,t,n)=>{const i=t.trim().toLocaleLowerCase();if(!i)return e;const r=s=>n(s,i);return wz(e)?e.reduce((s,o)=>{const l=o.options.filter(r);return l.length&&s.push({...o,options:l}),s},[]):e.reduce((s,o)=>(r(o)&&s.push(o),s),[])},QA=e=>{if(!e.length)return;let t;for(const n of e)if(MC(n)){const i=n.options.find(r=>!r.disabled);if(i){t=i;break}}else if(!n.disabled){t=n;break}return t},ywt=(e,t)=>{let n;for(const i of e)if(MC(i)){const r=i.options.find(s=>s.value===t);if(r){n=r;break}}else if(i.value===t){n=i;break}return n},WF=(e,t)=>{let n=[];const i=new Set(t);for(const r of e)if(MC(r)){const s=r.options.filter(o=>i.has(o.value));n=n.concat(s)}else i.has(r.value)&&n.push(r);return n},BRe=40,kh=(e,t)=>t.querySelector(`[data-option-id="${e}"]`),URe=e=>e.matches("[data-option-id]:not([data-disabled])"),vwt=(e,t)=>{const n=kh(e,t);let i=n==null?void 0:n.nextElementSibling,r=0;for(;i&&r{const n=kh(e,t);let i=n==null?void 0:n.previousElementSibling,r=0;for(;i&&r{let e="",t;return n=>(n=n.toLowerCase(),e+=n,t&&clearTimeout(t),t=setTimeout(()=>{e=""},500),n.repeat(e.length)===e?n:e)},zRe=e=>/^[a-zA-Z0-9]$/.test(e),VRe=(e,t,n)=>{if(!e.length)return;let i,r,s=!n;const o=({disabled:l,label:c,value:u})=>u===n?(s=!0,!1):!l&&c.toLowerCase().startsWith(t);for(const l of e)if(MC(l)){for(const c of l.options)if(o(c))if(s){r=c;break}else i=i||c}else if(o(l))if(s){r=l;break}else i=i||l;return r||i};function Lo(...e){return e.filter(Boolean).join(" ")}const zJ=[["14 90% 62%","28 96% 80%","3 44% 24%"],["198 72% 56%","217 88% 79%","189 42% 24%"],["263 66% 63%","291 72% 81%","242 39% 25%"],["146 49% 52%","169 66% 78%","158 38% 23%"],["334 72% 63%","15 87% 80%","350 41% 25%"]];function wwt(e){let t=2166136261;for(const o of e)t^=o.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0,[i,r,s]=zJ[n%zJ.length];return{"--resource-identity-accent":i,"--resource-identity-glow":r,"--resource-identity-shadow":s,"--resource-identity-x":`${20+(n>>>7)%61}%`,"--resource-identity-y":`${18+(n>>>15)%57}%`}}function ow({seed:e,className:t}){return a.jsx("span",{className:Lo("resource-card__identity-mark",t),style:wwt(e),"aria-hidden":"true"})}function Owt(e){return a.jsx("svg",{viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",...e,children:a.jsxs("g",{transform:"translate(0.875 0.875)",children:[a.jsx("path",{d:"M5.869 10.719a4.849 4.849 0 1 0 0-9.698 4.849 4.849 0 0 0 0 9.698Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"m11.229 11.229-1.021-1.021",stroke:"currentColor",strokeWidth:"0.984375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function Df({className:e,...t}){return a.jsx("section",{className:Lo("resource-page",e),...t})}function Ky({title:e,description:t,className:n}){return a.jsxs("header",{className:Lo("resource-page__header",n),children:[a.jsx("h1",{children:e}),t?a.jsx("p",{children:t}):null]})}function kwt({className:e,...t}){return a.jsx("div",{className:Lo("resource-detail",e),...t})}function Swt({className:e,...t}){return a.jsx("header",{className:Lo("resource-detail__header",e),...t})}function Ewt({title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s}){const{t:o}=Ae("ui"),l=r??o("resourceCollection.back");return a.jsxs("div",{className:"resource-detail__heading",children:[s?a.jsx("button",{type:"button",className:"resource-detail__back",onClick:s,"aria-label":l,title:l,children:a.jsx(Wnt,{"aria-hidden":"true"})}):null,a.jsxs("div",{className:"resource-detail__heading-copy",children:[a.jsxs("div",{className:"resource-detail__title-row",children:[a.jsx("span",{className:"resource-detail__identity",children:a.jsx(ow,{seed:n})}),a.jsx("h1",{children:e}),i?a.jsx("div",{className:"resource-detail__meta",children:i}):null]}),t?a.jsx("p",{children:t}):null]})]})}function Cwt({className:e,...t}){return a.jsx("div",{className:Lo("resource-detail__actions",e),...t})}function Twt({className:e,...t}){return a.jsx("div",{className:Lo("resource-detail__body",e),...t})}function LC({title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s,actions:o,className:l,actionsClassName:c,bodyClassName:u,sections:d,activeSectionKey:f,navigationLabel:h,onSectionChange:m,children:g}){var w;const{t:b}=Ae("ui"),v=!!(d!=null&&d.length),y=(w=d==null?void 0:d.find(O=>O.key===f))==null?void 0:w.content,x=h??b("resourceCollection.detailNavigation");return a.jsxs(kwt,{className:l,children:[a.jsxs(Swt,{children:[a.jsx(Ewt,{title:e,description:t,identitySeed:n,meta:i,backLabel:r,onBack:s}),o?a.jsx(Cwt,{className:c,children:o}):null]}),a.jsx(Twt,{className:Lo(v&&"is-split",u),children:v?a.jsxs(a.Fragment,{children:[a.jsx("nav",{className:"resource-detail__navigation","aria-label":x,children:d==null?void 0:d.map(O=>a.jsx(Dt,{type:"button",color:"secondary",variant:O.key===f?"soft":"ghost",size:"lg",pill:!1,block:!0,"aria-current":O.key===f?"page":void 0,disabled:O.disabled,onClick:()=>m==null?void 0:m(O.key),children:a.jsx("span",{className:"resource-detail__navigation-label",children:O.label})},O.key))}),a.jsx("div",{className:"resource-detail__content",children:y})]}):g})]})}function Oz({className:e,...t}){return a.jsx("dl",{className:Lo("resource-detail__summary",e),...t})}function HRe({title:e,description:t,actions:n,className:i}){return a.jsxs("header",{className:Lo("resource-detail__section-header",i),children:[a.jsxs("div",{children:[a.jsx("h2",{children:e}),t?a.jsx("p",{children:t}):null]}),n]})}function kz({rows:e,rowKey:t,rowLabel:n,columns:i,searchValue:r,onSearchChange:s,searchPlaceholder:o,searchLabel:l,toolbarActions:c,primaryAction:u,rowActions:d,scrollRef:f,onScroll:h,busy:m,footer:g,emptyLabel:b}){const{t:v}=Ae("ui"),y=!!d,x=b??v("resourceCollection.noData");return a.jsxs("div",{className:"resource-data-table",children:[a.jsxs("div",{className:"resource-data-table__toolbar",children:[a.jsx("div",{className:"resource-data-table__search",children:a.jsx(hs,{type:"search",value:r,onChange:w=>s(w.target.value),placeholder:o,"aria-label":l})}),c,u?a.jsx(Dt,{type:"button",color:"primary",disabled:u.disabled,title:u.title,onClick:u.onClick,children:u.label}):null]}),a.jsxs("div",{ref:f,className:"resource-data-table__frame","aria-busy":m||void 0,onScroll:h,children:[a.jsxs("table",{className:"resource-data-table__table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[i.map(w=>a.jsx("th",{scope:"col",className:w.className,children:w.header},w.key)),y?a.jsx("th",{scope:"col",className:"resource-data-table__actions-heading",children:a.jsx("span",{className:"sr-only",children:v("resourceCollection.actions")})}):null]})}),a.jsx("tbody",{children:e.length===0?a.jsx("tr",{children:a.jsx("td",{className:"resource-data-table__empty",colSpan:i.length+(y?1:0),children:x})}):e.map(w=>{const O=t(w),S=(n==null?void 0:n(w))??O;return a.jsxs("tr",{children:[i.map(k=>a.jsx("td",{className:k.className,children:k.render(w)},k.key)),d?a.jsx("td",{className:"resource-data-table__actions",children:a.jsx(DRe,{label:v("resourceCollection.moreActions",{label:S}),menuLabel:v("resourceCollection.actionsFor",{label:S}),items:d(w)})}):null]},O)})})]}),g]})]})}function Gy({className:e,...t}){return a.jsx("div",{className:Lo("resource-toolbar",e),...t})}function Xy({items:e,value:t,onChange:n,ariaLabel:i,idPrefix:r,className:s}){const o=c=>{c.disabled||n(c.id)},l=(c,u)=>{var g;if(!["ArrowLeft","ArrowRight","Home","End"].includes(c.key))return;c.preventDefault();const d=e.filter(b=>!b.disabled),f=d.findIndex(b=>b.id===u.id),h=c.key==="Home"?0:c.key==="End"?d.length-1:(f+(c.key==="ArrowRight"?1:-1)+d.length)%d.length,m=d[h];m&&(n(m.id),(g=document.getElementById(`${r}-${m.id}-tab`))==null||g.focus())};return a.jsx("nav",{className:Lo("resource-tabs",s),"aria-label":i,role:"tablist",children:e.map(c=>a.jsx("button",{type:"button",id:`${r}-${c.id}-tab`,className:t===c.id?"is-active":void 0,role:"tab","aria-selected":t===c.id,"aria-controls":c.panelId,tabIndex:t===c.id?0:-1,disabled:c.disabled,onClick:()=>o(c),onKeyDown:u=>l(u,c),children:c.label},c.id))})}function hp({className:e,...t}){return a.jsxs("label",{className:Lo("resource-search",e),children:[a.jsx(Owt,{}),a.jsx("input",{type:"search",...t})]})}const Awt=150,_wt=200;function VJ(e){e.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse",button:0}))}function cg({id:e,ariaLabel:t,value:n,options:i,onChange:r,className:s,disabled:o=!1}){const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),d=p.useRef(!1),f=p.useCallback(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),h=p.useCallback(()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),m=p.useCallback(()=>{var y;return((y=l.current)==null?void 0:y.querySelector(".resource-filter-select__trigger"))??null},[]),g=p.useCallback(()=>{h();const y=m();d.current&&(y==null?void 0:y.getAttribute("data-state"))==="open"&&VJ(y),d.current=!1},[h,m]),b=p.useCallback(()=>{d.current&&(h(),u.current=window.setTimeout(g,_wt))},[h,g]),v=p.useCallback(y=>{var O;if(o||!window.matchMedia("(hover: hover) and (pointer: fine)").matches)return;h();const x=m();if(!x||x.getAttribute("data-state")==="open")return;const w=document.activeElement;w instanceof HTMLElement&&w!==x&&!((O=l.current)!=null&&O.contains(w))&&w.matches("input, textarea, [contenteditable='true']")||(f(),c.current=window.setTimeout(()=>{const S=m();!S||S.getAttribute("data-state")==="open"||(d.current=!0,VJ(S))},Awt))},[h,f,o,m]);return p.useEffect(()=>{const y=x=>{var C;if(!d.current)return;const w=m();if(!w||w.getAttribute("data-state")!=="open"){d.current=!1,h();return}const O=x.target;if(!(O instanceof Node))return;const S=w.getAttribute("aria-controls"),k=S?document.getElementById(S):null;if((C=l.current)!=null&&C.contains(O)||k!=null&&k.contains(O)){h();return}b()};return document.addEventListener("pointermove",y,{passive:!0}),()=>{document.removeEventListener("pointermove",y),f(),h()}},[h,f,m,b]),a.jsxs("div",{ref:l,className:Lo("resource-filter-select",s),onMouseEnter:v,onMouseLeave:()=>{f(),b()},children:[a.jsx("label",{className:"sr-only",htmlFor:e,children:t}),a.jsx(Xs,{id:e,value:n,options:i,size:"md",variant:"ghost",pill:!1,block:!1,align:"end",listMinWidth:160,disabled:o,triggerClassName:"resource-filter-select__trigger",onChange:y=>r(y.value)})]})}const Rg=p.forwardRef(function({className:t,...n},i){return a.jsx("section",{ref:i,className:Lo("resource-results",t),...n})});function Fa(){const{t:e}=Ae("ui");return a.jsxs("div",{className:"resource-loading-state",role:"status","aria-live":"polite","aria-busy":"true",children:[a.jsx(yC,{size:16}),a.jsx(yn,{as:"span",duration:2.4,children:e("resourceCollection.loading")})]})}function Yy({className:e,...t}){return a.jsx("div",{className:Lo("resource-grid",e),...t})}function Sz({className:e,footer:t,actions:n,activateLabel:i,onActivate:r,children:s,...o}){return a.jsxs("article",{className:Lo("resource-card",r&&"is-interactive",e),...o,children:[r&&i?a.jsx("button",{type:"button",className:"resource-card__target","aria-label":i,title:i,onClick:r}):null,a.jsx("div",{className:"resource-card__content",children:s}),t||n?a.jsxs("footer",{className:"resource-card__footer",children:[t,n?a.jsx("div",{className:"resource-card__actions",children:n}):null]}):null]})}function H_({className:e,iconOnly:t=!1,tone:n="secondary",...i}){return a.jsx("button",{type:"button",className:Lo("resource-card__action",`is-${n}`,t&&"is-icon-only",e),...i})}function KF({label:e,icon:t="arrow",tone:n="primary",className:i,children:r,title:s,...o}){const l=t==="play"?a.jsx(Nnt,{}):t==="plus"?a.jsx(xAe,{}):a.jsx(pnt,{});return a.jsx(H_,{className:i,iconOnly:!0,tone:n,"aria-label":e,title:s??e,...o,children:r??l})}function Ez({leading:e,title:t,titleText:n,subtitle:i,status:r}){return a.jsxs("div",{className:"resource-card__header",children:[a.jsxs("div",{className:"resource-card__identity",children:[e,a.jsxs("div",{className:"resource-card__title-copy",children:[a.jsx("h3",{title:n,children:t}),i]})]}),r]})}function Cz({children:e,title:t}){return a.jsx("p",{className:"resource-card__description",title:t,children:e})}function qRe({items:e,className:t}){return a.jsx("dl",{className:Lo("resource-card__metadata",t),children:e.map((n,i)=>a.jsxs("div",{className:n.className,children:[a.jsx("dt",{className:n.hideLabel?"sr-only":void 0,children:n.label}),a.jsx("dd",{title:n.title,children:n.value})]},`${String(n.label)}:${i}`))})}function ug({className:e,icon:t,children:n,...i}){return a.jsxs("button",{type:"button",className:Lo("resource-create-card",e),...i,children:[a.jsx("span",{className:"resource-create-card__icon","aria-hidden":"true",children:t}),a.jsx("span",{children:n})]})}const jwt=new Set(["avif","bmp","gif","heic","jpeg","jpg","png","svg","tif","tiff","webp"]),Nwt=new Set(["avi","m4v","mkv","mov","mp4","mpeg","mpg","webm"]),Rwt=new Set(["csv","htm","html","json","md","pdf","svg","txt","xml","yaml","yml"]);function WRe(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLocaleLowerCase()}function BN(e,t){if(!Number.isFinite(e))return t;const n=e;return n>1e10?n:n*1e3}function Iwt(e){var t,n;return((t=e.actions)==null?void 0:t.artifactDelta)??((n=e.actions)==null?void 0:n.artifact_delta)}function Pwt(e){return`${e.replace(/\.pptx$/i,"")}.preview.webp`}function Dwt(e){var t;return(((t=e.content)==null?void 0:t.parts)??[]).map(n=>n.functionResponse??n.function_response).filter(n=>!!n)}function Mwt(e){if(!e)return{};const t=e.result;return t&&typeof t=="object"&&!Array.isArray(t)?t:e}function HJ(e,t,n){var i;if(/\.[A-Za-z0-9]{2,8}$/.test(e))return e;try{const r=new URL(t).pathname.split("/").filter(Boolean),o=((i=(r[r.length-1]??"").match(/\.[A-Za-z0-9]{2,8}$/))==null?void 0:i[0])??"";if(o)return`${e}${o}`}catch{}return`${e}.${n==="image"?"png":"mp4"}`}function Lwt(e,t){const n=Mwt(t),i=e==="image_generate"||e.endsWith("_image_generate"),r=["video_generate","video_task_query"].some(u=>e===u||e.endsWith(`_${u}`));if(!i&&!r)return[];const s=i?"image":"video",o=[],l=n.success_list;if(Array.isArray(l)){for(const u of l)if(!(!u||typeof u!="object"||Array.isArray(u)))for(const[d,f]of Object.entries(u))typeof f=="string"&&f.startsWith("https://")&&o.push({name:HJ(d,f,s),url:f,type:s})}const c=n.video_url;if(r&&typeof c=="string"&&c.startsWith("https://")){const u=typeof n.task_id=="string"?n.task_id:void 0;o.push({name:HJ(u||"generated-video",c,s),url:c,type:s,taskId:u})}return o}function qJ(e,t){return new Date(BN(e,t)||Date.now()).toISOString()}function $wt(e,t){var r;const n=[],i=new Set;for(const s of e)for(const o of s.sessions){const l=BN(o.lastUpdateTime,Date.now()),c=iP(o.events,t);for(const u of o.events??[])for(const d of Dwt(u)){const f=(d==null?void 0:d.name)??"";for(const h of Lwt(f,d==null?void 0:d.response)){const m=`${o.id}:${u.id??""}:${f}:${h.url}`;i.has(m)||(i.add(m),n.push({sourceUrl:h.url,name:h.name,mimeType:h.type==="image"?"image/png":"video/mp4",appName:s.appName,agentId:s.agentId,agentName:((r=s.agentName)==null?void 0:r.trim())||s.appName,sessionId:o.id,sessionTitle:c,sessionUpdatedAt:qJ(o.lastUpdateTime,l),createdAt:qJ(u.timestamp,l),origin:{runtimeId:s.runtimeId,region:s.region,eventId:u.id,invocationId:u.invocationId??u.invocation_id,toolName:f,taskId:h.taskId}}))}}}return n}function KRe(e){const t=WRe(e);return jwt.has(t)?"image":Nwt.has(t)?"video":"document"}function Fwt(e){const t=KRe(e);return t==="image"?"image":t==="video"?"video":Rwt.has(WRe(e))?"frame":"unavailable"}function Bwt(e,t,n="en-US"){var r;const i=[];for(const s of e)for(const o of s.sessions){const l=BN(o.lastUpdateTime,0),c=new Map;for(const u of o.events??[]){const d=Iwt(u);if(!d)continue;const f=BN(u.timestamp,l);for(const[h,m]of Object.entries(d)){if(!h||!Number.isFinite(m))continue;const g=c.get(h);(!g||m>=g.version)&&c.set(h,{filename:h,version:m,createdAt:f})}}for(const u of c.values()){if(/\.preview\.webp$/i.test(u.filename))continue;const d=c.get(Pwt(u.filename)),f=d??u,h=d?"image":Fwt(u.filename);i.push({id:`${s.appName}:${o.id}:${u.filename}:${u.version}`,appName:s.appName,agentId:s.agentId,sessionId:o.id,sessionTitle:iP(o.events,t),agentName:((r=s.agentName)==null?void 0:r.trim())||s.appName,sessionUpdatedAt:l,name:u.filename,version:u.version,type:KRe(u.filename),createdAt:u.createdAt||l,origin:{runtimeId:s.runtimeId,region:s.region},preview:{filename:f.filename,version:f.version,mode:h}})}}return i.sort((s,o)=>o.createdAt-s.createdAt||s.name.localeCompare(o.name,n))}function GRe(e,t,n){if(!e)return n;const i=new Date(e);if(Number.isNaN(i.getTime()))return n;const r=new Date;return i.getFullYear()===r.getFullYear()&&i.getMonth()===r.getMonth()&&i.getDate()===r.getDate()?new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(i):new Intl.DateTimeFormat(t,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}function XRe(e){return!e||e<=0?"":e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(e<10*1024*1024?1:0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}const E5=40;function Uwt(e){return[{value:"all",label:e("artifactLibrary.types.all")},{value:"document",label:e("artifactLibrary.types.document")},{value:"image",label:e("artifactLibrary.types.image")},{value:"video",label:e("artifactLibrary.types.video")}]}function Qwt(e,t){return e(`artifactLibrary.types.${t}`)}function zA(e){return e instanceof Error?e.message:String(e)}function YRe({artifact:e,large:t=!1}){return a.jsx("div",{className:`library-artifact-preview library-artifact-preview--${e.type}${t?" is-large":""}`,children:e.thumbnailUrl?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:"library-artifact-preview-media",src:e.thumbnailUrl,alt:"",loading:"lazy"}),e.type==="video"?a.jsx("span",{className:"artifact-video-play is-overlay","aria-hidden":"true",children:a.jsx(FJ,{})}):null]}):e.type==="document"?a.jsxs("div",{className:"artifact-document-sheet","aria-hidden":"true",children:[a.jsx("span",{className:"is-title"}),a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{className:"is-short"})]}):e.type==="image"?a.jsxs("div",{className:"artifact-image-scene","aria-hidden":"true",children:[a.jsx("span",{className:"artifact-image-sun"}),a.jsx("span",{className:"artifact-image-plane artifact-image-plane--back"}),a.jsx("span",{className:"artifact-image-plane artifact-image-plane--front"})]}):a.jsxs("div",{className:"artifact-video-frame","aria-hidden":"true",children:[a.jsx("span",{className:"artifact-video-orbit"}),a.jsx("span",{className:"artifact-video-node artifact-video-node--one"}),a.jsx("span",{className:"artifact-video-node artifact-video-node--two"}),a.jsx("span",{className:"artifact-video-play",children:a.jsx(FJ,{})})]})})}function zwt({artifact:e,pendingAction:t,disabled:n,onPreview:i,onDownload:r,onEdit:s,onDelete:o,onOpenSource:l,t:c,locale:u}){const d=t===`download:${e.id}`;return a.jsxs("tr",{className:"library-artifact-row",children:[a.jsx("td",{className:"library-artifact-file",children:a.jsxs("button",{type:"button",className:"library-artifact-preview-trigger","aria-label":c("artifactLibrary.previewArtifact",{name:e.name}),disabled:n||!!t,onClick:()=>i(e),children:[a.jsx("div",{className:"library-artifact-thumbnail",children:a.jsx(YRe,{artifact:e})}),a.jsxs("div",{className:"library-artifact-row-title",children:[a.jsx("span",{className:"library-artifact-row-name",title:e.name,children:e.name}),a.jsx("span",{className:"library-artifact-row-size",children:XRe(e.sizeBytes)||"—"})]})]})}),a.jsx("td",{className:"library-artifact-source-cell",children:l?a.jsxs("button",{type:"button",className:"library-artifact-source-link",title:`${e.agentName} / ${e.sessionTitle}`,onClick:()=>l(e),children:[a.jsx("span",{children:e.agentName}),a.jsx("span",{"aria-hidden":"true",children:"/"}),a.jsx("span",{children:e.sessionTitle})]}):a.jsxs("span",{title:`${e.agentName} / ${e.sessionTitle}`,children:[e.agentName," / ",e.sessionTitle]})}),a.jsx("td",{className:"library-artifact-time",children:GRe(e.updatedAt??e.createdAt,u,c("artifactLibrary.unknownTime"))}),a.jsx("td",{className:"library-artifact-actions-cell",children:a.jsx("div",{className:"library-artifact-actions",children:a.jsx(DRe,{label:c("artifactLibrary.moreActions",{name:e.name}),menuLabel:c("artifactLibrary.actionMenu",{name:e.name}),placement:"bottom-end",items:[{label:c(d?"artifactLibrary.downloading":"artifactLibrary.download"),onSelect:()=>r(e),disabled:n||!!t},...s?[{label:c("artifactLibrary.edit"),onSelect:()=>s(e),disabled:n||!!t||e.canManage===!1}]:[],...o?[{label:c("artifactLibrary.delete"),onSelect:()=>o(e),disabled:n||!!t||e.canManage===!1,danger:!0}]:[]]})})})]})}function Vwt({sources:e=[],items:t,userId:n="",active:i=!0,activationRevision:r=0,loading:s=!1,error:o="",onRetry:l,onEdit:c,onDelete:u,onDownload:d,onOpenSource:f,region:h,toolbarLeading:m,toolbarFilters:g}){var it,ue;const{t:b,i18n:v}=Ae("workspaceTools"),y=v.resolvedLanguage||v.language,[x,w]=p.useState("all"),[O,S]=p.useState(""),[k,C]=p.useState(null),[E,R]=p.useState(""),[_,j]=p.useState(""),[T,N]=p.useState(""),[A,P]=p.useState(""),[D,M]=p.useState({}),[L,U]=p.useState(()=>new Set),[I,H]=p.useState(null),[K,F]=p.useState(!1),[W,V]=p.useState(""),[X,ie]=p.useState(null),[Q,Z]=p.useState(!1),[ce,Ee]=p.useState(E5),Y=p.useRef(null),G=p.useRef(null),te=p.useRef(0),ye=p.useRef(null),Ne=p.useRef(null),pe=p.useRef(!1),me=p.useCallback(()=>{te.current+=1,C(null),R(""),j("")},[]),se=p.useMemo(()=>t?[...t]:Bwt(e,b("library.untitledSession"),y),[t,y,e,b]),Se=p.useMemo(()=>se.filter(xe=>!L.has(xe.id)).map(xe=>D[xe.id]??xe),[se,D,L]);p.useEffect(()=>()=>{te.current+=1},[]),p.useEffect(()=>()=>{E&&URL.revokeObjectURL(E)},[E]),p.useEffect(()=>{var De;if(!k)return;const xe=document.activeElement,Te=document.body.style.overflow;document.body.style.overflow="hidden",(De=Y.current)==null||De.focus();const qe=At=>{if(At.key==="Escape"){At.preventDefault(),me();return}if(At.key!=="Tab")return;const It=G.current;if(!It)return;const lt=Array.from(It.querySelectorAll('button:not([disabled]), video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(dt=>dt.getClientRects().length>0);if(lt.length===0){At.preventDefault();return}const Ot=lt[0],Ct=lt[lt.length-1];At.shiftKey&&document.activeElement===Ot?(At.preventDefault(),Ct.focus()):!At.shiftKey&&document.activeElement===Ct&&(At.preventDefault(),Ot.focus())};return document.addEventListener("keydown",qe),()=>{document.removeEventListener("keydown",qe),document.body.style.overflow=Te,xe!=null&&xe.isConnected&&xe.focus()}},[me,k]);const Le=async xe=>{const Te=te.current+1;if(te.current=Te,N(""),R(""),C(xe),xe.preview.mode!=="unavailable"){if(xe.contentUrl){R(xe.contentUrl);return}j(`preview:${xe.id}`);try{const qe=await fU(xe.appName,n,xe.sessionId,xe.preview.filename,xe.preview.version);if(te.current!==Te){URL.revokeObjectURL(qe);return}R(qe)}catch(qe){te.current===Te&&N(b("artifactLibrary.previewFailed",{name:xe.name,message:zA(qe)}))}finally{te.current===Te&&j("")}}},be=async xe=>{N(""),j(`download:${xe.id}`);try{d?await d(xe):await dU(xe.appName,n,xe.sessionId,xe.name,xe.version),P(b("artifactLibrary.downloadStarted",{name:xe.name}))}catch(Te){N(b("artifactLibrary.downloadFailed",{name:xe.name,message:zA(Te)}))}finally{j("")}},Ve=async xe=>{if(!(!I||!c)){F(!0),V("");try{const qe=await c(I,xe)??{...I,...xe,updatedAt:Date.now()};M(De=>({...De,[I.id]:qe})),P(b("artifactLibrary.updated",{name:qe.name})),H(null)}catch(Te){V(zA(Te))}finally{F(!1)}}},ve=async()=>{if(!(!X||!u)){Z(!0),N("");try{await u(X),U(xe=>new Set([...xe,X.id])),P(b("artifactLibrary.deleted",{name:X.name})),(k==null?void 0:k.id)===X.id&&me(),ie(null)}catch(xe){N(b("artifactLibrary.deleteFailed",{name:X.name,message:zA(xe)})),ie(null)}finally{Z(!1)}}},Re=p.useMemo(()=>{const xe=O.trim().toLocaleLowerCase();return Se.filter(Te=>{var qe;return(qe=Te.origin)!=null&&qe.region&&Te.origin.region!==h||x!=="all"&&Te.type!==x?!1:xe?[Te.name,Te.sessionTitle,Te.agentName].some(De=>De.toLocaleLowerCase().includes(xe)):!0})},[x,Se,O,h]),ne=p.useMemo(()=>Re.slice(0,ce),[Re,ce]),ge=ce{pe.current||(pe.current=!0,Ee(xe=>xe+E5))},[]);p.useEffect(()=>{Ee(E5)},[r,x,O,Re.length]),p.useEffect(()=>{pe.current=!1},[ce]),p.useEffect(()=>{const xe=Ne.current,Te=ye.current;if(!i||!xe||!Te||!ge)return;const qe=new IntersectionObserver(([De])=>{De.isIntersecting&&Ce()},{root:Te,rootMargin:"240px 0px",threshold:.01});return qe.observe(xe),()=>qe.disconnect()},[i,ge,Ce,ce]);const ke=()=>{const xe=ye.current;!i||!xe||!ge||xe.scrollHeight-xe.scrollTop-xe.clientHeight<=240&&Ce()},Ke=!!O.trim()||x!=="all"||Se.some(xe=>{var Te;return((Te=xe.origin)==null?void 0:Te.region)&&xe.origin.region!==h});return a.jsxs("div",{className:"artifact-library-page resource-collection",children:[a.jsxs(Gy,{className:"artifact-library-toolbar library-resource-toolbar",children:[m,a.jsxs("div",{className:"resource-toolbar__actions",children:[a.jsx(cg,{id:"artifact-type-filter",ariaLabel:b("artifactLibrary.typeFilter"),value:x,options:Uwt(b),onChange:w}),g,a.jsx(hp,{"aria-label":b("artifactLibrary.searchAria"),value:O,onChange:xe=>S(xe.target.value),placeholder:b("artifactLibrary.searchPlaceholder")})]})]}),o&&Se.length>0?a.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[a.jsx("span",{children:o}),l?a.jsx("button",{type:"button",onClick:l,children:b("artifactLibrary.retry")}):null]}):null,T?a.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[a.jsx("span",{children:T}),a.jsx("button",{type:"button",onClick:()=>N(""),children:b("artifactLibrary.close")})]}):null,a.jsx(Rg,{ref:ye,className:"artifact-library-results","aria-label":b("artifactLibrary.listAria"),onScroll:ke,children:a.jsxs("div",{className:"artifact-library-panel",children:[s&&Se.length===0?a.jsx(Fa,{}):o&&Se.length===0?a.jsxs("div",{className:"artifact-library-empty is-error",role:"alert",children:[a.jsx("p",{children:b("artifactLibrary.loadFailed")}),a.jsx("span",{children:o}),l?a.jsx("button",{type:"button",onClick:l,children:b("artifactLibrary.reload")}):null]}):Re.length===0?a.jsxs("div",{className:"artifact-library-empty",children:[a.jsx("p",{children:b(Ke?"artifactLibrary.noMatch":"artifactLibrary.noArtifacts")}),a.jsx("span",{children:b(Ke?"artifactLibrary.searchHint":"artifactLibrary.emptyHint")})]}):a.jsx("div",{className:"artifact-library-list",children:a.jsxs("table",{className:"artifact-library-table",children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"artifact-library-table__file-column"}),a.jsx("col",{className:"artifact-library-table__source-column"}),a.jsx("col",{className:"artifact-library-table__time-column"}),a.jsx("col",{className:"artifact-library-table__actions-column"})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:b("artifactLibrary.columns.name")}),a.jsx("th",{scope:"col",children:b("artifactLibrary.columns.source")}),a.jsx("th",{scope:"col",children:b("artifactLibrary.columns.updatedAt")}),a.jsx("th",{scope:"col",className:"artifact-library-table__actions-heading",children:b("artifactLibrary.columns.actions")})]})}),a.jsx("tbody",{children:ne.map(xe=>a.jsx(zwt,{artifact:xe,pendingAction:_,disabled:!n&&!t,onPreview:Te=>void Le(Te),onDownload:Te=>void be(Te),onEdit:c?Te=>{V(""),H(Te)}:void 0,onDelete:u?ie:void 0,onOpenSource:f,t:b,locale:y},xe.id))})]})}),ge?a.jsx("div",{ref:Ne,className:"artifact-library-load-more",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",duration:2.4,children:b("artifactLibrary.loadingMore")})}):null]})}),a.jsx("p",{className:"artifact-library-status","aria-live":"polite",children:A}),k?a.jsxs("div",{className:"artifact-library-preview-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"artifact-library-preview-title",children:[a.jsx("button",{type:"button",className:"artifact-library-preview-backdrop","aria-label":b("artifactLibrary.preview.close"),onClick:me}),a.jsxs("div",{ref:G,className:"artifact-library-preview-panel",children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("h2",{id:"artifact-library-preview-title",children:k.name}),a.jsx("p",{children:b("artifactLibrary.preview.meta",{type:Qwt(b,k.type),version:k.version})})]}),a.jsx("button",{ref:Y,type:"button","aria-label":b("artifactLibrary.preview.close"),onClick:me,children:a.jsx(PRe,{})})]}),a.jsxs("div",{className:"artifact-library-preview-content",children:[a.jsx("div",{className:"artifact-library-preview-canvas",children:_===`preview:${k.id}`?a.jsx(yn,{as:"span",duration:2.4,children:b("artifactLibrary.preview.loading")}):E&&k.preview.mode==="image"?a.jsx("img",{src:E,alt:b("artifactLibrary.preview.alt",{name:k.name})}):E&&k.preview.mode==="video"?a.jsx("video",{src:E,controls:!0,"aria-label":b("artifactLibrary.preview.alt",{name:k.name})}):E&&k.preview.mode==="frame"?a.jsx("iframe",{src:E,title:b("artifactLibrary.preview.alt",{name:k.name})}):a.jsxs("div",{className:"artifact-library-preview-unavailable",children:[a.jsx(YRe,{artifact:k,large:!0}),a.jsx("p",{children:b(T?"artifactLibrary.preview.loadFailed":"artifactLibrary.preview.unsupported")})]})}),a.jsxs("aside",{className:"artifact-library-preview-details","aria-label":b("artifactLibrary.preview.sourceAria"),children:[k.description?a.jsx("p",{className:"artifact-library-preview-description",children:k.description}):null,a.jsxs("dl",{children:[a.jsxs("div",{children:[a.jsx("dt",{children:b("artifactLibrary.preview.agent")}),a.jsx("dd",{title:k.agentName,children:k.agentName})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("artifactLibrary.preview.session")}),a.jsx("dd",{title:k.sessionTitle,children:k.sessionTitle})]}),(it=k.origin)!=null&&it.toolName?a.jsxs("div",{children:[a.jsx("dt",{children:b("artifactLibrary.preview.tool")}),a.jsx("dd",{children:k.origin.toolName})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:b("artifactLibrary.preview.createdAt")}),a.jsx("dd",{children:GRe(k.createdAt,y,b("artifactLibrary.unknownTime"))})]}),k.sizeBytes?a.jsxs("div",{children:[a.jsx("dt",{children:b("artifactLibrary.preview.fileSize")}),a.jsx("dd",{children:XRe(k.sizeBytes)})]}):null]}),(ue=k.tags)!=null&&ue.length?a.jsx("div",{className:"artifact-library-preview-tags","aria-label":b("artifactLibrary.preview.tags"),children:k.tags.map(xe=>a.jsx("span",{children:xe},xe))}):null]})]}),a.jsxs("footer",{children:[a.jsxs("div",{className:"artifact-library-preview-footer-start",children:[f?a.jsxs("button",{type:"button",className:"is-secondary",onClick:()=>{const xe=k;me(),f(xe)},children:[a.jsx(mxt,{}),b("artifactLibrary.preview.viewSession")]}):null,c?a.jsxs("button",{type:"button",className:"is-secondary",disabled:k.canManage===!1,onClick:()=>{const xe=k;me(),V(""),H(xe)},children:[a.jsx(FN,{}),b("artifactLibrary.edit")]}):null]}),a.jsxs("button",{type:"button",disabled:_.startsWith("download:")||!n&&!t,onClick:()=>void be(k),children:[a.jsx(pxt,{}),b("artifactLibrary.download")]})]})]})]}):null,I?a.jsx(yxt,{artifact:I,busy:K,error:W,onClose:()=>{K||H(null)},onSave:xe=>void Ve(xe)}):null,X?a.jsx(Gu,{title:b("artifactLibrary.deleteDialog.title"),description:b("artifactLibrary.deleteDialog.description",{name:X.name}),confirmLabel:b(Q?"artifactLibrary.deleteDialog.deleting":"artifactLibrary.deleteDialog.confirm"),closeLabel:b("artifactLibrary.deleteDialog.close"),variant:"danger",busy:Q,onCancel:()=>{Q||ie(null)},onConfirm:()=>void ve()}):null]})}mn.hasResourceBundle("en-US","workspaceTools")||mn.addResourceBundle("en-US","workspaceTools",Hpe,!0,!0);mn.hasResourceBundle("zh-CN","workspaceTools")||mn.addResourceBundle("zh-CN","workspaceTools",qxe,!0,!0);function Ig(e,t={}){return mn.t(e,{...t,ns:"workspaceTools"})}function Hwt(e,t){if(e&&typeof e=="object"&&"detail"in e){const n=e.detail;if(typeof n=="string"&&n.trim())return n}return t}async function $C(e,t){if(e.ok)return e;let n;try{n=await e.json()}catch{n=void 0}throw new Error(Hwt(n,Ig("artifactLibrary.api.withStatus",{message:t,status:e.status})))}function C5(e){if(typeof e=="number")return e;if(typeof e!="string")return 0;const t=Date.parse(e);return Number.isFinite(t)?t:0}function ZRe(e){const t=e;return{...t,createdAt:C5(t.createdAt),updatedAt:C5(t.updatedAt),sessionUpdatedAt:C5(t.sessionUpdatedAt)}}async function JRe(e){const t=await e.json();return Array.isArray(t.items)?t.items.map(ZRe):[]}async function qwt(){const e=await $C(await gn("/web/artifacts"),Ig("artifactLibrary.api.listFailed"));return JRe(e)}async function Wwt(e){if(e.length===0)return qwt();const t=await $C(await gn("/web/artifacts/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidates:e})},24e4),Ig("artifactLibrary.api.syncFailed"));return JRe(t)}async function Kwt(e,t){const n=await $C(await gn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),Ig("artifactLibrary.api.updateFailed"));return ZRe(await n.json())}async function Gwt(e){await $C(await gn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"DELETE"}),Ig("artifactLibrary.api.deleteFailed"))}async function Xwt(e){const n=await(await $C(await gn(`/web/artifacts/${encodeURIComponent(e.id)}/content?download=true`,{},24e4),Ig("artifactLibrary.api.downloadFailed"))).blob(),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),0)}const eIe="KNOWLEDGE_PROVIDER_ASSOCIATION_INVALID";class IP extends Error{constructor(n,i,r={}){super(n);rn(this,"status");rn(this,"errorCode");rn(this,"requestId");rn(this,"diagnostics");rn(this,"detail");rn(this,"payload");rn(this,"rawBody");this.name="KnowledgeRequestError",this.status=i;const s=typeof r=="string"?{errorCode:r}:r;this.errorCode=s.errorCode||"",this.requestId=s.requestId||"",this.diagnostics=s.diagnostics,this.detail=s.detail,this.payload=s.payload,this.rawBody=s.rawBody||""}}class tIe extends Error{constructor(n){super(n.map(({region:i,error:r})=>`${i}: ${r.message||z("knowledge.loadFailed")}`).join(` +`));rn(this,"failures");this.name="KnowledgeRegionAggregateError",this.failures=n}}const Ywt=new Set(["ak","apikey","sk","accesskey","accesskeyid","authorization","authkey","clientsecret","cookie","credential","credentials","password","passwd","privatekey","secret","secretaccesskey","secretkey","securitytoken","sessiontoken","setcookie","token"]),Zwt=6,WJ=50,nIe=4e3;function Jwt(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function e1t(e){const t=Jwt(e);return Ywt.has(t)||t.endsWith("password")||t.endsWith("secret")||t.endsWith("token")||t.endsWith("credential")}function t1t(e){return/<\s*(?:!doctype|html|head|body|script|style)\b/i.test(e)}function XO(e){if(t1t(e))return z("knowledge.htmlHidden");const t=z("knowledge.redacted");return e.replace(/\bBearer\s+[^\s,;]+/gi,`Bearer ${t}`).replace(/\b(?:set-)?cookie\s*:\s*[^\r\n]*/gi,`cookie: ${t}`).replace(/\bAKLT[A-Za-z0-9_-]{6,}\b/g,t).replace(/((?:access[_-]?key(?:[_-]?id)?|secret(?:[_-]?(?:access)?[_-]?key)?|session[_-]?token|security[_-]?token|client[_-]?secret|api[_-]?key|authorization|cookie|[a-z0-9_-]*(?:password|secret|token)|credential|ak|sk)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;&]+)/gi,`$1${t}`).replace(/([?&](?:access[_-]?key|api[_-]?key|client[_-]?secret|security[_-]?token|session[_-]?token|secret|token|password|authorization|cookie|credential)=)[^&#\s]+/gi,`$1${t}`)}function GF(e,t=0,n=new WeakSet){if(e===null||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="string")return XO(e).slice(0,nIe);if(typeof e!="object")return;if(t>=Zwt)return z("knowledge.depthTruncated");if(n.has(e))return z("knowledge.circularReference");if(n.add(e),Array.isArray(e))return e.slice(0,WJ).map(r=>GF(r,t+1,n));const i={};return Object.entries(e).slice(0,WJ).forEach(([r,s])=>{i[r]=e1t(r)?z("knowledge.redacted"):GF(s,t+1,n)}),i}function KJ(e){if(e===void 0)return"";const t=GF(e);if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t).slice(0,nIe)}catch{return z("knowledge.diagnosticsUnavailable")}}function el(e,t){if(e instanceof tIe)return e.failures.map(({region:o,error:l})=>`${o} ${el(l,t)}`).join(` `);if(!(e instanceof IP))return(e instanceof Error?XO(e.message):"")||t;const n=XO(e.message)||t,i=[Number.isFinite(e.status)?z("knowledge.statusCode",{status:e.status}):"",e.errorCode?z("knowledge.errorCode",{code:XO(e.errorCode)}):"",e.requestId?z("knowledge.requestId",{requestId:XO(e.requestId)}):""].filter(Boolean).join(" · "),r=KJ(e.diagnostics),s=KJ(e.detail);return[n,i,r?z("knowledge.diagnostics",{diagnostics:r}):"",s&&s!==n?z("knowledge.detail",{detail:s}):""].filter(Boolean).join(` -`)}function q_(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return""}function e1t(e){return Array.isArray(e)?e.map(t=>{const n=Xu(t),i=q_(n.msg,n.message);if(!i)return"";const r=Array.isArray(n.loc)?n.loc.filter(s=>typeof s=="string"||typeof s=="number").map(String).join("."):"";return r?`${r}: ${i}`:i}).filter(Boolean).join("; "):""}function t1t(e,t=!0){const n=Xu(e),i=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,r=Xu(i);return{message:typeof i=="string"?t?i.trim():"":q_(r.message,n.message,e1t(i)),errorCode:q_(r.errorCode,n.errorCode),requestId:q_(r.requestId,r.request_id,r.RequestId,n.requestId,n.request_id),diagnostics:r.diagnostics??n.diagnostics,detail:i,payload:e}}function Xu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Gi(e){return typeof e=="string"?e:""}function sE(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Tz(e){const t=Xu(e);return{id:Gi(t.id),name:Gi(t.name),description:Gi(t.description),providerType:Gi(t.providerType),providerKnowledgeId:Gi(t.providerKnowledgeId),projectName:Gi(t.projectName),region:Gi(t.region),status:Gi(t.status),createdAt:Gi(t.createdAt),updatedAt:Gi(t.updatedAt),ownerId:Gi(t.ownerId),ownerLabel:Gi(t.ownerLabel),canManage:t.canManage===!0}}function FC(e){const t=Xu(e);return{id:Gi(t.id),name:Gi(t.name),type:Gi(t.type),sizeBytes:sE(t.sizeBytes,0),status:Gi(t.status),url:Gi(t.url),tosPath:Gi(t.tosPath),metadata:Xu(t.metadata),createdAt:Gi(t.createdAt),updatedAt:Gi(t.updatedAt),sourceMarkdown:Gi(t.sourceMarkdown)}}function n1t(e){const t=Xu(e),n=t.attachment,i=Xu(n);return{id:Gi(t.id),title:Gi(t.title),content:Gi(t.content),attachmentUrl:Gi(t.attachmentUrl)||Gi(i.url)||Gi(i.previewUrl),attachmentType:Gi(t.attachmentType)||Gi(i.type)||Gi(i.mimeType),attachment:n,tableFields:t.tableFields}}async function Fd(e,t={},n=Ba){var f;const i=Pl(uu(t.headers));i.set("accept","application/json"),t.body&&!(t.body instanceof FormData)&&i.set("content-type","application/json");const r=await fetch(e,{...t,headers:i,signal:Ua(t.signal,n)});if(r.ok)return r.status===204?void 0:r.json();const s=await r.text();let o=s,l=!1;if(s)try{o=JSON.parse(s),l=!0}catch{}const c=((f=r.headers.get("content-type"))==null?void 0:f.toLowerCase())||"",u=t1t(o,l||c.startsWith("text/plain")),d=r.status===401?z("knowledge.signInRequired"):r.status===403?z("knowledge.forbidden"):r.status===404?z("knowledge.notFound"):r.status===409?z("knowledge.conflict"):z("knowledge.requestFailed",{status:r.status});throw new IP(u.message||d,r.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function Zy(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function i1t(e){var r;const t=new URLSearchParams({region:e.region,pageSize:String(e.pageSize??30)});(r=e.projectName)!=null&&r.trim()&&t.set("projectName",e.projectName.trim()),e.nextToken&&t.set("nextToken",e.nextToken);const n=await Fd(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),i=Xu(n);return{items:Array.isArray(i.items)?i.items.map(Tz):[],nextToken:Gi(i.nextToken)}}function r1t(e){return`${e.region}\0${e.id}`}async function s1t(e){var l;const t=[...new Set(e.regions.map(c=>c.trim()).filter(Boolean))],n=e.nextTokens?t.filter(c=>{var u;return!!((u=e.nextTokens)!=null&&u[c])}):t;if(n.length===0)return{items:[],nextTokens:{},failures:[]};const i=await Promise.allSettled(n.map(async c=>{var u;return{region:c,page:await i1t({region:c,projectName:e.projectName,nextToken:(u=e.nextTokens)==null?void 0:u[c],pageSize:e.pageSize,signal:e.signal})}}));if((l=e.signal)!=null&&l.aborted)throw new DOMException("Aborted","AbortError");const r=[],s={},o=new Map;if(i.forEach((c,u)=>{var f;const d=n[u];if(c.status==="rejected"){const h=(f=e.nextTokens)==null?void 0:f[d];h&&(s[d]=h),r.push({region:d,error:c.reason instanceof Error?c.reason:new Error(z("knowledge.loadFailed"))});return}c.value.page.nextToken&&(s[d]=c.value.page.nextToken),c.value.page.items.forEach(h=>{const m=h.region?h:{...h,region:d};o.set(r1t(m),m)})}),r.length===n.length)throw new tIe(r);return{items:[...o.values()],nextTokens:s,failures:r}}function o1t(e){return Fd("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},xr).then(Tz)}function a1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}${Zy(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(Tz)}function l1t(e,t){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}${Zy(t)}`,{method:"DELETE"},xr)}async function c1t(e,t){var s;const n=new URLSearchParams({region:t.region,offset:String(t.offset??0),limit:String(t.limit??30)});(s=t.documentType)!=null&&s.trim()&&n.set("documentType",t.documentType.trim());const i=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),r=Xu(i);return{items:Array.isArray(r.items)?r.items.map(FC):[],offset:sE(r.offset,0),limit:sE(r.limit,t.limit??30),hasMore:r.hasMore===!0}}async function u1t(e,t,n){const i=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),r=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${i.toString()}`,{signal:n.signal}),s=Xu(r);return{document:FC(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(n1t):[],sourceMarkdown:Gi(s.sourceMarkdown),offset:sE(s.offset,0),limit:sE(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function d1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${Zy(t)}`,{method:"POST",body:JSON.stringify(n)},xr).then(FC)}async function f1t(e,t,n){const i=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${Zy(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},xr),r=Xu(i);return{name:Gi(r.name),url:Gi(r.url),sourceMarkdown:Gi(r.sourceMarkdown)}}function h1t(e,t,n){var r,s;const i=new FormData;return i.set("file",n.file),(r=n.name)!=null&&r.trim()&&i.set("name",n.name.trim()),(s=n.documentType)!=null&&s.trim()&&i.set("documentType",n.documentType.trim()),n.metadata&&i.set("metadata",JSON.stringify(n.metadata)),Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${Zy(t)}`,{method:"POST",body:i},xr).then(FC)}function p1t(e,t,n,i){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Zy(n)}`,{method:"PATCH",body:JSON.stringify(i)}).then(FC)}function m1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Zy(n)}`,{method:"DELETE"},xr)}function Jy({className:e="",title:t,status:n,description:i,metadata:r,detailAction:s,action:o,auxiliaryAction:l}){return a.jsxs(Sz,{className:`library-resource-card ${e}`.trim(),activateLabel:`${s.label} ${t}`,onActivate:s.disabled?void 0:s.onClick,footer:a.jsx(qRe,{items:r.map(c=>({label:c.label,value:c.value,title:c.title,hideLabel:!0}))}),actions:a.jsxs(a.Fragment,{children:[l?a.jsx(KF,{className:"library-resource-card__auxiliary-action",label:`${l.label} ${t}`,tone:"secondary",disabled:l.disabled,title:l.title??l.label,onClick:l.onClick,children:l.icon}):null,o?a.jsx(KF,{label:`${o.label} ${t}`,icon:o.icon,disabled:o.disabled,title:o.title,onClick:o.onClick}):null]}),children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:t}),title:t,titleText:t,status:n}),a.jsx(Cz,{title:i,children:i})]})}function Ean(){}function GJ(e){const t=[],n=String(e||"");let i=n.indexOf(","),r=0,s=!1;for(;!s;){i===-1&&(i=n.length,s=!0);const o=n.slice(r,i).trim();(o||!s)&&t.push(o),r=i+1,i=n.indexOf(",",r)}return t}function iIe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const g1t=/[$_\p{ID_Start}]/u,b1t=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,y1t=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,v1t=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,x1t=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rIe={};function Can(e){return e?g1t.test(String.fromCodePoint(e)):!1}function Tan(e,t){const i=(t||rIe).jsx?y1t:b1t;return e?i.test(String.fromCodePoint(e)):!1}function XJ(e,t){return(rIe.jsx?x1t:v1t).test(e)}const w1t=/[ \t\n\f\r]/g;function O1t(e){return typeof e=="object"?e.type==="text"?YJ(e.value):!1:YJ(e)}function YJ(e){return e.replace(w1t,"")===""}let BC=class{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}};BC.prototype.normal={};BC.prototype.property={};BC.prototype.space=void 0;function sIe(e,t){const n={},i={};for(const r of e)Object.assign(n,r.property),Object.assign(i,r.normal);return new BC(n,i,t)}function oE(e){return e.toLowerCase()}class pc{constructor(t,n){this.attribute=n,this.property=t}}pc.prototype.attribute="";pc.prototype.booleanish=!1;pc.prototype.boolean=!1;pc.prototype.commaOrSpaceSeparated=!1;pc.prototype.commaSeparated=!1;pc.prototype.defined=!1;pc.prototype.mustUseProperty=!1;pc.prototype.number=!1;pc.prototype.overloadedBoolean=!1;pc.prototype.property="";pc.prototype.spaceSeparated=!1;pc.prototype.space=void 0;let k1t=0;const hi=e0(),To=e0(),XF=e0(),Ut=e0(),Zr=e0(),ux=e0(),Ic=e0();function e0(){return 2**++k1t}const YF=Object.freeze(Object.defineProperty({__proto__:null,boolean:hi,booleanish:To,commaOrSpaceSeparated:Ic,commaSeparated:ux,number:Ut,overloadedBoolean:XF,spaceSeparated:Zr},Symbol.toStringTag,{value:"Module"})),T5=Object.keys(YF);class Az extends pc{constructor(t,n,i,r){let s=-1;if(super(t,n),ZJ(this,"space",r),typeof i=="number")for(;++s4&&n.slice(0,4)==="data"&&A1t.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(JJ,j1t);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!JJ.test(s)){let o=s.replace(T1t,_1t);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=Az}return new r(i,t)}function _1t(e){return"-"+e.toLowerCase()}function j1t(e){return e.charAt(1).toUpperCase()}const UC=sIe([oIe,S1t,cIe,uIe,dIe],"html"),Pg=sIe([oIe,E1t,cIe,uIe,dIe],"svg");function eee(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fIe(e){return e.join(" ").trim()}var _z={},tee=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,N1t=/\n/g,R1t=/^\s*/,I1t=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,P1t=/^:\s*/,D1t=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,M1t=/^[;\s]*/,L1t=/^\s+|\s+$/g,$1t=` -`,nee="/",iee="*",kb="",F1t="comment",B1t="declaration";function U1t(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function r(g){var b=g.match(N1t);b&&(n+=b.length);var v=g.lastIndexOf($1t);i=~v?g.length-v:i+g.length}function s(){var g={line:n,column:i};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:i},this.source=t.source}o.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+i+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=i,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var v=b[0];return r(v),e=e.slice(v.length),b}}function u(){c(R1t)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=s();if(!(nee!=e.charAt(0)||iee!=e.charAt(1))){for(var b=2;kb!=e.charAt(b)&&(iee!=e.charAt(b)||nee!=e.charAt(b+1));)++b;if(b+=2,kb===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return i+=2,r(v),e=e.slice(b),i+=2,g({type:F1t,comment:v})}}function h(){var g=s(),b=c(I1t);if(b){if(f(),!c(P1t))return l("property missing ':'");var v=c(D1t),y=g({type:B1t,property:ree(b[0].replace(tee,kb)),value:v?ree(v[0].replace(tee,kb)):kb});return c(M1t),y}}function m(){var g=[];d(g);for(var b;b=h();)b!==!1&&(g.push(b),d(g));return g}return u(),m()}function ree(e){return e?e.replace(L1t,kb):kb}var Q1t=U1t,z1t=ym&&ym.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_z,"__esModule",{value:!0});_z.default=H1t;const V1t=z1t(Q1t);function H1t(e,t){let n=null;if(!e||typeof e!="string")return n;const i=(0,V1t.default)(e),r=typeof t=="function";return i.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;r?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var DP={};Object.defineProperty(DP,"__esModule",{value:!0});DP.camelCase=void 0;var q1t=/^--[a-zA-Z0-9_-]+$/,W1t=/-([a-z])/g,K1t=/^[^-]+$/,G1t=/^-(webkit|moz|ms|o|khtml)-/,X1t=/^-(ms)-/,Y1t=function(e){return!e||K1t.test(e)||q1t.test(e)},Z1t=function(e,t){return t.toUpperCase()},see=function(e,t){return"".concat(t,"-")},J1t=function(e,t){return t===void 0&&(t={}),Y1t(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(X1t,see):e=e.replace(G1t,see),e.replace(W1t,Z1t))};DP.camelCase=J1t;var eOt=ym&&ym.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},tOt=eOt(_z),nOt=DP;function ZF(e,t){var n={};return!e||typeof e!="string"||(0,tOt.default)(e,function(i,r){i&&r&&(n[(0,nOt.camelCase)(i,t)]=r)}),n}ZF.default=ZF;var iOt=ZF;const rOt=Ew(iOt),MP=hIe("end"),Vf=hIe("start");function hIe(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function sOt(e){const t=Vf(e),n=MP(e);if(t&&n)return{start:t,end:n}}function Qk(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?oee(e.position):"start"in e||"end"in e?oee(e):"line"in e||"column"in e?JF(e):""}function JF(e){return aee(e&&e.line)+":"+aee(e&&e.column)}function oee(e){return JF(e&&e.start)+"-"+JF(e&&e.end)}function aee(e){return e&&typeof e=="number"?e:1}class al extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let r="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?r=t:!s.cause&&t&&(o=!0,r=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){const c=i.indexOf(":");c===-1?s.ruleId=i:(s.source=i.slice(0,c),s.ruleId=i.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=l?l.line:void 0,this.name=Qk(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}al.prototype.file="";al.prototype.name="";al.prototype.reason="";al.prototype.message="";al.prototype.stack="";al.prototype.column=void 0;al.prototype.line=void 0;al.prototype.ancestors=void 0;al.prototype.cause=void 0;al.prototype.fatal=void 0;al.prototype.place=void 0;al.prototype.ruleId=void 0;al.prototype.source=void 0;const jz={}.hasOwnProperty,oOt=new Map,aOt=/[A-Z]/g,lOt=new Set(["table","tbody","thead","tfoot","tr"]),cOt=new Set(["td","th"]),pIe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uOt(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=yOt(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=bOt(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Pg:UC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=mIe(r,e,void 0);return s&&typeof s!="string"?s:r.create(e,r.Fragment,{children:s||void 0},void 0)}function mIe(e,t,n){if(t.type==="element")return dOt(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fOt(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return pOt(e,t,n);if(t.type==="mdxjsEsm")return hOt(e,t);if(t.type==="root")return mOt(e,t,n);if(t.type==="text")return gOt(e,t)}function dOt(e,t,n){const i=e.schema;let r=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(r=Pg,e.schema=r),e.ancestors.push(t);const s=bIe(e,t.tagName,!1),o=vOt(e,t);let l=Rz(e,t);return lOt.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!O1t(c):!0})),gIe(e,o,s,t),Nz(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function fOt(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}aE(e,t.position)}function hOt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);aE(e,t.position)}function pOt(e,t,n){const i=e.schema;let r=i;t.name==="svg"&&i.space==="html"&&(r=Pg,e.schema=r),e.ancestors.push(t);const s=t.name===null?e.Fragment:bIe(e,t.name,!0),o=xOt(e,t),l=Rz(e,t);return gIe(e,o,s,t),Nz(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function mOt(e,t,n){const i={};return Nz(i,Rz(e,t)),e.create(t,e.Fragment,i,n)}function gOt(e,t){return t.value}function gIe(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Nz(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function bOt(e,t,n){return i;function i(r,s,o,l){const u=Array.isArray(o.children)?n:t;return l?u(s,o,l):u(s,o)}}function yOt(e,t){return n;function n(i,r,s,o){const l=Array.isArray(s.children),c=Vf(i);return t(r,s,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function vOt(e,t){const n={};let i,r;for(r in t.properties)if(r!=="children"&&jz.call(t.properties,r)){const s=wOt(e,r,t.properties[r]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&cOt.has(t.tagName)?i=l:n[o]=l}}if(i){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function xOt(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const s=i.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else aE(e,t.position);else{const r=i.name;let s;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else aE(e,t.position);else s=i.value===null?!0:i.value;n[r]=s}return n}function Rz(e,t){const n=[];let i=-1;const r=e.passKeys?new Map:oOt;for(;++ir?0:r+t:t=t>r?r:t,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(tu(e,e.length,0,t),e):t}const uee={}.hasOwnProperty;function vIe(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Td(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kl=Dg(/[A-Za-z]/),il=Dg(/[\dA-Za-z]/),jOt=Dg(/[#-'*+\--9=?A-Z^-~]/);function UN(e){return e!==null&&(e<32||e===127)}const e8=Dg(/\d/),NOt=Dg(/[\dA-Fa-f]/),ROt=Dg(/[!-/:-@[-`{-~]/);function Dn(e){return e!==null&&e<-2}function Vr(e){return e!==null&&(e<0||e===32)}function Mi(e){return e===-2||e===-1||e===32}const LP=Dg(new RegExp("\\p{P}|\\p{S}","u")),ky=Dg(/\s/);function Dg(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function e1(e){const t=[];let n=-1,i=0,r=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),r=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(i)}function tr(e,t,n,i){const r=i?i-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Mi(c)?(e.enter(n),l(c)):t(c)}function l(c){return Mi(c)&&s++o))return;const C=t.events.length;let E=C,R,_;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(R){_=t.events[E][1].end;break}R=!0}for(y(i),k=C;kw;){const S=n[O];t.containerState=S[1],S[0].exit.call(t,e)}n.length=w}function x(){r.write([null]),s=void 0,r=void 0,t.containerState._closeFlow=void 0}}function LOt(e,t,n){return tr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function aw(e){if(e===null||Vr(e)||ky(e))return 1;if(LP(e))return 2}function $P(e,t,n){const i=[];let r=-1;for(;++r1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[i][1].end},h={...e[n][1].start};fee(f,-c),fee(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[i][1].end={...o.start},e[n][1].start={...l.end},u=[],e[i][1].end.offset-e[i][1].start.offset&&(u=Su(u,[["enter",e[i][1],t],["exit",e[i][1],t]])),u=Su(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Su(u,$P(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),u=Su(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Su(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,tu(e,i-1,n-i+3,u),n=i+u.length-d-2;break}}for(n=-1;++n0&&Mi(k)?tr(e,x,"linePrefix",s+1)(k):x(k)}function x(k){return k===null||Dn(k)?e.check(hee,b,O)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||Dn(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),w)}function O(k){return e.exit("codeFenced"),t(k)}function S(k,C,E){let R=0;return _;function _(P){return k.enter("lineEnding"),k.consume(P),k.exit("lineEnding"),j}function j(P){return k.enter("codeFencedFence"),Mi(P)?tr(k,T,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):T(P)}function T(P){return P===l?(k.enter("codeFencedFenceSequence"),N(P)):E(P)}function N(P){return P===l?(R++,k.consume(P),N):R>=o?(k.exit("codeFencedFenceSequence"),Mi(P)?tr(k,A,"whitespace")(P):A(P)):E(P)}function A(P){return P===null||Dn(P)?(k.exit("codeFencedFence"),C(P)):E(P)}}}function GOt(e,t,n){const i=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const _5={name:"codeIndented",tokenize:YOt},XOt={partial:!0,tokenize:ZOt};function YOt(e,t,n){const i=this;return r;function r(u){return e.enter("codeIndented"),tr(e,s,"linePrefix",5)(u)}function s(u){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Dn(u)?e.attempt(XOt,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Dn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function ZOt(e,t,n){const i=this;return r;function r(o){return i.parser.lazy[i.now().line]?n(o):Dn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):tr(e,s,"linePrefix",5)(o)}function s(o){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Dn(o)?r(o):n(o)}}const JOt={name:"codeText",previous:tkt,resolve:ekt,tokenize:nkt};function ekt(e){let t=e.length-4,n=3,i,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const r=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&oO(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),oO(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),oO(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(i.parser.constructs.flow,n,t)(o)}}function EIe(e,t,n,i,r,s,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(i),e.enter(r),e.enter(s),e.consume(y),e.exit(s),h):y===null||y===32||y===41||UN(y)?n(y):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),e.exit(i),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||Dn(y)?n(y):(e.consume(y),y===92?g:m)}function g(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function b(y){return!d&&(y===null||y===41||Vr(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),t(y)):d999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(s),e.enter(r),e.consume(m),e.exit(r),e.exit(i),t):Dn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||Dn(m)||l++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!Mi(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(e.consume(m),l++,f):f(m)}}function TIe(e,t,n,i,r,s){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(r),e.consume(h),e.exit(r),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(r),e.consume(h),e.exit(r),e.exit(i),t):(e.enter(s),u(h))}function u(h){return h===o?(e.exit(s),c(o)):h===null?n(h):Dn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),tr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||Dn(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===o||h===92?(e.consume(h),d):d(h)}}function zk(e,t){let n;return i;function i(r){return Dn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,i):Mi(r)?tr(e,i,n?"linePrefix":"lineSuffix")(r):t(r)}}const ukt={name:"definition",tokenize:fkt},dkt={partial:!0,tokenize:hkt};function fkt(e,t,n){const i=this;let r;return s;function s(m){return e.enter("definition"),o(m)}function o(m){return CIe.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return r=Td(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return Vr(m)?zk(e,u)(m):u(m)}function u(m){return EIe(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(dkt,f,f)(m)}function f(m){return Mi(m)?tr(e,h,"whitespace")(m):h(m)}function h(m){return m===null||Dn(m)?(e.exit("definition"),i.parser.defined.push(r),t(m)):n(m)}}function hkt(e,t,n){return i;function i(l){return Vr(l)?zk(e,r)(l):n(l)}function r(l){return TIe(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Mi(l)?tr(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Dn(l)?t(l):n(l)}}const pkt={name:"hardBreakEscape",tokenize:mkt};function mkt(e,t,n){return i;function i(s){return e.enter("hardBreakEscape"),e.consume(s),r}function r(s){return Dn(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const gkt={name:"headingAtx",resolve:bkt,tokenize:ykt};function bkt(e,t){let n=e.length-2,i=3,r,s;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},s={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},tu(e,i,n-i+1,[["enter",r,t],["enter",s,t],["exit",s,t],["exit",r,t]])),e}function ykt(e,t,n){let i=0;return r;function r(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&i++<6?(e.consume(d),o):d===null||Vr(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Dn(d)?(e.exit("atxHeading"),t(d)):Mi(d)?tr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Vr(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const vkt=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],mee=["pre","script","style","textarea"],xkt={concrete:!0,name:"htmlFlow",resolveTo:kkt,tokenize:Skt},wkt={partial:!0,tokenize:Ckt},Okt={partial:!0,tokenize:Ekt};function kkt(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Skt(e,t,n){const i=this;let r,s,o,l,c;return u;function u(F){return d(F)}function d(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),f}function f(F){return F===33?(e.consume(F),h):F===47?(e.consume(F),s=!0,b):F===63?(e.consume(F),r=3,i.interrupt?t:I):kl(F)?(e.consume(F),o=String.fromCharCode(F),v):n(F)}function h(F){return F===45?(e.consume(F),r=2,m):F===91?(e.consume(F),r=5,l=0,g):kl(F)?(e.consume(F),r=4,i.interrupt?t:I):n(F)}function m(F){return F===45?(e.consume(F),i.interrupt?t:I):n(F)}function g(F){const W="CDATA[";return F===W.charCodeAt(l++)?(e.consume(F),l===W.length?i.interrupt?t:T:g):n(F)}function b(F){return kl(F)?(e.consume(F),o=String.fromCharCode(F),v):n(F)}function v(F){if(F===null||F===47||F===62||Vr(F)){const W=F===47,V=o.toLowerCase();return!W&&!s&&mee.includes(V)?(r=1,i.interrupt?t(F):T(F)):vkt.includes(o.toLowerCase())?(r=6,W?(e.consume(F),y):i.interrupt?t(F):T(F)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(F):s?x(F):w(F))}return F===45||il(F)?(e.consume(F),o+=String.fromCharCode(F),v):n(F)}function y(F){return F===62?(e.consume(F),i.interrupt?t:T):n(F)}function x(F){return Mi(F)?(e.consume(F),x):_(F)}function w(F){return F===47?(e.consume(F),_):F===58||F===95||kl(F)?(e.consume(F),O):Mi(F)?(e.consume(F),w):_(F)}function O(F){return F===45||F===46||F===58||F===95||il(F)?(e.consume(F),O):S(F)}function S(F){return F===61?(e.consume(F),k):Mi(F)?(e.consume(F),S):w(F)}function k(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),c=F,C):Mi(F)?(e.consume(F),k):E(F)}function C(F){return F===c?(e.consume(F),c=null,R):F===null||Dn(F)?n(F):(e.consume(F),C)}function E(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vr(F)?S(F):(e.consume(F),E)}function R(F){return F===47||F===62||Mi(F)?w(F):n(F)}function _(F){return F===62?(e.consume(F),j):n(F)}function j(F){return F===null||Dn(F)?T(F):Mi(F)?(e.consume(F),j):n(F)}function T(F){return F===45&&r===2?(e.consume(F),D):F===60&&r===1?(e.consume(F),M):F===62&&r===4?(e.consume(F),H):F===63&&r===3?(e.consume(F),I):F===93&&r===5?(e.consume(F),U):Dn(F)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(wkt,K,N)(F)):F===null||Dn(F)?(e.exit("htmlFlowData"),N(F)):(e.consume(F),T)}function N(F){return e.check(Okt,A,K)(F)}function A(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),P}function P(F){return F===null||Dn(F)?N(F):(e.enter("htmlFlowData"),T(F))}function D(F){return F===45?(e.consume(F),I):T(F)}function M(F){return F===47?(e.consume(F),o="",L):T(F)}function L(F){if(F===62){const W=o.toLowerCase();return mee.includes(W)?(e.consume(F),H):T(F)}return kl(F)&&o.length<8?(e.consume(F),o+=String.fromCharCode(F),L):T(F)}function U(F){return F===93?(e.consume(F),I):T(F)}function I(F){return F===62?(e.consume(F),H):F===45&&r===2?(e.consume(F),I):T(F)}function H(F){return F===null||Dn(F)?(e.exit("htmlFlowData"),K(F)):(e.consume(F),H)}function K(F){return e.exit("htmlFlow"),t(F)}}function Ekt(e,t,n){const i=this;return r;function r(o){return Dn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function Ckt(e,t,n){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(QC,t,n)}}const Tkt={name:"htmlText",tokenize:Akt};function Akt(e,t,n){const i=this;let r,s,o;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),S):I===63?(e.consume(I),w):kl(I)?(e.consume(I),E):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,g):kl(I)?(e.consume(I),x):n(I)}function d(I){return I===45?(e.consume(I),m):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Dn(I)?(o=f,M(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),m):f(I)}function m(I){return I===62?D(I):I===45?h(I):f(I)}function g(I){const H="CDATA[";return I===H.charCodeAt(s++)?(e.consume(I),s===H.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),v):Dn(I)?(o=b,M(I)):(e.consume(I),b)}function v(I){return I===93?(e.consume(I),y):b(I)}function y(I){return I===62?D(I):I===93?(e.consume(I),y):b(I)}function x(I){return I===null||I===62?D(I):Dn(I)?(o=x,M(I)):(e.consume(I),x)}function w(I){return I===null?n(I):I===63?(e.consume(I),O):Dn(I)?(o=w,M(I)):(e.consume(I),w)}function O(I){return I===62?D(I):w(I)}function S(I){return kl(I)?(e.consume(I),k):n(I)}function k(I){return I===45||il(I)?(e.consume(I),k):C(I)}function C(I){return Dn(I)?(o=C,M(I)):Mi(I)?(e.consume(I),C):D(I)}function E(I){return I===45||il(I)?(e.consume(I),E):I===47||I===62||Vr(I)?R(I):n(I)}function R(I){return I===47?(e.consume(I),D):I===58||I===95||kl(I)?(e.consume(I),_):Dn(I)?(o=R,M(I)):Mi(I)?(e.consume(I),R):D(I)}function _(I){return I===45||I===46||I===58||I===95||il(I)?(e.consume(I),_):j(I)}function j(I){return I===61?(e.consume(I),T):Dn(I)?(o=j,M(I)):Mi(I)?(e.consume(I),j):R(I)}function T(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),r=I,N):Dn(I)?(o=T,M(I)):Mi(I)?(e.consume(I),T):(e.consume(I),A)}function N(I){return I===r?(e.consume(I),r=void 0,P):I===null?n(I):Dn(I)?(o=N,M(I)):(e.consume(I),N)}function A(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Vr(I)?R(I):(e.consume(I),A)}function P(I){return I===47||I===62||Vr(I)?R(I):n(I)}function D(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function M(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),L}function L(I){return Mi(I)?tr(e,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return e.enter("htmlTextData"),o(I)}}const Dz={name:"labelEnd",resolveAll:Rkt,resolveTo:Ikt,tokenize:Pkt},_kt={tokenize:Dkt},jkt={tokenize:Mkt},Nkt={tokenize:Lkt};function Rkt(e){let t=-1;const n=[];for(;++t=3&&(u===null||Dn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),i++,c):(e.exit("thematicBreakSequence"),Mi(u)?tr(e,l,"whitespace")(u):l(u))}}const Vl={continuation:{tokenize:Wkt},exit:Gkt,name:"list",tokenize:qkt},Vkt={partial:!0,tokenize:Xkt},Hkt={partial:!0,tokenize:Kkt};function qkt(e,t,n){const i=this,r=i.events[i.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return l;function l(m){const g=i.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!i.containerState.marker||m===i.containerState.marker:e8(m)){if(i.containerState.type||(i.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(W_,n,u)(m):u(m);if(!i.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return e8(m)&&++o<10?(e.consume(m),c):(!i.interrupt||o<2)&&(i.containerState.marker?m===i.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||m,e.check(QC,i.interrupt?n:d,e.attempt(Vkt,h,f))}function d(m){return i.containerState.initialBlankLine=!0,s++,h(m)}function f(m){return Mi(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return i.containerState.size=s+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function Wkt(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(QC,r,s);function r(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,tr(e,t,"listItemIndent",i.containerState.size+1)(l)}function s(l){return i.containerState.furtherBlankLines||!Mi(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(Hkt,t,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,tr(e,e.attempt(Vl,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Kkt(e,t,n){const i=this;return tr(e,r,"listItemIndent",i.containerState.size+1);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(s):n(s)}}function Gkt(e){e.exit(this.containerState.type)}function Xkt(e,t,n){const i=this;return tr(e,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(s){const o=i.events[i.events.length-1];return!Mi(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const gee={name:"setextUnderline",resolveTo:Ykt,tokenize:Zkt};function Ykt(e,t){let n=e.length,i,r,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",s?(e.splice(r,0,["enter",o,t]),e.splice(s+1,0,["exit",e[i][1],t]),e[i][1].end={...e[s][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function Zkt(e,t,n){const i=this;let r;return s;function s(u){let d=i.events.length,f;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){f=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===r?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Mi(u)?tr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Dn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Jkt={tokenize:eSt};function eSt(e){const t=this,n=e.attempt(QC,i,e.attempt(this.parser.constructs.flowInitial,r,tr(e,e.attempt(this.parser.constructs.flow,r,e.attempt(skt,r)),"linePrefix")));return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const tSt={resolveAll:_Ie()},nSt=AIe("string"),iSt=AIe("text");function AIe(e){return{resolveAll:_Ie(e==="text"?rSt:void 0),tokenize:t};function t(n){const i=this,r=this.parser.constructs[e],s=n.attempt(r,o,l);return o;function o(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=r[d];let h=-1;if(f)for(;++h-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}s>0&&o.push(e[r].slice(0,s))}return o}function bSt(e,t){let n=-1;const i=[];let r;for(;++n{const n=Xu(t),i=q_(n.msg,n.message);if(!i)return"";const r=Array.isArray(n.loc)?n.loc.filter(s=>typeof s=="string"||typeof s=="number").map(String).join("."):"";return r?`${r}: ${i}`:i}).filter(Boolean).join("; "):""}function i1t(e,t=!0){const n=Xu(e),i=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,r=Xu(i);return{message:typeof i=="string"?t?i.trim():"":q_(r.message,n.message,n1t(i)),errorCode:q_(r.errorCode,n.errorCode),requestId:q_(r.requestId,r.request_id,r.RequestId,n.requestId,n.request_id),diagnostics:r.diagnostics??n.diagnostics,detail:i,payload:e}}function Xu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Gi(e){return typeof e=="string"?e:""}function sE(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Tz(e){const t=Xu(e);return{id:Gi(t.id),name:Gi(t.name),description:Gi(t.description),providerType:Gi(t.providerType),providerKnowledgeId:Gi(t.providerKnowledgeId),projectName:Gi(t.projectName),region:Gi(t.region),status:Gi(t.status),createdAt:Gi(t.createdAt),updatedAt:Gi(t.updatedAt),ownerId:Gi(t.ownerId),ownerLabel:Gi(t.ownerLabel),canManage:t.canManage===!0}}function FC(e){const t=Xu(e);return{id:Gi(t.id),name:Gi(t.name),type:Gi(t.type),sizeBytes:sE(t.sizeBytes,0),status:Gi(t.status),url:Gi(t.url),tosPath:Gi(t.tosPath),metadata:Xu(t.metadata),createdAt:Gi(t.createdAt),updatedAt:Gi(t.updatedAt),sourceMarkdown:Gi(t.sourceMarkdown)}}function r1t(e){const t=Xu(e),n=t.attachment,i=Xu(n);return{id:Gi(t.id),title:Gi(t.title),content:Gi(t.content),attachmentUrl:Gi(t.attachmentUrl)||Gi(i.url)||Gi(i.previewUrl),attachmentType:Gi(t.attachmentType)||Gi(i.type)||Gi(i.mimeType),attachment:n,tableFields:t.tableFields}}async function Fd(e,t={},n=Ba){var f;const i=Pl(uu(t.headers));i.set("accept","application/json"),t.body&&!(t.body instanceof FormData)&&i.set("content-type","application/json");const r=await fetch(e,{...t,headers:i,signal:Ua(t.signal,n)});if(r.ok)return r.status===204?void 0:r.json();const s=await r.text();let o=s,l=!1;if(s)try{o=JSON.parse(s),l=!0}catch{}const c=((f=r.headers.get("content-type"))==null?void 0:f.toLowerCase())||"",u=i1t(o,l||c.startsWith("text/plain")),d=r.status===401?z("knowledge.signInRequired"):r.status===403?z("knowledge.forbidden"):r.status===404?z("knowledge.notFound"):r.status===409?z("knowledge.conflict"):z("knowledge.requestFailed",{status:r.status});throw new IP(u.message||d,r.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function Zy(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function s1t(e){var r;const t=new URLSearchParams({region:e.region,pageSize:String(e.pageSize??30)});(r=e.projectName)!=null&&r.trim()&&t.set("projectName",e.projectName.trim()),e.nextToken&&t.set("nextToken",e.nextToken);const n=await Fd(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),i=Xu(n);return{items:Array.isArray(i.items)?i.items.map(Tz):[],nextToken:Gi(i.nextToken)}}function o1t(e){return`${e.region}\0${e.id}`}async function a1t(e){var l;const t=[...new Set(e.regions.map(c=>c.trim()).filter(Boolean))],n=e.nextTokens?t.filter(c=>{var u;return!!((u=e.nextTokens)!=null&&u[c])}):t;if(n.length===0)return{items:[],nextTokens:{},failures:[]};const i=await Promise.allSettled(n.map(async c=>{var u;return{region:c,page:await s1t({region:c,projectName:e.projectName,nextToken:(u=e.nextTokens)==null?void 0:u[c],pageSize:e.pageSize,signal:e.signal})}}));if((l=e.signal)!=null&&l.aborted)throw new DOMException("Aborted","AbortError");const r=[],s={},o=new Map;if(i.forEach((c,u)=>{var f;const d=n[u];if(c.status==="rejected"){const h=(f=e.nextTokens)==null?void 0:f[d];h&&(s[d]=h),r.push({region:d,error:c.reason instanceof Error?c.reason:new Error(z("knowledge.loadFailed"))});return}c.value.page.nextToken&&(s[d]=c.value.page.nextToken),c.value.page.items.forEach(h=>{const m=h.region?h:{...h,region:d};o.set(o1t(m),m)})}),r.length===n.length)throw new tIe(r);return{items:[...o.values()],nextTokens:s,failures:r}}function l1t(e){return Fd("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},xr).then(Tz)}function c1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}${Zy(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(Tz)}function u1t(e,t){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}${Zy(t)}`,{method:"DELETE"},xr)}async function d1t(e,t){var s;const n=new URLSearchParams({region:t.region,offset:String(t.offset??0),limit:String(t.limit??30)});(s=t.documentType)!=null&&s.trim()&&n.set("documentType",t.documentType.trim());const i=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),r=Xu(i);return{items:Array.isArray(r.items)?r.items.map(FC):[],offset:sE(r.offset,0),limit:sE(r.limit,t.limit??30),hasMore:r.hasMore===!0}}async function f1t(e,t,n){const i=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),r=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${i.toString()}`,{signal:n.signal}),s=Xu(r);return{document:FC(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(r1t):[],sourceMarkdown:Gi(s.sourceMarkdown),offset:sE(s.offset,0),limit:sE(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function h1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${Zy(t)}`,{method:"POST",body:JSON.stringify(n)},xr).then(FC)}async function p1t(e,t,n){const i=await Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${Zy(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},xr),r=Xu(i);return{name:Gi(r.name),url:Gi(r.url),sourceMarkdown:Gi(r.sourceMarkdown)}}function m1t(e,t,n){var r,s;const i=new FormData;return i.set("file",n.file),(r=n.name)!=null&&r.trim()&&i.set("name",n.name.trim()),(s=n.documentType)!=null&&s.trim()&&i.set("documentType",n.documentType.trim()),n.metadata&&i.set("metadata",JSON.stringify(n.metadata)),Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${Zy(t)}`,{method:"POST",body:i},xr).then(FC)}function g1t(e,t,n,i){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Zy(n)}`,{method:"PATCH",body:JSON.stringify(i)}).then(FC)}function b1t(e,t,n){return Fd(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Zy(n)}`,{method:"DELETE"},xr)}function Jy({className:e="",title:t,status:n,description:i,metadata:r,detailAction:s,action:o,auxiliaryAction:l}){return a.jsxs(Sz,{className:`library-resource-card ${e}`.trim(),activateLabel:`${s.label} ${t}`,onActivate:s.disabled?void 0:s.onClick,footer:a.jsx(qRe,{items:r.map(c=>({label:c.label,value:c.value,title:c.title,hideLabel:!0}))}),actions:a.jsxs(a.Fragment,{children:[l?a.jsx(KF,{className:"library-resource-card__auxiliary-action",label:`${l.label} ${t}`,tone:"secondary",disabled:l.disabled,title:l.title??l.label,onClick:l.onClick,children:l.icon}):null,o?a.jsx(KF,{label:`${o.label} ${t}`,icon:o.icon,disabled:o.disabled,title:o.title,onClick:o.onClick}):null]}),children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:t}),title:t,titleText:t,status:n}),a.jsx(Cz,{title:i,children:i})]})}function Tan(){}function GJ(e){const t=[],n=String(e||"");let i=n.indexOf(","),r=0,s=!1;for(;!s;){i===-1&&(i=n.length,s=!0);const o=n.slice(r,i).trim();(o||!s)&&t.push(o),r=i+1,i=n.indexOf(",",r)}return t}function iIe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const y1t=/[$_\p{ID_Start}]/u,v1t=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,x1t=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,w1t=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O1t=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rIe={};function Aan(e){return e?y1t.test(String.fromCodePoint(e)):!1}function _an(e,t){const i=(t||rIe).jsx?x1t:v1t;return e?i.test(String.fromCodePoint(e)):!1}function XJ(e,t){return(rIe.jsx?O1t:w1t).test(e)}const k1t=/[ \t\n\f\r]/g;function S1t(e){return typeof e=="object"?e.type==="text"?YJ(e.value):!1:YJ(e)}function YJ(e){return e.replace(k1t,"")===""}let BC=class{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}};BC.prototype.normal={};BC.prototype.property={};BC.prototype.space=void 0;function sIe(e,t){const n={},i={};for(const r of e)Object.assign(n,r.property),Object.assign(i,r.normal);return new BC(n,i,t)}function oE(e){return e.toLowerCase()}class pc{constructor(t,n){this.attribute=n,this.property=t}}pc.prototype.attribute="";pc.prototype.booleanish=!1;pc.prototype.boolean=!1;pc.prototype.commaOrSpaceSeparated=!1;pc.prototype.commaSeparated=!1;pc.prototype.defined=!1;pc.prototype.mustUseProperty=!1;pc.prototype.number=!1;pc.prototype.overloadedBoolean=!1;pc.prototype.property="";pc.prototype.spaceSeparated=!1;pc.prototype.space=void 0;let E1t=0;const hi=e0(),To=e0(),XF=e0(),Ut=e0(),Zr=e0(),ux=e0(),Ic=e0();function e0(){return 2**++E1t}const YF=Object.freeze(Object.defineProperty({__proto__:null,boolean:hi,booleanish:To,commaOrSpaceSeparated:Ic,commaSeparated:ux,number:Ut,overloadedBoolean:XF,spaceSeparated:Zr},Symbol.toStringTag,{value:"Module"})),T5=Object.keys(YF);class Az extends pc{constructor(t,n,i,r){let s=-1;if(super(t,n),ZJ(this,"space",r),typeof i=="number")for(;++s4&&n.slice(0,4)==="data"&&j1t.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(JJ,R1t);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!JJ.test(s)){let o=s.replace(_1t,N1t);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=Az}return new r(i,t)}function N1t(e){return"-"+e.toLowerCase()}function R1t(e){return e.charAt(1).toUpperCase()}const UC=sIe([oIe,C1t,cIe,uIe,dIe],"html"),Pg=sIe([oIe,T1t,cIe,uIe,dIe],"svg");function eee(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fIe(e){return e.join(" ").trim()}var _z={},tee=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,I1t=/\n/g,P1t=/^\s*/,D1t=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,M1t=/^:\s*/,L1t=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,$1t=/^[;\s]*/,F1t=/^\s+|\s+$/g,B1t=` +`,nee="/",iee="*",kb="",U1t="comment",Q1t="declaration";function z1t(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function r(g){var b=g.match(I1t);b&&(n+=b.length);var v=g.lastIndexOf(B1t);i=~v?g.length-v:i+g.length}function s(){var g={line:n,column:i};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:i},this.source=t.source}o.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+i+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=i,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var v=b[0];return r(v),e=e.slice(v.length),b}}function u(){c(P1t)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=s();if(!(nee!=e.charAt(0)||iee!=e.charAt(1))){for(var b=2;kb!=e.charAt(b)&&(iee!=e.charAt(b)||nee!=e.charAt(b+1));)++b;if(b+=2,kb===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return i+=2,r(v),e=e.slice(b),i+=2,g({type:U1t,comment:v})}}function h(){var g=s(),b=c(D1t);if(b){if(f(),!c(M1t))return l("property missing ':'");var v=c(L1t),y=g({type:Q1t,property:ree(b[0].replace(tee,kb)),value:v?ree(v[0].replace(tee,kb)):kb});return c($1t),y}}function m(){var g=[];d(g);for(var b;b=h();)b!==!1&&(g.push(b),d(g));return g}return u(),m()}function ree(e){return e?e.replace(F1t,kb):kb}var V1t=z1t,H1t=ym&&ym.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_z,"__esModule",{value:!0});_z.default=W1t;const q1t=H1t(V1t);function W1t(e,t){let n=null;if(!e||typeof e!="string")return n;const i=(0,q1t.default)(e),r=typeof t=="function";return i.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;r?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var DP={};Object.defineProperty(DP,"__esModule",{value:!0});DP.camelCase=void 0;var K1t=/^--[a-zA-Z0-9_-]+$/,G1t=/-([a-z])/g,X1t=/^[^-]+$/,Y1t=/^-(webkit|moz|ms|o|khtml)-/,Z1t=/^-(ms)-/,J1t=function(e){return!e||X1t.test(e)||K1t.test(e)},eOt=function(e,t){return t.toUpperCase()},see=function(e,t){return"".concat(t,"-")},tOt=function(e,t){return t===void 0&&(t={}),J1t(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Z1t,see):e=e.replace(Y1t,see),e.replace(G1t,eOt))};DP.camelCase=tOt;var nOt=ym&&ym.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},iOt=nOt(_z),rOt=DP;function ZF(e,t){var n={};return!e||typeof e!="string"||(0,iOt.default)(e,function(i,r){i&&r&&(n[(0,rOt.camelCase)(i,t)]=r)}),n}ZF.default=ZF;var sOt=ZF;const oOt=Ew(sOt),MP=hIe("end"),Vf=hIe("start");function hIe(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function aOt(e){const t=Vf(e),n=MP(e);if(t&&n)return{start:t,end:n}}function Qk(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?oee(e.position):"start"in e||"end"in e?oee(e):"line"in e||"column"in e?JF(e):""}function JF(e){return aee(e&&e.line)+":"+aee(e&&e.column)}function oee(e){return JF(e&&e.start)+"-"+JF(e&&e.end)}function aee(e){return e&&typeof e=="number"?e:1}class al extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let r="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?r=t:!s.cause&&t&&(o=!0,r=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){const c=i.indexOf(":");c===-1?s.ruleId=i:(s.source=i.slice(0,c),s.ruleId=i.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=l?l.line:void 0,this.name=Qk(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}al.prototype.file="";al.prototype.name="";al.prototype.reason="";al.prototype.message="";al.prototype.stack="";al.prototype.column=void 0;al.prototype.line=void 0;al.prototype.ancestors=void 0;al.prototype.cause=void 0;al.prototype.fatal=void 0;al.prototype.place=void 0;al.prototype.ruleId=void 0;al.prototype.source=void 0;const jz={}.hasOwnProperty,lOt=new Map,cOt=/[A-Z]/g,uOt=new Set(["table","tbody","thead","tfoot","tr"]),dOt=new Set(["td","th"]),pIe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fOt(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=xOt(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=vOt(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Pg:UC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=mIe(r,e,void 0);return s&&typeof s!="string"?s:r.create(e,r.Fragment,{children:s||void 0},void 0)}function mIe(e,t,n){if(t.type==="element")return hOt(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pOt(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gOt(e,t,n);if(t.type==="mdxjsEsm")return mOt(e,t);if(t.type==="root")return bOt(e,t,n);if(t.type==="text")return yOt(e,t)}function hOt(e,t,n){const i=e.schema;let r=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(r=Pg,e.schema=r),e.ancestors.push(t);const s=bIe(e,t.tagName,!1),o=wOt(e,t);let l=Rz(e,t);return uOt.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!S1t(c):!0})),gIe(e,o,s,t),Nz(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function pOt(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}aE(e,t.position)}function mOt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);aE(e,t.position)}function gOt(e,t,n){const i=e.schema;let r=i;t.name==="svg"&&i.space==="html"&&(r=Pg,e.schema=r),e.ancestors.push(t);const s=t.name===null?e.Fragment:bIe(e,t.name,!0),o=OOt(e,t),l=Rz(e,t);return gIe(e,o,s,t),Nz(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function bOt(e,t,n){const i={};return Nz(i,Rz(e,t)),e.create(t,e.Fragment,i,n)}function yOt(e,t){return t.value}function gIe(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Nz(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vOt(e,t,n){return i;function i(r,s,o,l){const u=Array.isArray(o.children)?n:t;return l?u(s,o,l):u(s,o)}}function xOt(e,t){return n;function n(i,r,s,o){const l=Array.isArray(s.children),c=Vf(i);return t(r,s,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function wOt(e,t){const n={};let i,r;for(r in t.properties)if(r!=="children"&&jz.call(t.properties,r)){const s=kOt(e,r,t.properties[r]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&dOt.has(t.tagName)?i=l:n[o]=l}}if(i){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function OOt(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const s=i.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else aE(e,t.position);else{const r=i.name;let s;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else aE(e,t.position);else s=i.value===null?!0:i.value;n[r]=s}return n}function Rz(e,t){const n=[];let i=-1;const r=e.passKeys?new Map:lOt;for(;++ir?0:r+t:t=t>r?r:t,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(tu(e,e.length,0,t),e):t}const uee={}.hasOwnProperty;function vIe(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Td(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kl=Dg(/[A-Za-z]/),il=Dg(/[\dA-Za-z]/),ROt=Dg(/[#-'*+\--9=?A-Z^-~]/);function UN(e){return e!==null&&(e<32||e===127)}const e8=Dg(/\d/),IOt=Dg(/[\dA-Fa-f]/),POt=Dg(/[!-/:-@[-`{-~]/);function Dn(e){return e!==null&&e<-2}function Vr(e){return e!==null&&(e<0||e===32)}function Mi(e){return e===-2||e===-1||e===32}const LP=Dg(new RegExp("\\p{P}|\\p{S}","u")),ky=Dg(/\s/);function Dg(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function e1(e){const t=[];let n=-1,i=0,r=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),r=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(i)}function tr(e,t,n,i){const r=i?i-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Mi(c)?(e.enter(n),l(c)):t(c)}function l(c){return Mi(c)&&s++o))return;const C=t.events.length;let E=C,R,_;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(R){_=t.events[E][1].end;break}R=!0}for(y(i),k=C;kw;){const S=n[O];t.containerState=S[1],S[0].exit.call(t,e)}n.length=w}function x(){r.write([null]),s=void 0,r=void 0,t.containerState._closeFlow=void 0}}function FOt(e,t,n){return tr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function aw(e){if(e===null||Vr(e)||ky(e))return 1;if(LP(e))return 2}function $P(e,t,n){const i=[];let r=-1;for(;++r1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[i][1].end},h={...e[n][1].start};fee(f,-c),fee(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},r={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[i][1].end={...o.start},e[n][1].start={...l.end},u=[],e[i][1].end.offset-e[i][1].start.offset&&(u=Su(u,[["enter",e[i][1],t],["exit",e[i][1],t]])),u=Su(u,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Su(u,$P(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),u=Su(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Su(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,tu(e,i-1,n-i+3,u),n=i+u.length-d-2;break}}for(n=-1;++n0&&Mi(k)?tr(e,x,"linePrefix",s+1)(k):x(k)}function x(k){return k===null||Dn(k)?e.check(hee,b,O)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||Dn(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),w)}function O(k){return e.exit("codeFenced"),t(k)}function S(k,C,E){let R=0;return _;function _(P){return k.enter("lineEnding"),k.consume(P),k.exit("lineEnding"),j}function j(P){return k.enter("codeFencedFence"),Mi(P)?tr(k,T,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):T(P)}function T(P){return P===l?(k.enter("codeFencedFenceSequence"),N(P)):E(P)}function N(P){return P===l?(R++,k.consume(P),N):R>=o?(k.exit("codeFencedFenceSequence"),Mi(P)?tr(k,A,"whitespace")(P):A(P)):E(P)}function A(P){return P===null||Dn(P)?(k.exit("codeFencedFence"),C(P)):E(P)}}}function YOt(e,t,n){const i=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const _5={name:"codeIndented",tokenize:JOt},ZOt={partial:!0,tokenize:ekt};function JOt(e,t,n){const i=this;return r;function r(u){return e.enter("codeIndented"),tr(e,s,"linePrefix",5)(u)}function s(u){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Dn(u)?e.attempt(ZOt,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Dn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function ekt(e,t,n){const i=this;return r;function r(o){return i.parser.lazy[i.now().line]?n(o):Dn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):tr(e,s,"linePrefix",5)(o)}function s(o){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Dn(o)?r(o):n(o)}}const tkt={name:"codeText",previous:ikt,resolve:nkt,tokenize:rkt};function nkt(e){let t=e.length-4,n=3,i,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const r=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&oO(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),oO(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),oO(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(i.parser.constructs.flow,n,t)(o)}}function EIe(e,t,n,i,r,s,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(i),e.enter(r),e.enter(s),e.consume(y),e.exit(s),h):y===null||y===32||y===41||UN(y)?n(y):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),e.exit(i),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||Dn(y)?n(y):(e.consume(y),y===92?g:m)}function g(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function b(y){return!d&&(y===null||y===41||Vr(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),t(y)):d999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(s),e.enter(r),e.consume(m),e.exit(r),e.exit(i),t):Dn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||Dn(m)||l++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!Mi(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(e.consume(m),l++,f):f(m)}}function TIe(e,t,n,i,r,s){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(r),e.consume(h),e.exit(r),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(r),e.consume(h),e.exit(r),e.exit(i),t):(e.enter(s),u(h))}function u(h){return h===o?(e.exit(s),c(o)):h===null?n(h):Dn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),tr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||Dn(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===o||h===92?(e.consume(h),d):d(h)}}function zk(e,t){let n;return i;function i(r){return Dn(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,i):Mi(r)?tr(e,i,n?"linePrefix":"lineSuffix")(r):t(r)}}const fkt={name:"definition",tokenize:pkt},hkt={partial:!0,tokenize:mkt};function pkt(e,t,n){const i=this;let r;return s;function s(m){return e.enter("definition"),o(m)}function o(m){return CIe.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return r=Td(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return Vr(m)?zk(e,u)(m):u(m)}function u(m){return EIe(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(hkt,f,f)(m)}function f(m){return Mi(m)?tr(e,h,"whitespace")(m):h(m)}function h(m){return m===null||Dn(m)?(e.exit("definition"),i.parser.defined.push(r),t(m)):n(m)}}function mkt(e,t,n){return i;function i(l){return Vr(l)?zk(e,r)(l):n(l)}function r(l){return TIe(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Mi(l)?tr(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Dn(l)?t(l):n(l)}}const gkt={name:"hardBreakEscape",tokenize:bkt};function bkt(e,t,n){return i;function i(s){return e.enter("hardBreakEscape"),e.consume(s),r}function r(s){return Dn(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const ykt={name:"headingAtx",resolve:vkt,tokenize:xkt};function vkt(e,t){let n=e.length-2,i=3,r,s;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},s={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},tu(e,i,n-i+1,[["enter",r,t],["enter",s,t],["exit",s,t],["exit",r,t]])),e}function xkt(e,t,n){let i=0;return r;function r(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&i++<6?(e.consume(d),o):d===null||Vr(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Dn(d)?(e.exit("atxHeading"),t(d)):Mi(d)?tr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Vr(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const wkt=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],mee=["pre","script","style","textarea"],Okt={concrete:!0,name:"htmlFlow",resolveTo:Ekt,tokenize:Ckt},kkt={partial:!0,tokenize:Akt},Skt={partial:!0,tokenize:Tkt};function Ekt(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ckt(e,t,n){const i=this;let r,s,o,l,c;return u;function u(F){return d(F)}function d(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),f}function f(F){return F===33?(e.consume(F),h):F===47?(e.consume(F),s=!0,b):F===63?(e.consume(F),r=3,i.interrupt?t:I):kl(F)?(e.consume(F),o=String.fromCharCode(F),v):n(F)}function h(F){return F===45?(e.consume(F),r=2,m):F===91?(e.consume(F),r=5,l=0,g):kl(F)?(e.consume(F),r=4,i.interrupt?t:I):n(F)}function m(F){return F===45?(e.consume(F),i.interrupt?t:I):n(F)}function g(F){const W="CDATA[";return F===W.charCodeAt(l++)?(e.consume(F),l===W.length?i.interrupt?t:T:g):n(F)}function b(F){return kl(F)?(e.consume(F),o=String.fromCharCode(F),v):n(F)}function v(F){if(F===null||F===47||F===62||Vr(F)){const W=F===47,V=o.toLowerCase();return!W&&!s&&mee.includes(V)?(r=1,i.interrupt?t(F):T(F)):wkt.includes(o.toLowerCase())?(r=6,W?(e.consume(F),y):i.interrupt?t(F):T(F)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(F):s?x(F):w(F))}return F===45||il(F)?(e.consume(F),o+=String.fromCharCode(F),v):n(F)}function y(F){return F===62?(e.consume(F),i.interrupt?t:T):n(F)}function x(F){return Mi(F)?(e.consume(F),x):_(F)}function w(F){return F===47?(e.consume(F),_):F===58||F===95||kl(F)?(e.consume(F),O):Mi(F)?(e.consume(F),w):_(F)}function O(F){return F===45||F===46||F===58||F===95||il(F)?(e.consume(F),O):S(F)}function S(F){return F===61?(e.consume(F),k):Mi(F)?(e.consume(F),S):w(F)}function k(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),c=F,C):Mi(F)?(e.consume(F),k):E(F)}function C(F){return F===c?(e.consume(F),c=null,R):F===null||Dn(F)?n(F):(e.consume(F),C)}function E(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vr(F)?S(F):(e.consume(F),E)}function R(F){return F===47||F===62||Mi(F)?w(F):n(F)}function _(F){return F===62?(e.consume(F),j):n(F)}function j(F){return F===null||Dn(F)?T(F):Mi(F)?(e.consume(F),j):n(F)}function T(F){return F===45&&r===2?(e.consume(F),D):F===60&&r===1?(e.consume(F),M):F===62&&r===4?(e.consume(F),H):F===63&&r===3?(e.consume(F),I):F===93&&r===5?(e.consume(F),U):Dn(F)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(kkt,K,N)(F)):F===null||Dn(F)?(e.exit("htmlFlowData"),N(F)):(e.consume(F),T)}function N(F){return e.check(Skt,A,K)(F)}function A(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),P}function P(F){return F===null||Dn(F)?N(F):(e.enter("htmlFlowData"),T(F))}function D(F){return F===45?(e.consume(F),I):T(F)}function M(F){return F===47?(e.consume(F),o="",L):T(F)}function L(F){if(F===62){const W=o.toLowerCase();return mee.includes(W)?(e.consume(F),H):T(F)}return kl(F)&&o.length<8?(e.consume(F),o+=String.fromCharCode(F),L):T(F)}function U(F){return F===93?(e.consume(F),I):T(F)}function I(F){return F===62?(e.consume(F),H):F===45&&r===2?(e.consume(F),I):T(F)}function H(F){return F===null||Dn(F)?(e.exit("htmlFlowData"),K(F)):(e.consume(F),H)}function K(F){return e.exit("htmlFlow"),t(F)}}function Tkt(e,t,n){const i=this;return r;function r(o){return Dn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function Akt(e,t,n){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(QC,t,n)}}const _kt={name:"htmlText",tokenize:jkt};function jkt(e,t,n){const i=this;let r,s,o;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),S):I===63?(e.consume(I),w):kl(I)?(e.consume(I),E):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,g):kl(I)?(e.consume(I),x):n(I)}function d(I){return I===45?(e.consume(I),m):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Dn(I)?(o=f,M(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),m):f(I)}function m(I){return I===62?D(I):I===45?h(I):f(I)}function g(I){const H="CDATA[";return I===H.charCodeAt(s++)?(e.consume(I),s===H.length?b:g):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),v):Dn(I)?(o=b,M(I)):(e.consume(I),b)}function v(I){return I===93?(e.consume(I),y):b(I)}function y(I){return I===62?D(I):I===93?(e.consume(I),y):b(I)}function x(I){return I===null||I===62?D(I):Dn(I)?(o=x,M(I)):(e.consume(I),x)}function w(I){return I===null?n(I):I===63?(e.consume(I),O):Dn(I)?(o=w,M(I)):(e.consume(I),w)}function O(I){return I===62?D(I):w(I)}function S(I){return kl(I)?(e.consume(I),k):n(I)}function k(I){return I===45||il(I)?(e.consume(I),k):C(I)}function C(I){return Dn(I)?(o=C,M(I)):Mi(I)?(e.consume(I),C):D(I)}function E(I){return I===45||il(I)?(e.consume(I),E):I===47||I===62||Vr(I)?R(I):n(I)}function R(I){return I===47?(e.consume(I),D):I===58||I===95||kl(I)?(e.consume(I),_):Dn(I)?(o=R,M(I)):Mi(I)?(e.consume(I),R):D(I)}function _(I){return I===45||I===46||I===58||I===95||il(I)?(e.consume(I),_):j(I)}function j(I){return I===61?(e.consume(I),T):Dn(I)?(o=j,M(I)):Mi(I)?(e.consume(I),j):R(I)}function T(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),r=I,N):Dn(I)?(o=T,M(I)):Mi(I)?(e.consume(I),T):(e.consume(I),A)}function N(I){return I===r?(e.consume(I),r=void 0,P):I===null?n(I):Dn(I)?(o=N,M(I)):(e.consume(I),N)}function A(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Vr(I)?R(I):(e.consume(I),A)}function P(I){return I===47||I===62||Vr(I)?R(I):n(I)}function D(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function M(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),L}function L(I){return Mi(I)?tr(e,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return e.enter("htmlTextData"),o(I)}}const Dz={name:"labelEnd",resolveAll:Pkt,resolveTo:Dkt,tokenize:Mkt},Nkt={tokenize:Lkt},Rkt={tokenize:$kt},Ikt={tokenize:Fkt};function Pkt(e){let t=-1;const n=[];for(;++t=3&&(u===null||Dn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===r?(e.consume(u),i++,c):(e.exit("thematicBreakSequence"),Mi(u)?tr(e,l,"whitespace")(u):l(u))}}const Vl={continuation:{tokenize:Gkt},exit:Ykt,name:"list",tokenize:Kkt},qkt={partial:!0,tokenize:Zkt},Wkt={partial:!0,tokenize:Xkt};function Kkt(e,t,n){const i=this,r=i.events[i.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return l;function l(m){const g=i.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!i.containerState.marker||m===i.containerState.marker:e8(m)){if(i.containerState.type||(i.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(W_,n,u)(m):u(m);if(!i.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return e8(m)&&++o<10?(e.consume(m),c):(!i.interrupt||o<2)&&(i.containerState.marker?m===i.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||m,e.check(QC,i.interrupt?n:d,e.attempt(qkt,h,f))}function d(m){return i.containerState.initialBlankLine=!0,s++,h(m)}function f(m){return Mi(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return i.containerState.size=s+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function Gkt(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(QC,r,s);function r(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,tr(e,t,"listItemIndent",i.containerState.size+1)(l)}function s(l){return i.containerState.furtherBlankLines||!Mi(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(Wkt,t,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,tr(e,e.attempt(Vl,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Xkt(e,t,n){const i=this;return tr(e,r,"listItemIndent",i.containerState.size+1);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(s):n(s)}}function Ykt(e){e.exit(this.containerState.type)}function Zkt(e,t,n){const i=this;return tr(e,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(s){const o=i.events[i.events.length-1];return!Mi(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const gee={name:"setextUnderline",resolveTo:Jkt,tokenize:eSt};function Jkt(e,t){let n=e.length,i,r,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",s?(e.splice(r,0,["enter",o,t]),e.splice(s+1,0,["exit",e[i][1],t]),e[i][1].end={...e[s][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function eSt(e,t,n){const i=this;let r;return s;function s(u){let d=i.events.length,f;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){f=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),r=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===r?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Mi(u)?tr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Dn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const tSt={tokenize:nSt};function nSt(e){const t=this,n=e.attempt(QC,i,e.attempt(this.parser.constructs.flowInitial,r,tr(e,e.attempt(this.parser.constructs.flow,r,e.attempt(akt,r)),"linePrefix")));return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const iSt={resolveAll:_Ie()},rSt=AIe("string"),sSt=AIe("text");function AIe(e){return{resolveAll:_Ie(e==="text"?oSt:void 0),tokenize:t};function t(n){const i=this,r=this.parser.constructs[e],s=n.attempt(r,o,l);return o;function o(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=r[d];let h=-1;if(f)for(;++h-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}s>0&&o.push(e[r].slice(0,s))}return o}function vSt(e,t){let n=-1;const i=[];let r;for(;++n0){const it=Ce.tokenStack[Ce.tokenStack.length-1];(it[1]||yee).call(Ce,void 0,it[0])}for(ge.position={start:Gp(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Gp(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke0&&(i.className=["language-"+r[0]]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function NSt(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function RSt(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ISt(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),r=e1(i.toLowerCase()),s=e.footnoteOrder.indexOf(i);let o,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(i,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function PSt(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DSt(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function RIe(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const r=e.all(t),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=i:r.push({type:"text",value:i}),r}function MSt(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return RIe(e,t);const r={src:e1(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function LSt(e,t){const n={src:e1(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function $St(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function FSt(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return RIe(e,t);const r={href:e1(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function BSt(e,t){const n={href:e1(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function USt(e,t,n){const i=e.all(t),r=n?QSt(n):IIe(t),s={},o=[];if(typeof t.checked=="boolean"){const d=i[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},i.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l0){const it=Ce.tokenStack[Ce.tokenStack.length-1];(it[1]||yee).call(Ce,void 0,it[0])}for(ge.position={start:Gp(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Gp(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke0&&(i.className=["language-"+r[0]]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function ISt(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PSt(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DSt(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),r=e1(i.toLowerCase()),s=e.footnoteOrder.indexOf(i);let o,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(i,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function MSt(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LSt(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function RIe(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const r=e.all(t),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=i:r.push({type:"text",value:i}),r}function $St(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return RIe(e,t);const r={src:e1(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function FSt(e,t){const n={src:e1(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function BSt(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function USt(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return RIe(e,t);const r={href:e1(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function QSt(e,t){const n={href:e1(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function zSt(e,t,n){const i=e.all(t),r=n?VSt(n):IIe(t),s={},o=[];if(typeof t.checked=="boolean"){const d=i[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},i.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function zSt(e,t){const n={},i=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Vf(t.children[1]),c=MP(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),r.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function KSt(e,t,n){const i=n?n.children:void 0,s=(i?i.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),i[0]),r=i.index+i[0].length,i=n.exec(t);return s.push(wee(t.slice(r),r>0,!1)),s.join("")}function wee(e,t,n){let i=0,r=e.length;if(t){let s=e.codePointAt(i);for(;s===vee||s===xee;)i++,s=e.codePointAt(i)}if(n){let s=e.codePointAt(r-1);for(;s===vee||s===xee;)r--,s=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function YSt(e,t){const n={type:"text",value:XSt(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ZSt(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const JSt={blockquote:ASt,break:_St,code:jSt,delete:NSt,emphasis:RSt,footnoteReference:ISt,heading:PSt,html:DSt,imageReference:MSt,image:LSt,inlineCode:$St,linkReference:FSt,link:BSt,listItem:USt,list:zSt,paragraph:VSt,root:HSt,strong:qSt,table:WSt,tableCell:GSt,tableRow:KSt,text:YSt,thematicBreak:ZSt,toml:VA,yaml:VA,definition:VA,footnoteDefinition:VA};function VA(){}const PIe=-1,FP=0,Vk=1,QN=2,Mz=3,Lz=4,$z=5,Fz=6,DIe=7,MIe=8,eEt=typeof self=="object"?self:globalThis,Oee=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new eEt[e](t)},tEt=(e,t)=>{const n=(r,s)=>(e.set(s,r),r),i=r=>{if(e.has(r))return e.get(r);const[s,o]=t[r];switch(s){case FP:case PIe:return n(o,r);case Vk:{const l=n([],r);for(const c of o)l.push(i(c));return l}case QN:{const l=n({},r);for(const[c,u]of o)l[i(c)]=i(u);return l}case Mz:return n(new Date(o),r);case Lz:{const{source:l,flags:c}=o;return n(new RegExp(l,c),r)}case $z:{const l=n(new Map,r);for(const[c,u]of o)l.set(i(c),i(u));return l}case Fz:{const l=n(new Set,r);for(const c of o)l.add(i(c));return l}case DIe:{const{name:l,message:c}=o;return n(Oee(l,c),r)}case MIe:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Oee(s,o),r)};return i},kee=e=>tEt(new Map,e)(0),U0="",{toString:nEt}={},{keys:iEt}=Object,aO=e=>{const t=typeof e;if(t!=="object"||!e)return[FP,t];const n=nEt.call(e).slice(8,-1);switch(n){case"Array":return[Vk,U0];case"Object":return[QN,U0];case"Date":return[Mz,U0];case"RegExp":return[Lz,U0];case"Map":return[$z,U0];case"Set":return[Fz,U0];case"DataView":return[Vk,n]}return n.includes("Array")?[Vk,n]:n.includes("Error")?[DIe,n]:[QN,n]},HA=([e,t])=>e===FP&&(t==="function"||t==="symbol"),rEt=(e,t,n,i)=>{const r=(o,l)=>{const c=i.push(o)-1;return n.set(l,c),c},s=o=>{if(n.has(o))return n.get(o);let[l,c]=aO(o);switch(l){case FP:{let d=o;switch(c){case"bigint":l=MIe,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([PIe],o)}return r([l,d],o)}case Vk:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),r([c,[...h]],o)}const d=[],f=r([l,d],o);for(const h of o)d.push(s(h));return f}case QN:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],f=r([l,d],o);for(const h of iEt(o))(e||!HA(aO(o[h])))&&d.push([s(h),s(o[h])]);return f}case Mz:return r([l,o.toISOString()],o);case Lz:{const{source:d,flags:f}=o;return r([l,{source:d,flags:f}],o)}case $z:{const d=[],f=r([l,d],o);for(const[h,m]of o)(e||!(HA(aO(h))||HA(aO(m))))&&d.push([s(h),s(m)]);return f}case Fz:{const d=[],f=r([l,d],o);for(const h of o)(e||!HA(aO(h)))&&d.push(s(h));return f}}const{message:u}=o;return r([l,{name:c,message:u}],o)};return s},See=(e,{json:t,lossy:n}={})=>{const i=[];return rEt(!(t||n),!!t,new Map,i)(e),i},lw=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kee(See(e,t)):structuredClone(e):(e,t)=>kee(See(e,t));function sEt(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function oEt(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function aEt(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||sEt,i=e.options.footnoteBackLabel||oEt,r=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&g.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,m);typeof x=="string"&&(x={type:"text",value:x}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(c,m),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...lw(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function VSt(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i1}function HSt(e,t){const n={},i=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Vf(t.children[1]),c=MP(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),r.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function XSt(e,t,n){const i=n?n.children:void 0,s=(i?i.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),i[0]),r=i.index+i[0].length,i=n.exec(t);return s.push(wee(t.slice(r),r>0,!1)),s.join("")}function wee(e,t,n){let i=0,r=e.length;if(t){let s=e.codePointAt(i);for(;s===vee||s===xee;)i++,s=e.codePointAt(i)}if(n){let s=e.codePointAt(r-1);for(;s===vee||s===xee;)r--,s=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function JSt(e,t){const n={type:"text",value:ZSt(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function eEt(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const tEt={blockquote:jSt,break:NSt,code:RSt,delete:ISt,emphasis:PSt,footnoteReference:DSt,heading:MSt,html:LSt,imageReference:$St,image:FSt,inlineCode:BSt,linkReference:USt,link:QSt,listItem:zSt,list:HSt,paragraph:qSt,root:WSt,strong:KSt,table:GSt,tableCell:YSt,tableRow:XSt,text:JSt,thematicBreak:eEt,toml:VA,yaml:VA,definition:VA,footnoteDefinition:VA};function VA(){}const PIe=-1,FP=0,Vk=1,QN=2,Mz=3,Lz=4,$z=5,Fz=6,DIe=7,MIe=8,nEt=typeof self=="object"?self:globalThis,Oee=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new nEt[e](t)},iEt=(e,t)=>{const n=(r,s)=>(e.set(s,r),r),i=r=>{if(e.has(r))return e.get(r);const[s,o]=t[r];switch(s){case FP:case PIe:return n(o,r);case Vk:{const l=n([],r);for(const c of o)l.push(i(c));return l}case QN:{const l=n({},r);for(const[c,u]of o)l[i(c)]=i(u);return l}case Mz:return n(new Date(o),r);case Lz:{const{source:l,flags:c}=o;return n(new RegExp(l,c),r)}case $z:{const l=n(new Map,r);for(const[c,u]of o)l.set(i(c),i(u));return l}case Fz:{const l=n(new Set,r);for(const c of o)l.add(i(c));return l}case DIe:{const{name:l,message:c}=o;return n(Oee(l,c),r)}case MIe:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Oee(s,o),r)};return i},kee=e=>iEt(new Map,e)(0),U0="",{toString:rEt}={},{keys:sEt}=Object,aO=e=>{const t=typeof e;if(t!=="object"||!e)return[FP,t];const n=rEt.call(e).slice(8,-1);switch(n){case"Array":return[Vk,U0];case"Object":return[QN,U0];case"Date":return[Mz,U0];case"RegExp":return[Lz,U0];case"Map":return[$z,U0];case"Set":return[Fz,U0];case"DataView":return[Vk,n]}return n.includes("Array")?[Vk,n]:n.includes("Error")?[DIe,n]:[QN,n]},HA=([e,t])=>e===FP&&(t==="function"||t==="symbol"),oEt=(e,t,n,i)=>{const r=(o,l)=>{const c=i.push(o)-1;return n.set(l,c),c},s=o=>{if(n.has(o))return n.get(o);let[l,c]=aO(o);switch(l){case FP:{let d=o;switch(c){case"bigint":l=MIe,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return r([PIe],o)}return r([l,d],o)}case Vk:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),r([c,[...h]],o)}const d=[],f=r([l,d],o);for(const h of o)d.push(s(h));return f}case QN:{if(c)switch(c){case"BigInt":return r([c,o.toString()],o);case"Boolean":case"Number":case"String":return r([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],f=r([l,d],o);for(const h of sEt(o))(e||!HA(aO(o[h])))&&d.push([s(h),s(o[h])]);return f}case Mz:return r([l,o.toISOString()],o);case Lz:{const{source:d,flags:f}=o;return r([l,{source:d,flags:f}],o)}case $z:{const d=[],f=r([l,d],o);for(const[h,m]of o)(e||!(HA(aO(h))||HA(aO(m))))&&d.push([s(h),s(m)]);return f}case Fz:{const d=[],f=r([l,d],o);for(const h of o)(e||!HA(aO(h)))&&d.push(s(h));return f}}const{message:u}=o;return r([l,{name:c,message:u}],o)};return s},See=(e,{json:t,lossy:n}={})=>{const i=[];return oEt(!(t||n),!!t,new Map,i)(e),i},lw=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kee(See(e,t)):structuredClone(e):(e,t)=>kee(See(e,t));function aEt(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function lEt(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function cEt(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||aEt,i=e.options.footnoteBackLabel||lEt,r=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&g.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,m);typeof x=="string"&&(x={type:"text",value:x}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(c,m),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...lw(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const zC=function(e){if(e==null)return dEt;if(typeof e=="function")return BP(e);if(typeof e=="object")return Array.isArray(e)?lEt(e):cEt(e);if(typeof e=="string")return uEt(e);throw new Error("Expected function, string, or object as test")};function lEt(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let m=LIe,g,b,v;if((!t||s(c,u,d[d.length-1]||void 0))&&(m=mEt(n(c,d)),m[0]===n8))return m;if("children"in c&&c.children){const y=c;if(y.children&&m[0]!==pEt)for(b=(i?y.children.length:-1)+o,v=d.concat(y);b>-1&&b":""))+")"})}return h;function h(){let m=LIe,g,b,v;if((!t||s(c,u,d[d.length-1]||void 0))&&(m=bEt(n(c,d)),m[0]===n8))return m;if("children"in c&&c.children){const y=c;if(y.children&&m[0]!==gEt)for(b=(i?y.children.length:-1)+o,v=d.concat(y);b>-1&&b0&&n.push({type:"text",value:` -`}),n}function Eee(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Cee(e,t){const n=bEt(e,t),i=n.one(e,void 0),r=aEt(n),s=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&s.children.push({type:"text",value:` -`},r),s}function OEt(e,t){return e&&"run"in e?async function(n,i){const r=Cee(n,{file:i,...t});await e.run(r,i)}:function(n,i){return Cee(n,{file:i,...e||t})}}function Tee(e){if(e)throw e}var K_=Object.prototype.hasOwnProperty,FIe=Object.prototype.toString,Aee=Object.defineProperty,_ee=Object.getOwnPropertyDescriptor,jee=function(t){return typeof Array.isArray=="function"?Array.isArray(t):FIe.call(t)==="[object Array]"},Nee=function(t){if(!t||FIe.call(t)!=="[object Object]")return!1;var n=K_.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&K_.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;var r;for(r in t);return typeof r>"u"||K_.call(t,r)},Ree=function(t,n){Aee&&n.name==="__proto__"?Aee(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Iee=function(t,n){if(n==="__proto__")if(K_.call(t,n)){if(_ee)return _ee(t,n).value}else return;return t[n]},kEt=function e(){var t,n,i,r,s,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});co.length;let c;l&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return r(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,r):c instanceof Error?r(c):s(c))}function r(o,...l){n||(n=!0,t(o,...l))}function s(o){r(null,o)}}const af={basename:CEt,dirname:TEt,extname:AEt,join:_Et,sep:"/"};function CEt(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');HC(e);let n=0,i=-1,r=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(s){n=r+1;break}}else i<0&&(s=!0,i=r+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,l=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(s){n=r+1;break}}else o<0&&(s=!0,o=r+1),l>-1&&(e.codePointAt(r)===t.codePointAt(l--)?l<0&&(i=r):(l=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function TEt(e){if(HC(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function AEt(e){HC(e);let t=e.length,n=-1,i=0,r=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){i=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?r<0?r=t:s!==1&&(s=1):r>-1&&(s=-1)}return r<0||n<0||s===0||s===1&&r===n-1&&r===i+1?"":e.slice(r,n)}function _Et(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function NEt(e,t){let n="",i=0,r=-1,s=0,o=-1,l,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",i=0):(n=n.slice(0,c),i=n.length-1-n.lastIndexOf("/")),r=o,s=0;continue}}else if(n.length>0){n="",i=0,r=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),i=o-r-1;r=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function HC(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const REt={cwd:IEt};function IEt(){return"/"}function s8(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PEt(e){if(typeof e=="string")e=new URL(e);else if(!s8(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return DEt(e)}function DEt(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n0){let[m,...g]=d;const b=i[h][1];r8(b)&&r8(m)&&(m=N5(!0,b,m)),i[h]=[u,m,...g]}}}}const FEt=new Bz().freeze();function D5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function M5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function L5(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Dee(e){if(!r8(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mee(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qA(e){return BEt(e)?e:new BIe(e)}function BEt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UEt(e){return typeof e=="string"||QEt(e)}function QEt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zEt="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lee=[],$ee={allowDangerousHtml:!0},VEt=/^(https?|ircs?|mailto|xmpp)$/i,HEt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qEt(e){const t=WEt(e),n=KEt(e);return GEt(t.runSync(t.parse(n),n),e)}function WEt(e){const t=e.rehypePlugins||Lee,n=e.remarkPlugins||Lee,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$ee}:$ee;return FEt().use(TSt).use(n).use(OEt,i).use(t)}function KEt(e){const t=e.children||"",n=new BIe;return typeof t=="string"&&(n.value=t),n}function GEt(e,t){const n=t.allowedElements,i=t.allowElement,r=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||XEt;for(const d of HEt)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+zEt+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),VC(e,u),uOt(e,{Fragment:a.Fragment,components:r,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let m;for(m in A5)if(Object.hasOwn(A5,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],b=A5[m];(b===null||b.includes(d.tagName))&&(d.properties[m]=c(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!m&&i&&typeof f=="number"&&(m=!i(d,f,h)),m&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function XEt(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||i!==-1&&t>i||VEt.test(e.slice(0,t))?e:""}function Fee(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,r=n.indexOf(t);for(;r!==-1;)i++,r=n.indexOf(t,r+t.length);return i}function YEt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ZEt(e,t,n){const r=zC((n||{}).ignore||[]),s=JEt(t);let o=-1;for(;++o0?{type:"text",value:k}:void 0),k===!1?h.lastIndex=O+1:(g!==O&&x.push({type:"text",value:u.value.slice(g,O)}),Array.isArray(k)?x.push(...k):k&&x.push(k),g=O+w[0].length,y=!0),!h.global)break;w=h.exec(u.value)}return y?(g?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const r=Fee(e,"(");let s=Fee(e,")");for(;i!==-1&&r>s;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),s++;return[e,n]}function UIe(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ky(n)||LP(n))&&(!t||n!==47)}QIe.peek=OCt;function pCt(){this.buffer()}function mCt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function gCt(){this.buffer()}function bCt(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function yCt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Td(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vCt(e){this.exit(e)}function xCt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Td(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wCt(e){this.exit(e)}function OCt(){return"["}function QIe(e,t,n,i){const r=n.createTracker(i);let s=r.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=r.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=r.move("]"),s}function kCt(){return{enter:{gfmFootnoteCallString:pCt,gfmFootnoteCall:mCt,gfmFootnoteDefinitionLabelString:gCt,gfmFootnoteDefinition:bCt},exit:{gfmFootnoteCallString:yCt,gfmFootnoteCall:vCt,gfmFootnoteDefinitionLabelString:xCt,gfmFootnoteDefinition:wCt}}}function SCt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QIe},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,r,s,o){const l=s.createTracker(o);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(i),{before:c,after:"]"})),d(),c+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+s.indentLines(s.containerFlow(i,l.current()),t?zIe:ECt))),u(),c}}function ECt(e,t,n){return t===0?e:zIe(e,t,n)}function zIe(e,t,n){return(n?"":" ")+e}const CCt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];VIe.peek=NCt;function TCt(){return{canContainEols:["delete"],enter:{strikethrough:_Ct},exit:{strikethrough:jCt}}}function ACt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:CCt}],handlers:{delete:VIe}}}function _Ct(e){this.enter({type:"delete",children:[]},e)}function jCt(e){this.exit(e)}function VIe(e,t,n,i){const r=n.createTracker(i),s=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),s(),o}function NCt(){return"~"}function RCt(e){return e.length}function ICt(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||RCt,s=[],o=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=w)}b.push(x)}o[d]=b,l[d]=v}let f=-1;if(typeof i=="object"&&"length"in i)for(;++fc[f]&&(c[f]=x),m[f]=x),h[f]=w}o.splice(1,0,h),l.splice(1,0,m),d=-1;const g=[];for(;++d "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),MCt);return r(),o}function MCt(e,t,n){return">"+(n?"":" ")+e}function LCt(e,t){return Qee(e,t.inConstruct,!0)&&!Qee(e,t.notInConstruct,!1)}function Qee(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++io&&(o=s):s=1,r=i+t.length,i=n.indexOf(t,r);return o}function FCt(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function BCt(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function UCt(e,t,n,i){const r=BCt(n),s=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(FCt(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,QCt);return f(),h}const l=n.createTracker(i),c=r.repeat(Math.max($Ct(s,r)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` +`}),n}function Eee(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Cee(e,t){const n=vEt(e,t),i=n.one(e,void 0),r=cEt(n),s=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&s.children.push({type:"text",value:` +`},r),s}function SEt(e,t){return e&&"run"in e?async function(n,i){const r=Cee(n,{file:i,...t});await e.run(r,i)}:function(n,i){return Cee(n,{file:i,...e||t})}}function Tee(e){if(e)throw e}var K_=Object.prototype.hasOwnProperty,FIe=Object.prototype.toString,Aee=Object.defineProperty,_ee=Object.getOwnPropertyDescriptor,jee=function(t){return typeof Array.isArray=="function"?Array.isArray(t):FIe.call(t)==="[object Array]"},Nee=function(t){if(!t||FIe.call(t)!=="[object Object]")return!1;var n=K_.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&K_.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;var r;for(r in t);return typeof r>"u"||K_.call(t,r)},Ree=function(t,n){Aee&&n.name==="__proto__"?Aee(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Iee=function(t,n){if(n==="__proto__")if(K_.call(t,n)){if(_ee)return _ee(t,n).value}else return;return t[n]},EEt=function e(){var t,n,i,r,s,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});co.length;let c;l&&o.push(r);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return r(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,r):c instanceof Error?r(c):s(c))}function r(o,...l){n||(n=!0,t(o,...l))}function s(o){r(null,o)}}const af={basename:AEt,dirname:_Et,extname:jEt,join:NEt,sep:"/"};function AEt(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');HC(e);let n=0,i=-1,r=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(s){n=r+1;break}}else i<0&&(s=!0,i=r+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,l=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(s){n=r+1;break}}else o<0&&(s=!0,o=r+1),l>-1&&(e.codePointAt(r)===t.codePointAt(l--)?l<0&&(i=r):(l=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function _Et(e){if(HC(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function jEt(e){HC(e);let t=e.length,n=-1,i=0,r=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){i=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?r<0?r=t:s!==1&&(s=1):r>-1&&(s=-1)}return r<0||n<0||s===0||s===1&&r===n-1&&r===i+1?"":e.slice(r,n)}function NEt(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function IEt(e,t){let n="",i=0,r=-1,s=0,o=-1,l,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",i=0):(n=n.slice(0,c),i=n.length-1-n.lastIndexOf("/")),r=o,s=0;continue}}else if(n.length>0){n="",i=0,r=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),i=o-r-1;r=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function HC(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const PEt={cwd:DEt};function DEt(){return"/"}function s8(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function MEt(e){if(typeof e=="string")e=new URL(e);else if(!s8(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LEt(e)}function LEt(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n0){let[m,...g]=d;const b=i[h][1];r8(b)&&r8(m)&&(m=N5(!0,b,m)),i[h]=[u,m,...g]}}}}const UEt=new Bz().freeze();function D5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function M5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function L5(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Dee(e){if(!r8(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mee(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qA(e){return QEt(e)?e:new BIe(e)}function QEt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zEt(e){return typeof e=="string"||VEt(e)}function VEt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HEt="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lee=[],$ee={allowDangerousHtml:!0},qEt=/^(https?|ircs?|mailto|xmpp)$/i,WEt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function KEt(e){const t=GEt(e),n=XEt(e);return YEt(t.runSync(t.parse(n),n),e)}function GEt(e){const t=e.rehypePlugins||Lee,n=e.remarkPlugins||Lee,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$ee}:$ee;return UEt().use(_St).use(n).use(SEt,i).use(t)}function XEt(e){const t=e.children||"",n=new BIe;return typeof t=="string"&&(n.value=t),n}function YEt(e,t){const n=t.allowedElements,i=t.allowElement,r=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||ZEt;for(const d of WEt)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+HEt+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),VC(e,u),fOt(e,{Fragment:a.Fragment,components:r,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let m;for(m in A5)if(Object.hasOwn(A5,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],b=A5[m];(b===null||b.includes(d.tagName))&&(d.properties[m]=c(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!m&&i&&typeof f=="number"&&(m=!i(d,f,h)),m&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function ZEt(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||i!==-1&&t>i||qEt.test(e.slice(0,t))?e:""}function Fee(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,r=n.indexOf(t);for(;r!==-1;)i++,r=n.indexOf(t,r+t.length);return i}function JEt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eCt(e,t,n){const r=zC((n||{}).ignore||[]),s=tCt(t);let o=-1;for(;++o0?{type:"text",value:k}:void 0),k===!1?h.lastIndex=O+1:(g!==O&&x.push({type:"text",value:u.value.slice(g,O)}),Array.isArray(k)?x.push(...k):k&&x.push(k),g=O+w[0].length,y=!0),!h.global)break;w=h.exec(u.value)}return y?(g?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const r=Fee(e,"(");let s=Fee(e,")");for(;i!==-1&&r>s;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),s++;return[e,n]}function UIe(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ky(n)||LP(n))&&(!t||n!==47)}QIe.peek=SCt;function gCt(){this.buffer()}function bCt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yCt(){this.buffer()}function vCt(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xCt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Td(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wCt(e){this.exit(e)}function OCt(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Td(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kCt(e){this.exit(e)}function SCt(){return"["}function QIe(e,t,n,i){const r=n.createTracker(i);let s=r.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=r.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=r.move("]"),s}function ECt(){return{enter:{gfmFootnoteCallString:gCt,gfmFootnoteCall:bCt,gfmFootnoteDefinitionLabelString:yCt,gfmFootnoteDefinition:vCt},exit:{gfmFootnoteCallString:xCt,gfmFootnoteCall:wCt,gfmFootnoteDefinitionLabelString:OCt,gfmFootnoteDefinition:kCt}}}function CCt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QIe},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,r,s,o){const l=s.createTracker(o);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(i),{before:c,after:"]"})),d(),c+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+s.indentLines(s.containerFlow(i,l.current()),t?zIe:TCt))),u(),c}}function TCt(e,t,n){return t===0?e:zIe(e,t,n)}function zIe(e,t,n){return(n?"":" ")+e}const ACt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];VIe.peek=ICt;function _Ct(){return{canContainEols:["delete"],enter:{strikethrough:NCt},exit:{strikethrough:RCt}}}function jCt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ACt}],handlers:{delete:VIe}}}function NCt(e){this.enter({type:"delete",children:[]},e)}function RCt(e){this.exit(e)}function VIe(e,t,n,i){const r=n.createTracker(i),s=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),s(),o}function ICt(){return"~"}function PCt(e){return e.length}function DCt(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||PCt,s=[],o=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=w)}b.push(x)}o[d]=b,l[d]=v}let f=-1;if(typeof i=="object"&&"length"in i)for(;++fc[f]&&(c[f]=x),m[f]=x),h[f]=w}o.splice(1,0,h),l.splice(1,0,m),d=-1;const g=[];for(;++d "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),$Ct);return r(),o}function $Ct(e,t,n){return">"+(n?"":" ")+e}function FCt(e,t){return Qee(e,t.inConstruct,!0)&&!Qee(e,t.notInConstruct,!1)}function Qee(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++io&&(o=s):s=1,r=i+t.length,i=n.indexOf(t,r);return o}function UCt(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function QCt(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function zCt(e,t,n,i){const r=QCt(n),s=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(UCt(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,VCt);return f(),h}const l=n.createTracker(i),c=r.repeat(Math.max(BCt(s,r)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...l.current()})),f()}return d+=l.move(` `),s&&(d+=l.move(s+` -`)),d+=l.move(c),u(),d}function QCt(e,t,n){return(n?"":" ")+e}function Uz(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function zCt(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(i);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),l()),o(),u}function VCt(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function lE(e){return"&#x"+e.toString(16).toUpperCase()+";"}function zN(e,t,n){const i=aw(e),r=aw(t);return i===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qIe.peek=HCt;function qIe(e,t,n,i){const r=VCt(n),s=n.enter("emphasis"),o=n.createTracker(i),l=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=zN(i.before.charCodeAt(i.before.length-1),u,r);d.inside&&(c=lE(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=zN(i.after.charCodeAt(0),f,r);h.inside&&(c=c.slice(0,-1)+lE(f));const m=o.move(r);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function HCt(e,t,n){return n.options.emphasis||"*"}function qCt(e,t){let n=!1;return VC(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,n8}),!!((!e.depth||e.depth<3)&&Iz(e)&&(t.options.setext||n))}function WCt(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(i);if(qCt(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:` +`)),d+=l.move(c),u(),d}function VCt(e,t,n){return(n?"":" ")+e}function Uz(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function HCt(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(i);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),l()),o(),u}function qCt(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function lE(e){return"&#x"+e.toString(16).toUpperCase()+";"}function zN(e,t,n){const i=aw(e),r=aw(t);return i===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qIe.peek=WCt;function qIe(e,t,n,i){const r=qCt(n),s=n.enter("emphasis"),o=n.createTracker(i),l=o.move(r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=zN(i.before.charCodeAt(i.before.length-1),u,r);d.inside&&(c=lE(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=zN(i.after.charCodeAt(0),f,r);h.inside&&(c=c.slice(0,-1)+lE(f));const m=o.move(r);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function WCt(e,t,n){return n.options.emphasis||"*"}function KCt(e,t){let n=!1;return VC(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,n8}),!!((!e.depth||e.depth<3)&&Iz(e)&&(t.options.setext||n))}function GCt(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(i);if(KCt(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:` `,after:` `});return f(),d(),h+` `+(r===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const o="#".repeat(r),l=n.enter("headingAtx"),c=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...s.current()});return/^[\t ]/.test(u)&&(u=lE(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}WIe.peek=KCt;function WIe(e){return e.value||""}function KCt(){return"<"}KIe.peek=GCt;function KIe(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(i);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),l()),u+=c.move(")"),o(),u}function GCt(){return"!"}GIe.peek=XCt;function GIe(e,t,n,i){const r=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(i);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,s(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function XCt(){return"!"}XIe.peek=YCt;function XIe(e,t,n){let i=e.value||"",r="`",s=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++s\u007F]/.test(e.url))}ZIe.peek=ZCt;function ZIe(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.createTracker(i);let l,c;if(YIe(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=o.move(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),l(),u}function ZCt(e,t,n){return YIe(e,n)?"<":"["}JIe.peek=JCt;function JIe(e,t,n,i){const r=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(i);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,s(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function JCt(){return"["}function Qz(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function eTt(e){const t=Qz(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function tTt(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ePe(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function nTt(e,t,n,i){const r=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?tTt(n):Qz(n);const l=e.ordered?o==="."?")":".":eTt(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ePe(n)===o&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(i);l.move(s+" ".repeat(o-s.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,m){return h?(m?"":" ".repeat(o))+f:(m?s:s+" ".repeat(o-s.length))+f}}function sTt(e,t,n,i){const r=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,i);return s(),r(),o}const oTt=zC(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aTt(e,t,n,i){return(e.children.some(function(o){return oTt(o)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function lTt(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tPe.peek=cTt;function tPe(e,t,n,i){const r=lTt(n),s=n.enter("strong"),o=n.createTracker(i),l=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=zN(i.before.charCodeAt(i.before.length-1),u,r);d.inside&&(c=lE(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=zN(i.after.charCodeAt(0),f,r);h.inside&&(c=c.slice(0,-1)+lE(f));const m=o.move(r+r);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function cTt(e,t,n){return n.options.strong||"*"}function uTt(e,t,n,i){return n.safe(e.value,i)}function dTt(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function fTt(e,t,n){const i=(ePe(n)+(n.options.ruleSpaces?" ":"")).repeat(dTt(n));return n.options.ruleSpaces?i.slice(0,-1):i}const nPe={blockquote:DCt,break:zee,code:UCt,definition:zCt,emphasis:qIe,hardBreak:zee,heading:WCt,html:WIe,image:KIe,imageReference:GIe,inlineCode:XIe,link:ZIe,linkReference:JIe,list:nTt,listItem:rTt,paragraph:sTt,root:aTt,strong:tPe,text:uTt,thematicBreak:fTt};function hTt(){return{enter:{table:pTt,tableData:Vee,tableHeader:Vee,tableRow:gTt},exit:{codeText:bTt,table:mTt,tableData:U5,tableHeader:U5,tableRow:U5}}}function pTt(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function mTt(e){this.exit(e),this.data.inTable=void 0}function gTt(e){this.enter({type:"tableRow",children:[]},e)}function U5(e){this.exit(e)}function Vee(e){this.enter({type:"tableCell",children:[]},e)}function bTt(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yTt));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function yTt(e,t){return t==="|"?t:e}function vTt(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,r=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...s.current()});return/^[\t ]/.test(u)&&(u=lE(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}WIe.peek=XCt;function WIe(e){return e.value||""}function XCt(){return"<"}KIe.peek=YCt;function KIe(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(i);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+r),u+=c.move(n.safe(e.title,{before:u,after:r,...c.current()})),u+=c.move(r),l()),u+=c.move(")"),o(),u}function YCt(){return"!"}GIe.peek=ZCt;function GIe(e,t,n,i){const r=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(i);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,s(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ZCt(){return"!"}XIe.peek=JCt;function XIe(e,t,n){let i=e.value||"",r="`",s=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++s\u007F]/.test(e.url))}ZIe.peek=eTt;function ZIe(e,t,n,i){const r=Uz(n),s=r==='"'?"Quote":"Apostrophe",o=n.createTracker(i);let l,c;if(YIe(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=o.move(" "+r),u+=o.move(n.safe(e.title,{before:u,after:r,...o.current()})),u+=o.move(r),c()),u+=o.move(")"),l(),u}function eTt(e,t,n){return YIe(e,n)?"<":"["}JIe.peek=tTt;function JIe(e,t,n,i){const r=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(i);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,s(),r==="full"||!u||u!==f?c+=l.move(f+"]"):r==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function tTt(){return"["}function Qz(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function nTt(e){const t=Qz(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function iTt(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ePe(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function rTt(e,t,n,i){const r=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?iTt(n):Qz(n);const l=e.ordered?o==="."?")":".":nTt(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ePe(n)===o&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(i);l.move(s+" ".repeat(o-s.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,m){return h?(m?"":" ".repeat(o))+f:(m?s:s+" ".repeat(o-s.length))+f}}function aTt(e,t,n,i){const r=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,i);return s(),r(),o}const lTt=zC(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function cTt(e,t,n,i){return(e.children.some(function(o){return lTt(o)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function uTt(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tPe.peek=dTt;function tPe(e,t,n,i){const r=uTt(n),s=n.enter("strong"),o=n.createTracker(i),l=o.move(r+r);let c=o.move(n.containerPhrasing(e,{after:r,before:l,...o.current()}));const u=c.charCodeAt(0),d=zN(i.before.charCodeAt(i.before.length-1),u,r);d.inside&&(c=lE(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=zN(i.after.charCodeAt(0),f,r);h.inside&&(c=c.slice(0,-1)+lE(f));const m=o.move(r+r);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function dTt(e,t,n){return n.options.strong||"*"}function fTt(e,t,n,i){return n.safe(e.value,i)}function hTt(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function pTt(e,t,n){const i=(ePe(n)+(n.options.ruleSpaces?" ":"")).repeat(hTt(n));return n.options.ruleSpaces?i.slice(0,-1):i}const nPe={blockquote:LCt,break:zee,code:zCt,definition:HCt,emphasis:qIe,hardBreak:zee,heading:GCt,html:WIe,image:KIe,imageReference:GIe,inlineCode:XIe,link:ZIe,linkReference:JIe,list:rTt,listItem:oTt,paragraph:aTt,root:cTt,strong:tPe,text:fTt,thematicBreak:pTt};function mTt(){return{enter:{table:gTt,tableData:Vee,tableHeader:Vee,tableRow:yTt},exit:{codeText:vTt,table:bTt,tableData:U5,tableHeader:U5,tableRow:U5}}}function gTt(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function bTt(e){this.exit(e),this.data.inTable=void 0}function yTt(e){this.enter({type:"tableRow",children:[]},e)}function U5(e){this.exit(e)}function Vee(e){this.enter({type:"tableCell",children:[]},e)}function vTt(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,xTt));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function xTt(e,t){return t==="|"?t:e}function wTt(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,r=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(m,g,b,v){return u(d(m,b,v),m.align)}function l(m,g,b,v){const y=f(m,b,v),x=u([y]);return x.slice(0,x.indexOf(` -`))}function c(m,g,b,v){const y=b.enter("tableCell"),x=b.enter("phrasing"),w=b.containerPhrasing(m,{...v,before:s,after:s});return x(),y(),w}function u(m,g){return ICt(m,{align:g,alignDelimiters:i,padding:n,stringLength:r})}function d(m,g,b){const v=m.children;let y=-1;const x=[],w=g.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const LTt={tokenize:HTt,partial:!0};function $Tt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QTt,continuation:{tokenize:zTt},exit:VTt}},text:{91:{name:"gfmFootnoteCall",tokenize:UTt},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:FTt,resolveTo:BTt}}}}function FTt(e,t,n){const i=this;let r=i.events.length;const s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;r--;){const c=i.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Td(i.sliceSerialize({start:o.end,end:i.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function BTt(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function UTt(e,t,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!o||f===null||f===91||Vr(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return r.includes(Td(i.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Vr(f)||(o=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function QTt(e,t,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Vr(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return s=Td(i.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Vr(g)||(l=!0),o++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),r.includes(s)||r.push(s),tr(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function zTt(e,t,n){return e.check(QC,t,e.attempt(LTt,t,n))}function VTt(e){e.exit("gfmFootnoteDefinition")}function HTt(e,t,n){const i=this;return tr(e,r,"gfmFootnoteDefinitionIndent",5);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function qTt(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:s,resolveAll:r};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function r(o,l){let c=-1;for(;++c1?c(g):(o.consume(g),f++,m);if(f<2&&!n)return c(g);const v=o.exit("strikethroughSequenceTemporary"),y=aw(g);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(g)}}}class WTt{constructor(){this.map=[]}add(t,n,i){KTt(this,t,n,i)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let r=i.pop();for(;r;){for(const s of r)t.push(s);r=i.pop()}this.map.length=0}}function KTt(e,t,n,i){let r=0;if(!(n===0&&i.length===0)){for(;r-1;){const A=i.events[j][1].type;if(A==="lineEnding"||A==="linePrefix")j--;else break}const T=j>-1?i.events[j][1].type:null,N=T==="tableHead"||T==="tableRow"?k:c;return N===k&&i.parser.lazy[i.now().line]?n(_):N(_)}function c(_){return e.enter("tableHead"),e.enter("tableRow"),u(_)}function u(_){return _===124||(o=!0,s+=1),d(_)}function d(_){return _===null?n(_):Dn(_)?s>1?(s=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),m):n(_):Mi(_)?tr(e,d,"whitespace")(_):(s+=1,o&&(o=!1,r+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(_)))}function f(_){return _===null||_===124||Vr(_)?(e.exit("data"),d(_)):(e.consume(_),_===92?h:f)}function h(_){return _===92||_===124?(e.consume(_),f):f(_)}function m(_){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(_):(e.enter("tableDelimiterRow"),o=!1,Mi(_)?tr(e,g,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):g(_))}function g(_){return _===45||_===58?v(_):_===124?(o=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),b):S(_)}function b(_){return Mi(_)?tr(e,v,"whitespace")(_):v(_)}function v(_){return _===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),y):_===45?(s+=1,y(_)):_===null||Dn(_)?O(_):S(_)}function y(_){return _===45?(e.enter("tableDelimiterFiller"),x(_)):S(_)}function x(_){return _===45?(e.consume(_),x):_===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(_))}function w(_){return Mi(_)?tr(e,O,"whitespace")(_):O(_)}function O(_){return _===124?g(_):_===null||Dn(_)?!o||r!==s?S(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):S(_)}function S(_){return n(_)}function k(_){return e.enter("tableRow"),C(_)}function C(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),C):_===null||Dn(_)?(e.exit("tableRow"),t(_)):Mi(_)?tr(e,C,"whitespace")(_):(e.enter("data"),E(_))}function E(_){return _===null||_===124||Vr(_)?(e.exit("data"),C(_)):(e.consume(_),_===92?R:E)}function R(_){return _===92||_===124?(e.consume(_),E):E(_)}}function ZTt(e,t){let n=-1,i=!0,r=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,f;const h=new WTt;for(;++nn[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return r!==void 0&&(s.end=Object.assign({},ov(t.events,r)),e.add(r,0,[["exit",s,t]]),s=void 0),s}function qee(e,t,n,i,r){const s=[],o=ov(t.events,n);r&&(r.end=Object.assign({},o),s.push(["exit",r,t])),i.end=Object.assign({},o),s.push(["exit",i,t]),e.add(n+1,0,s)}function ov(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const JTt={name:"tasklistCheck",tokenize:tAt};function eAt(){return{text:{91:JTt}}}function tAt(e,t,n){const i=this;return r;function r(c){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return Vr(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Dn(c)?t(c):Mi(c)?e.check({tokenize:nAt},t,n)(c):n(c)}}function nAt(e,t,n){return tr(e,i,"whitespace");function i(r){return r===null?n(r):t(r)}}function iAt(e){return vIe([ATt(),$Tt(),qTt(e),XTt(),eAt()])}const rAt={};function sAt(e){const t=this,n=e||rAt,i=t.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(iAt(n)),s.push(STt()),o.push(ETt(n))}const Wee=function(e,t,n){const i=zC(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` -`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function fPe(e,t,n){return e.type==="element"?hAt(e,t,n):e.type==="text"?n.whitespace==="normal"?hPe(e,n):pAt(e):[]}function hAt(e,t,n){const i=pPe(e,n),r=e.children||[];let s=-1,o=[];if(dAt(e))return o;let l,c;for(a8(e)||Yee(e)&&Wee(t,e,Yee)?c=` -`:uAt(e)?(l=2,c=2):dPe(e)&&(l=1,c=1);++s]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",g=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:k.concat([{begin:/\(/,end:/\)/,keywords:O,contains:k.concat(["self"]),relevance:0}]),relevance:0},E={className:"function",begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:O,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"",keywords:O,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function wAt(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=xAt(e),i=n.keywords;return i.type=[...i.type,...t.type],i.literal=[...i.literal,...t.literal],i.built_in=[...i.built_in,...t.built_in],i._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function Hz(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],m=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],O=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:v,built_in:[...x,...w,"set","shopt",...O,...S]},contains:[m,e.SHEBANG(),g,f,s,o,y,l,c,u,d,n]}}function OAt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",o="("+i+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",v={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},w={begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:v,relevance:0},{begin:m,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function kAt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",o="(?!struct)("+i+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",g=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:k.concat([{begin:/\(/,end:/\)/,keywords:O,contains:k.concat(["self"]),relevance:0}]),relevance:0},E={className:"function",begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:O,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"",keywords:O,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function SAt(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],i=["default","false","null","true"],r=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:r.concat(s),built_in:t,literal:i},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},m=e.inherit(h,{illegal:/\n/}),g={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,m]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],m.contains=[v,g,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},w=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",O={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+w+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},O]}}const EAt=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),CAt=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],TAt=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],AAt=[...CAt,...TAt],_At=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),jAt=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),NAt=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),RAt=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function IAt(e){const t=e.regex,n=EAt(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",l=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,i,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+jAt.join("|")+")"},{begin:":(:)?("+NAt.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+RAt.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:_At.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+AAt.join("|")+")\\b"}]}}function PAt(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function DAt(e){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"gPe(e,t,n-1))}function LAt(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",i=n+gPe("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+i+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Zee,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Zee,u]}}const Jee="[A-Za-z$_][0-9A-Za-z$_]*",$At=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],FAt=["true","false","null","undefined","NaN","Infinity"],bPe=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],yPe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],vPe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],BAt=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],UAt=[].concat(vPe,bPe,yPe);function xPe(e){const t=e.regex,n=(L,{after:U})=>{const I="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const I=L[0].length+L.index,H=L.input[I];if(H==="<"||H===","){U.ignoreMatch();return}H===">"&&(n(L,{after:I})||U.ignoreMatch());let K;const F=L.input.substring(I);if(K=F.match(/^\s*=/)){U.ignoreMatch();return}if((K=F.match(/^\s+extends\s+/))&&K.index===0){U.ignoreMatch();return}}},l={$pattern:Jee,keyword:$At,literal:FAt,built_in:UAt,"variable.language":BAt},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,{match:/\$\d+/},f];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(w)});const O=[].concat(x,h.contains),S=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(O)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},C={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...bPe,...yPe]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,T([...vPe,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},A={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,x,{match:/\$\d+/},f,E,{scope:"attr",match:i+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},N,j,C,P,{match:/\$[(.]/}]}}function wPe(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var lv="[0-9](_*[0-9])*",XA=`\\.(${lv})`,YA="[0-9a-fA-F](_*[0-9a-fA-F])*",QAt={className:"number",variants:[{begin:`(\\b(${lv})((${XA})|\\.)?|(${XA}))[eE][+-]?(${lv})[fFdD]?\\b`},{begin:`\\b(${lv})((${XA})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${XA})[fFdD]?\\b`},{begin:`\\b(${lv})[fFdD]\\b`},{begin:`\\b0[xX]((${YA})\\.?|(${YA})?\\.(${YA}))[pP][+-]?(${lv})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${YA})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function zAt(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},i={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,r]}]};r.contains.push(o);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},u=QAt,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,i,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,o,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const VAt=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),HAt=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],qAt=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],WAt=[...HAt,...qAt],KAt=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),OPe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),kPe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),GAt=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),XAt=OPe.concat(kPe).sort().reverse();function YAt(e){const t=VAt(e),n=XAt,i="and or not only",r="[\\w-]+",s="("+r+"|@\\{"+r+"\\})",o=[],l=[],c=function(w){return{className:"string",begin:"~?"+w+".*?"+w}},u=function(w,O,S){return{className:w,begin:O,relevance:S}},d={$pattern:/[a-z-]+/,keyword:i,attribute:KAt.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+r,10),u("variable","@\\{"+r+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:o}),m={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},g={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+GAt.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,u("keyword","all\\b"),u("variable","@\\{"+r+"\\}"),{begin:"\\b("+WAt.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+OPe.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+kPe.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,g,y,m,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function ZAt(e){const t="\\[=*\\[",n="\\]=*\\]",i={begin:t,end:n,contains:["self"]},r=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[i],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:r.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:r}].concat(r)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[i],relevance:5}])}}function SPe(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let m=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(m)}),m=m.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:m},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:m}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:m,end:"$"},r,i,c,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function JAt(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function e2t(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],i=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},o={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,s,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,i)},m=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,i),g=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:m("(?:m|qr)?",/\//,/\//)},{begin:m("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:m("m|qr",/\(/,/\)/)},{begin:m("m|qr",/\[/,/\]/)},{begin:m("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=g,o.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:g}}function t2t(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,i=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+i},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(A,P)=>{P.data._beginMatch=A[1]||A[2]},"on:end":(A,P)=>{P.data._beginMatch!==A[1]&&P.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ -]`,g={scope:"string",variants:[d,u,f,h]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],x=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],O={keyword:y,literal:(A=>{const P=[];return A.forEach(D=>{P.push(D),D.toLowerCase()===D?P.push(D.toUpperCase()):P.push(D.toLowerCase())}),P})(v),built_in:x},S=A=>A.map(P=>P.replace(/\|\d+$/,"")),k={variants:[{match:[/new/,t.concat(m,"+"),t.concat("(?!",S(x).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(i,"\\b(?!\\()"),E={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},_={relevance:0,begin:/\(/,end:/\)/,keywords:O,contains:[R,o,E,e.C_BLOCK_COMMENT_MODE,g,b,k]},j={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(x).join("\\b|"),"\\b)"),i,t.concat(m,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[_]};_.contains.push(j);const T=[R,E,e.C_BLOCK_COMMENT_MODE,g,b,k],N={begin:t.concat(/#\[\s*\\?/,t.either(r,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...T]},...T,{scope:"meta",variants:[{match:r},{match:s}]}]};return{case_insensitive:!1,keywords:O,contains:[N,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},o,j,E,{match:[/const/,/\s/,i],scope:{1:"keyword",3:"variable.constant"}},k,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:O,contains:["self",N,o,E,e.C_BLOCK_COMMENT_MODE,g,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},g,b]}}function n2t(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function i2t(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function CPe(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",m=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${i.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${m}))[eE][+-]?(${h})[jJ]?(?=${g})`},{begin:`(${m})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${h})[jJ](?=${g})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,y,f]}]}}function r2t(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function s2t(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[r,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[s,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function o2t(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",i=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=t.concat(i,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",m="[0-9](_?[0-9])*",g={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${m}))?([eE][+-]?(${m})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},k=[f,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:o},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:i,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},g,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=k,b.contains=k;const _=[{begin:/^\s*=>/,starts:{end:"$",contains:k}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:k}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(_).concat(u).concat(k)}}function a2t(e){const t=e.regex,n=/(r#)?/,i=t.concat(n,e.UNDERSCORE_IDENT_RE),r=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},illegal:""},s]}}const l2t=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),c2t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],u2t=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],d2t=[...c2t,...u2t],f2t=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),h2t=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),p2t=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),m2t=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function g2t(e){const t=l2t(e),n=p2t,i=h2t,r="@[a-z-]+",s="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+d2t.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+i.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+m2t.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:f2t.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function b2t(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function y2t(e){const t=e.regex,n=e.COMMENT("--","$"),i={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],m=d,g=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...m),/\s*\(/),relevance:0,keywords:{built_in:m}};function x(S){return t.concat(/\b/,t.either(...S.map(k=>k.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:x(h),relevance:0};function O(S,{exceptions:k,when:C}={}){const E=C;return k=k||[],S.map(R=>R.match(/\|\d+$/)||k.includes(R)?R:E(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:O(g,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:x(o)},w,y,b,i,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function TPe(e){return e?typeof e=="string"?e:e.source:null}function lO(e){return Nr("(?=",e,")")}function Nr(...e){return e.map(n=>TPe(n)).join("")}function v2t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vl(...e){return"("+(v2t(e).capture?"":"?:")+e.map(i=>TPe(i)).join("|")+")"}const qz=e=>Nr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),x2t=["Protocol","Type"].map(qz),ete=["init","self"].map(qz),w2t=["Any","Self"],Q5=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],tte=["false","nil","true"],O2t=["assignment","associativity","higherThan","left","lowerThan","none","right"],k2t=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],nte=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],APe=vl(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_Pe=vl(APe,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),z5=Nr(APe,_Pe,"*"),jPe=vl(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),VN=vl(jPe,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),sf=Nr(jPe,VN,"*"),ZA=Nr(/[A-Z]/,VN,"*"),S2t=["attached","autoclosure",Nr(/convention\(/,vl("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Nr(/objc\(/,sf,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],E2t=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function C2t(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),i=[e.C_LINE_COMMENT_MODE,n],r={match:[/\./,vl(...x2t,...ete)],className:{2:"keyword"}},s={match:Nr(/\./,vl(...Q5)),relevance:0},o=Q5.filter(Ne=>typeof Ne=="string").concat(["_|0"]),l=Q5.filter(Ne=>typeof Ne!="string").concat(w2t).map(qz),c={variants:[{className:"keyword",match:vl(...l,...ete)}]},u={$pattern:vl(/\b\w+/,/#\w+/),keyword:o.concat(k2t),literal:tte},d=[r,s,c],f={match:Nr(/\./,vl(...nte)),relevance:0},h={className:"built_in",match:Nr(/\b/,vl(...nte),/(?=\()/)},m=[f,h],g={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:z5},{match:`\\.(\\.|${_Pe})+`}]},v=[g,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},O=(Ne="")=>({className:"subst",variants:[{match:Nr(/\\/,Ne,/[0\\tnr"']/)},{match:Nr(/\\/,Ne,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(Ne="")=>({className:"subst",match:Nr(/\\/,Ne,/[\t ]*(?:[\r\n]|\r\n)/)}),k=(Ne="")=>({className:"subst",label:"interpol",begin:Nr(/\\/,Ne,/\(/),end:/\)/}),C=(Ne="")=>({begin:Nr(Ne,/"""/),end:Nr(/"""/,Ne),contains:[O(Ne),S(Ne),k(Ne)]}),E=(Ne="")=>({begin:Nr(Ne,/"/),end:Nr(/"/,Ne),contains:[O(Ne),k(Ne)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),E(),E("#"),E("##"),E("###")]},_=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:_},T=Ne=>{const pe=Nr(Ne,/\//),me=Nr(/\//,Ne);return{begin:pe,end:me,contains:[..._,{scope:"comment",begin:`#(?!.*${me})`,end:/$/}]}},N={scope:"regexp",variants:[T("###"),T("##"),T("#"),j]},A={match:Nr(/`/,sf,/`/)},P={className:"variable",match:/\$\d+/},D={className:"variable",match:`\\$${VN}+`},M=[A,P,D],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:E2t,contains:[...v,w,R]}]}},U={scope:"keyword",match:Nr(/@/,vl(...S2t),lO(vl(/\(/,/\s+/)))},I={scope:"meta",match:Nr(/@/,sf)},H=[L,U,I],K={match:lO(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Nr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,VN,"+")},{className:"type",match:ZA,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Nr(/\s+&\s+/,lO(ZA)),relevance:0}]},F={begin://,keywords:u,contains:[...i,...d,...H,g,K]};K.contains.push(F);const W={match:Nr(sf,/\s*:/),keywords:"_|0",relevance:0},V={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",W,...i,N,...d,...m,...v,w,R,...M,...H,K]},X={begin://,keywords:"repeat each",contains:[...i,K]},ie={begin:vl(lO(Nr(sf,/\s*:/)),lO(Nr(sf,/\s+/,sf,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:sf}]},Q={begin:/\(/,end:/\)/,keywords:u,contains:[ie,...i,...d,...v,w,R,...H,K,V],endsParent:!0,illegal:/["']/},Z={match:[/(func|macro)/,/\s+/,vl(A.match,sf,z5)],className:{1:"keyword",3:"title.function"},contains:[X,Q,t],illegal:[/\[/,/%/]},ce={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,Q,t],illegal:/\[|%/},Ee={match:[/operator/,/\s+/,z5],className:{1:"keyword",3:"title"}},Y={begin:[/precedencegroup/,/\s+/,ZA],className:{1:"keyword",3:"title"},contains:[K],keywords:[...O2t,...tte],end:/}/},G={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},te={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ye={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,sf,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[X,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ZA},...d],relevance:0}]};for(const Ne of R.variants){const pe=Ne.contains.find(se=>se.label==="interpol");pe.keywords=u;const me=[...d,...m,...v,w,R,...M];pe.contains=[...me,{begin:/\(/,end:/\)/,contains:["self",...me]}]}return{name:"Swift",keywords:u,contains:[...i,Z,ce,G,te,ye,Ee,Y,{beginKeywords:"import",end:/$/,contains:[...i],relevance:0},N,...d,...m,...v,w,R,...M,...H,K,V]}}const HN="[A-Za-z$_][0-9A-Za-z$_]*",NPe=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],RPe=["true","false","null","undefined","NaN","Infinity"],IPe=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],PPe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],DPe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],MPe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LPe=[].concat(DPe,IPe,PPe);function T2t(e){const t=e.regex,n=(L,{after:U})=>{const I="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const I=L[0].length+L.index,H=L.input[I];if(H==="<"||H===","){U.ignoreMatch();return}H===">"&&(n(L,{after:I})||U.ignoreMatch());let K;const F=L.input.substring(I);if(K=F.match(/^\s*=/)){U.ignoreMatch();return}if((K=F.match(/^\s+extends\s+/))&&K.index===0){U.ignoreMatch();return}}},l={$pattern:HN,keyword:NPe,literal:RPe,built_in:LPe,"variable.language":MPe},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,{match:/\$\d+/},f];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(w)});const O=[].concat(x,h.contains),S=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(O)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},C={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...IPe,...PPe]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,T([...DPe,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},A={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,x,{match:/\$\d+/},f,E,{scope:"attr",match:i+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},N,j,C,P,{match:/\$[(.]/}]}}function $Pe(e){const t=e.regex,n=T2t(e),i=HN,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:HN,keyword:NPe.concat(c),literal:RPe,built_in:LPe.concat(r),"variable.language":MPe},d={className:"meta",begin:"@"+i},f=(b,v,y)=>{const x=b.contains.findIndex(w=>w.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),m=Object.assign({},h,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([d,s,o,m]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function A2t(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},i={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,r),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(s,r),/ +/,t.either(o,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,i,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function _2t(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),i=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:i},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,r,e.QUOTE_STRING_MODE,c,u,l]}}function j2t(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),i=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(s,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,c,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function FPe(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",i={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},l=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},v=[i,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,b,s,o],y=[...v];return y.pop(),y.push(l),m.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const N2t={arduino:wAt,bash:Hz,c:OAt,cpp:kAt,csharp:SAt,css:IAt,diff:PAt,go:DAt,graphql:MAt,ini:mPe,java:LAt,javascript:xPe,json:wPe,kotlin:zAt,less:YAt,lua:ZAt,makefile:SPe,markdown:EPe,objectivec:JAt,perl:e2t,php:t2t,"php-template":n2t,plaintext:i2t,python:CPe,"python-repl":r2t,r:s2t,ruby:o2t,rust:a2t,scss:g2t,shell:b2t,sql:y2t,swift:C2t,typescript:$Pe,vbnet:A2t,wasm:_2t,xml:j2t,yaml:FPe};function BPe(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],i=typeof n;(i==="object"||i==="function")&&!Object.isFrozen(n)&&BPe(n)}),e}let ite=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function UPe(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Cm(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(i){for(const r in i)n[r]=i[r]}),n}const R2t="",rte=e=>!!e.scope,I2t=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((i,r)=>`${i}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class P2t{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=UPe(t)}openNode(t){if(!rte(t))return;const n=I2t(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){rte(t)&&(this.buffer+=R2t)}value(){return this.buffer}span(t){this.buffer+=``}}const ste=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Wz{constructor(){this.rootNode=ste(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=ste({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(i=>this._walk(t,i)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Wz._collapse(n)}))}}class D2t extends Wz{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const i=t.root;n&&(i.scope=`language:${n}`),this.add(i)}toHTML(){return new P2t(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function cE(e){return e?typeof e=="string"?e:e.source:null}function QPe(e){return n0("(?=",e,")")}function M2t(e){return n0("(?:",e,")*")}function L2t(e){return n0("(?:",e,")?")}function n0(...e){return e.map(n=>cE(n)).join("")}function $2t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Kz(...e){return"("+($2t(e).capture?"":"?:")+e.map(i=>cE(i)).join("|")+")"}function zPe(e){return new RegExp(e.toString()+"|").exec("").length-1}function F2t(e,t){const n=e&&e.exec(t);return n&&n.index===0}const B2t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gz(e,{joinWith:t}){let n=0;return e.map(i=>{n+=1;const r=n;let s=cE(i),o="";for(;s.length>0;){const l=B2t.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&n++)}return o}).map(i=>`(${i})`).join(t)}const U2t=/\b\B/,VPe="[a-zA-Z]\\w*",Xz="[a-zA-Z_]\\w*",HPe="\\b\\d+(\\.\\d+)?",qPe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",WPe="\\b(0b[01]+)",Q2t="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",z2t=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=n0(t,/.*\b/,e.binary,/\b.*/)),Cm({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},uE={begin:"\\\\[\\s\\S]",relevance:0},V2t={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[uE]},H2t={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[uE]},q2t={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},UP=function(e,t,n={}){const i=Cm({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const r=Kz("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:n0(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},W2t=UP("//","$"),K2t=UP("/\\*","\\*/"),G2t=UP("#","$"),X2t={scope:"number",begin:HPe,relevance:0},Y2t={scope:"number",begin:qPe,relevance:0},Z2t={scope:"number",begin:WPe,relevance:0},J2t={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[uE,{begin:/\[/,end:/\]/,relevance:0,contains:[uE]}]},e_t={scope:"title",begin:VPe,relevance:0},t_t={scope:"title",begin:Xz,relevance:0},n_t={begin:"\\.\\s*"+Xz,relevance:0},i_t=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var JA=Object.freeze({__proto__:null,APOS_STRING_MODE:V2t,BACKSLASH_ESCAPE:uE,BINARY_NUMBER_MODE:Z2t,BINARY_NUMBER_RE:WPe,COMMENT:UP,C_BLOCK_COMMENT_MODE:K2t,C_LINE_COMMENT_MODE:W2t,C_NUMBER_MODE:Y2t,C_NUMBER_RE:qPe,END_SAME_AS_BEGIN:i_t,HASH_COMMENT_MODE:G2t,IDENT_RE:VPe,MATCH_NOTHING_RE:U2t,METHOD_GUARD:n_t,NUMBER_MODE:X2t,NUMBER_RE:HPe,PHRASAL_WORDS_MODE:q2t,QUOTE_STRING_MODE:H2t,REGEXP_MODE:J2t,RE_STARTERS_RE:Q2t,SHEBANG:z2t,TITLE_MODE:e_t,UNDERSCORE_IDENT_RE:Xz,UNDERSCORE_TITLE_MODE:t_t});function r_t(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function s_t(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function o_t(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=r_t,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function a_t(e,t){Array.isArray(e.illegal)&&(e.illegal=Kz(...e.illegal))}function l_t(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function c_t(e,t){e.relevance===void 0&&(e.relevance=1)}const u_t=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(i=>{delete e[i]}),e.keywords=n.keywords,e.begin=n0(n.beforeMatch,QPe(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},d_t=["of","and","for","in","not","or","if","then","parent","list","value"],f_t="keyword";function KPe(e,t,n=f_t){const i=Object.create(null);return typeof e=="string"?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach(function(s){Object.assign(i,KPe(e[s],t,s))}),i;function r(s,o){t&&(o=o.map(l=>l.toLowerCase())),o.forEach(function(l){const c=l.split("|");i[c[0]]=[s,h_t(c[0],c[1])]})}}function h_t(e,t){return t?Number(t):p_t(e)?0:1}function p_t(e){return d_t.includes(e.toLowerCase())}const ote={},ey=e=>{console.error(e)},ate=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Q0=(e,t)=>{ote[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),ote[`${e}/${t}`]=!0)},qN=new Error;function GPe(e,t,{key:n}){let i=0;const r=e[n],s={},o={};for(let l=1;l<=t.length;l++)o[l+i]=r[l],s[l+i]=!0,i+=zPe(t[l-1]);e[n]=o,e[n]._emit=s,e[n]._multi=!0}function m_t(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ey("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),qN;if(typeof e.beginScope!="object"||e.beginScope===null)throw ey("beginScope must be object"),qN;GPe(e,e.begin,{key:"beginScope"}),e.begin=Gz(e.begin,{joinWith:""})}}function g_t(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ey("skip, excludeEnd, returnEnd not compatible with endScope: {}"),qN;if(typeof e.endScope!="object"||e.endScope===null)throw ey("endScope must be object"),qN;GPe(e,e.end,{key:"endScope"}),e.end=Gz(e.end,{joinWith:""})}}function b_t(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function y_t(e){b_t(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),m_t(e),g_t(e)}function v_t(e){function t(o,l){return new RegExp(cE(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=zPe(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(Gz(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function r(o){const l=new i;return o.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),o.terminatorEnd&&l.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&l.addRule(o.illegal,{type:"illegal"}),l}function s(o,l){const c=o;if(o.isCompiled)return c;[s_t,l_t,y_t,u_t].forEach(d=>d(o,l)),e.compilerExtensions.forEach(d=>d(o,l)),o.__beforeBegin=null,[o_t,a_t,c_t].forEach(d=>d(o,l)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=KPe(o.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(o.begin||(o.begin=/\B|\b/),c.beginRe=t(c.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(c.endRe=t(c.end)),c.terminatorEnd=cE(c.end)||"",o.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(o.end?"|":"")+l.terminatorEnd)),o.illegal&&(c.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(d){return x_t(d==="self"?o:d)})),o.contains.forEach(function(d){s(d,c)}),o.starts&&s(o.starts,l),c.matcher=r(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Cm(e.classNameAliases||{}),s(e)}function XPe(e){return e?e.endsWithParent||XPe(e.starts):!1}function x_t(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Cm(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:XPe(e)?Cm(e,{starts:e.starts?Cm(e.starts):null}):Object.isFrozen(e)?Cm(e):e}var w_t="11.11.1";class O_t extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const V5=UPe,lte=Cm,cte=Symbol("nomatch"),k_t=7,YPe=function(e){const t=Object.create(null),n=Object.create(null),i=[];let r=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:D2t};function c(D){return l.noHighlightRe.test(D)}function u(D){let M=D.className+" ";M+=D.parentNode?D.parentNode.className:"";const L=l.languageDetectRe.exec(M);if(L){const U=E(L[1]);return U||(ate(s.replace("{}",L[1])),ate("Falling back to no-highlight mode for this block.",D)),U?L[1]:"no-highlight"}return M.split(/\s+/).find(U=>c(U)||E(U))}function d(D,M,L){let U="",I="";typeof M=="object"?(U=D,L=M.ignoreIllegals,I=M.language):(Q0("10.7.0","highlight(lang, code, ...args) has been deprecated."),Q0("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),I=D,U=M),L===void 0&&(L=!0);const H={code:U,language:I};A("before:highlight",H);const K=H.result?H.result:f(H.language,H.code,L);return K.code=H.code,A("after:highlight",K),K}function f(D,M,L,U){const I=Object.create(null);function H(ne,ge){return ne.keywords[ge]}function K(){if(!me.keywords){Se.addText(Le);return}let ne=0;me.keywordPatternRe.lastIndex=0;let ge=me.keywordPatternRe.exec(Le),Ce="";for(;ge;){Ce+=Le.substring(ne,ge.index);const ke=ye.case_insensitive?ge[0].toLowerCase():ge[0],Ke=H(me,ke);if(Ke){const[it,ue]=Ke;if(Se.addText(Ce),Ce="",I[ke]=(I[ke]||0)+1,I[ke]<=k_t&&(be+=ue),it.startsWith("_"))Ce+=ge[0];else{const xe=ye.classNameAliases[it]||it;V(ge[0],xe)}}else Ce+=ge[0];ne=me.keywordPatternRe.lastIndex,ge=me.keywordPatternRe.exec(Le)}Ce+=Le.substring(ne),Se.addText(Ce)}function F(){if(Le==="")return;let ne=null;if(typeof me.subLanguage=="string"){if(!t[me.subLanguage]){Se.addText(Le);return}ne=f(me.subLanguage,Le,!0,se[me.subLanguage]),se[me.subLanguage]=ne._top}else ne=m(Le,me.subLanguage.length?me.subLanguage:null);me.relevance>0&&(be+=ne.relevance),Se.__addSublanguage(ne._emitter,ne.language)}function W(){me.subLanguage!=null?F():K(),Le=""}function V(ne,ge){ne!==""&&(Se.startScope(ge),Se.addText(ne),Se.endScope())}function X(ne,ge){let Ce=1;const ke=ge.length-1;for(;Ce<=ke;){if(!ne._emit[Ce]){Ce++;continue}const Ke=ye.classNameAliases[ne[Ce]]||ne[Ce],it=ge[Ce];Ke?V(it,Ke):(Le=it,K(),Le=""),Ce++}}function ie(ne,ge){return ne.scope&&typeof ne.scope=="string"&&Se.openNode(ye.classNameAliases[ne.scope]||ne.scope),ne.beginScope&&(ne.beginScope._wrap?(V(Le,ye.classNameAliases[ne.beginScope._wrap]||ne.beginScope._wrap),Le=""):ne.beginScope._multi&&(X(ne.beginScope,ge),Le="")),me=Object.create(ne,{parent:{value:me}}),me}function Q(ne,ge,Ce){let ke=F2t(ne.endRe,Ce);if(ke){if(ne["on:end"]){const Ke=new ite(ne);ne["on:end"](ge,Ke),Ke.isMatchIgnored&&(ke=!1)}if(ke){for(;ne.endsParent&&ne.parent;)ne=ne.parent;return ne}}if(ne.endsWithParent)return Q(ne.parent,ge,Ce)}function Z(ne){return me.matcher.regexIndex===0?(Le+=ne[0],1):(Re=!0,0)}function ce(ne){const ge=ne[0],Ce=ne.rule,ke=new ite(Ce),Ke=[Ce.__beforeBegin,Ce["on:begin"]];for(const it of Ke)if(it&&(it(ne,ke),ke.isMatchIgnored))return Z(ge);return Ce.skip?Le+=ge:(Ce.excludeBegin&&(Le+=ge),W(),!Ce.returnBegin&&!Ce.excludeBegin&&(Le=ge)),ie(Ce,ne),Ce.returnBegin?0:ge.length}function Ee(ne){const ge=ne[0],Ce=M.substring(ne.index),ke=Q(me,ne,Ce);if(!ke)return cte;const Ke=me;me.endScope&&me.endScope._wrap?(W(),V(ge,me.endScope._wrap)):me.endScope&&me.endScope._multi?(W(),X(me.endScope,ne)):Ke.skip?Le+=ge:(Ke.returnEnd||Ke.excludeEnd||(Le+=ge),W(),Ke.excludeEnd&&(Le=ge));do me.scope&&Se.closeNode(),!me.skip&&!me.subLanguage&&(be+=me.relevance),me=me.parent;while(me!==ke.parent);return ke.starts&&ie(ke.starts,ne),Ke.returnEnd?0:ge.length}function Y(){const ne=[];for(let ge=me;ge!==ye;ge=ge.parent)ge.scope&&ne.unshift(ge.scope);ne.forEach(ge=>Se.openNode(ge))}let G={};function te(ne,ge){const Ce=ge&&ge[0];if(Le+=ne,Ce==null)return W(),0;if(G.type==="begin"&&ge.type==="end"&&G.index===ge.index&&Ce===""){if(Le+=M.slice(ge.index,ge.index+1),!r){const ke=new Error(`0 width match regex (${D})`);throw ke.languageName=D,ke.badRule=G.rule,ke}return 1}if(G=ge,ge.type==="begin")return ce(ge);if(ge.type==="illegal"&&!L){const ke=new Error('Illegal lexeme "'+Ce+'" for mode "'+(me.scope||"")+'"');throw ke.mode=me,ke}else if(ge.type==="end"){const ke=Ee(ge);if(ke!==cte)return ke}if(ge.type==="illegal"&&Ce==="")return Le+=` -`,1;if(ve>1e5&&ve>ge.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Le+=Ce,Ce.length}const ye=E(D);if(!ye)throw ey(s.replace("{}",D)),new Error('Unknown language: "'+D+'"');const Ne=v_t(ye);let pe="",me=U||Ne;const se={},Se=new l.__emitter(l);Y();let Le="",be=0,Ve=0,ve=0,Re=!1;try{if(ye.__emitTokens)ye.__emitTokens(M,Se);else{for(me.matcher.considerAll();;){ve++,Re?Re=!1:me.matcher.considerAll(),me.matcher.lastIndex=Ve;const ne=me.matcher.exec(M);if(!ne)break;const ge=M.substring(Ve,ne.index),Ce=te(ge,ne);Ve=ne.index+Ce}te(M.substring(Ve))}return Se.finalize(),pe=Se.toHTML(),{language:D,value:pe,relevance:be,illegal:!1,_emitter:Se,_top:me}}catch(ne){if(ne.message&&ne.message.includes("Illegal"))return{language:D,value:V5(M),illegal:!0,relevance:0,_illegalBy:{message:ne.message,index:Ve,context:M.slice(Ve-100,Ve+100),mode:ne.mode,resultSoFar:pe},_emitter:Se};if(r)return{language:D,value:V5(M),illegal:!1,relevance:0,errorRaised:ne,_emitter:Se,_top:me};throw ne}}function h(D){const M={value:V5(D),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return M._emitter.addText(D),M}function m(D,M){M=M||l.languages||Object.keys(t);const L=h(D),U=M.filter(E).filter(_).map(W=>f(W,D,!1));U.unshift(L);const I=U.sort((W,V)=>{if(W.relevance!==V.relevance)return V.relevance-W.relevance;if(W.language&&V.language){if(E(W.language).supersetOf===V.language)return 1;if(E(V.language).supersetOf===W.language)return-1}return 0}),[H,K]=I,F=H;return F.secondBest=K,F}function g(D,M,L){const U=M&&n[M]||L;D.classList.add("hljs"),D.classList.add(`language-${U}`)}function b(D){let M=null;const L=u(D);if(c(L))return;if(A("before:highlightElement",{el:D,language:L}),D.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",D);return}if(D.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(D)),l.throwUnescapedHTML))throw new O_t("One of your code blocks includes unescaped HTML.",D.innerHTML);M=D;const U=M.textContent,I=L?d(U,{language:L,ignoreIllegals:!0}):m(U);D.innerHTML=I.value,D.dataset.highlighted="yes",g(D,L,I.language),D.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(D.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),A("after:highlightElement",{el:D,result:I,text:U})}function v(D){l=lte(l,D)}const y=()=>{O(),Q0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){O(),Q0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function O(){function D(){O()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",D,!1),w=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(D,M){let L=null;try{L=M(e)}catch(U){if(ey("Language definition for '{}' could not be registered.".replace("{}",D)),r)ey(U);else throw U;L=o}L.name||(L.name=D),t[D]=L,L.rawDefinition=M.bind(null,e),L.aliases&&R(L.aliases,{languageName:D})}function k(D){delete t[D];for(const M of Object.keys(n))n[M]===D&&delete n[M]}function C(){return Object.keys(t)}function E(D){return D=(D||"").toLowerCase(),t[D]||t[n[D]]}function R(D,{languageName:M}){typeof D=="string"&&(D=[D]),D.forEach(L=>{n[L.toLowerCase()]=M})}function _(D){const M=E(D);return M&&!M.disableAutodetect}function j(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=M=>{D["before:highlightBlock"](Object.assign({block:M.el},M))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=M=>{D["after:highlightBlock"](Object.assign({block:M.el},M))})}function T(D){j(D),i.push(D)}function N(D){const M=i.indexOf(D);M!==-1&&i.splice(M,1)}function A(D,M){const L=D;i.forEach(function(U){U[L]&&U[L](M)})}function P(D){return Q0("10.7.0","highlightBlock will be removed entirely in v12.0"),Q0("10.7.0","Please use highlightElement now."),b(D)}Object.assign(e,{highlight:d,highlightAuto:m,highlightAll:O,highlightElement:b,highlightBlock:P,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:S,unregisterLanguage:k,listLanguages:C,getLanguage:E,registerAliases:R,autoDetection:_,inherit:lte,addPlugin:T,removePlugin:N}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=w_t,e.regex={concat:n0,lookahead:QPe,either:Kz,optional:L2t,anyNumberOfTimes:M2t};for(const D in JA)typeof JA[D]=="object"&&BPe(JA[D]);return Object.assign(e,JA),e},cw=YPe({});cw.newInstance=()=>YPe({});var S_t=cw;cw.HighlightJS=cw;cw.default=cw;const sl=Ew(S_t),ute={},E_t="hljs-";function C_t(e){const t=sl.newInstance();return e&&s(e),{highlight:n,highlightAuto:i,listLanguages:r,register:s,registerAlias:o,registered:l};function n(c,u,d){const f=d||ute,h=typeof f.prefix=="string"?f.prefix:E_t;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:T_t,classPrefix:h});const m=t.highlight(u,{ignoreIllegals:!0,language:c});if(m.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:m.errorRaised});const g=m._emitter.root,b=g.data;return b.language=m.language,b.relevance=m.relevance,g}function i(c,u){const f=(u||ute).subset||r();let h=-1,m=0,g;for(;++hm&&(m=v.data.relevance,g=v)}return g||{type:"root",children:[],data:{language:void 0,relevance:m}}}function r(){return t.listLanguages()}function s(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function o(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class T_t{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],i=n.children[n.children.length-1];i&&i.type==="text"?i.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const i=this.stack[this.stack.length-1],r=t.root.children;n?i.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):i.children.push(...r)}openNode(t){const n=this,i=t.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),r=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:i},children:[]};r.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const A_t={};function dte(e){const t=e||A_t,n=t.aliases,i=t.detect||!1,r=t.languages||N2t,s=t.plainText,o=t.prefix,l=t.subset;let c="hljs";const u=C_t(r);if(n&&u.registerAlias(n),o){const d=o.indexOf("-");c=d===-1?o:o.slice(0,d)}return function(d,f){VC(d,"element",function(h,m,g){if(h.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const b=__t(h);if(b===!1||!b&&!i||b&&s&&s.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=fAt(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:o}):u.highlightAuto(v,{prefix:o,subset:l})}catch(x){const w=x;if(b&&/Unknown language/.test(w.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[g,h],cause:w,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function __t(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let i;for(;++n-1&&s<=t.length){let o=0;for(;;){let l=n[o];if(l===void 0){const c=pte(t,n[o-1]);l=c===-1?t.length+1:c+1,n[o]=l}if(l>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function r(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length1?n[s.line-2]:0)+s.column-1;if(o=55296&&e<=57343}function tjt(e){return e>=56320&&e<=57343}function njt(e,t){return(e-55296)*1024+9216+t}function iDe(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function rDe(e){return e>=64976&&e<=65007||ejt.has(e)}var at;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(at||(at={}));const ijt=65536;class rjt{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=ijt,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:i,col:r,offset:s}=this,o=r+n,l=s+n;return{code:t,startLine:i,endLine:i,startCol:o,endCol:o,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(tjt(n))return this.pos++,this._addGap(),njt(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,fe.EOF;return this._err(at.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let i=0;i=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fe.EOF;const i=this.html.charCodeAt(n);return i===fe.CARRIAGE_RETURN?fe.LINE_FEED:i}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fe.EOF;let t=this.html.charCodeAt(this.pos);return t===fe.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,fe.LINE_FEED):t===fe.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,nDe(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===fe.LINE_FEED||t===fe.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){iDe(t)?this._err(at.controlCharacterInInputStream):rDe(t)&&this._err(at.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const sjt=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),ojt=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function ajt(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=ojt.get(e))!==null&&t!==void 0?t:e}var pa;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(pa||(pa={}));const ljt=32;var Tm;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Tm||(Tm={}));function c8(e){return e>=pa.ZERO&&e<=pa.NINE}function cjt(e){return e>=pa.UPPER_A&&e<=pa.UPPER_F||e>=pa.LOWER_A&&e<=pa.LOWER_F}function ujt(e){return e>=pa.UPPER_A&&e<=pa.UPPER_Z||e>=pa.LOWER_A&&e<=pa.LOWER_Z||c8(e)}function djt(e){return e===pa.EQUALS||ujt(e)}var la;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(la||(la={}));var jh;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(jh||(jh={}));class fjt{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=la.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=jh.Strict}startEntity(t){this.decodeMode=t,this.state=la.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case la.EntityStart:return t.charCodeAt(n)===pa.NUM?(this.state=la.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=la.NamedEntity,this.stateNamedEntity(t,n));case la.NumericStart:return this.stateNumericStart(t,n);case la.NumericDecimal:return this.stateNumericDecimal(t,n);case la.NumericHex:return this.stateNumericHex(t,n);case la.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|ljt)===pa.LOWER_X?(this.state=la.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=la.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,i,r){if(n!==i){const s=i-n;this.result=this.result*Math.pow(r,s)+Number.parseInt(t.substr(n,s),r),this.consumed+=s}}stateNumericHex(t,n){const i=n;for(;n>14;for(;n>14,s!==0){if(o===pa.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==jh.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:i}=this,r=(i[n]&Tm.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,r,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,i){const{decodeTree:r}=this;return this.emitCodePoint(n===1?r[t]&~Tm.VALUE_LENGTH:r[t+1],i),n===3&&this.emitCodePoint(r[t+2],i),i}end(){var t;switch(this.state){case la.NamedEntity:return this.result!==0&&(this.decodeMode!==jh.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case la.NumericDecimal:return this.emitNumericEntity(0,2);case la.NumericHex:return this.emitNumericEntity(0,3);case la.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case la.EntityStart:return 0}}}function hjt(e,t,n,i){const r=(t&Tm.BRANCH_LENGTH)>>7,s=t&Tm.JUMP_TABLE;if(r===0)return s!==0&&i===s?n:-1;if(s){const c=i-s;return c<0||c>=r?-1:e[n+c]-1}let o=n,l=o+r-1;for(;o<=l;){const c=o+l>>>1,u=e[c];if(ui)l=c-1;else return e[c+r]}return-1}var _t;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(_t||(_t={}));var ty;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(ty||(ty={}));var Eu;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Eu||(Eu={}));var Xe;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(Xe||(Xe={}));var $;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})($||($={}));const pjt=new Map([[Xe.A,$.A],[Xe.ADDRESS,$.ADDRESS],[Xe.ANNOTATION_XML,$.ANNOTATION_XML],[Xe.APPLET,$.APPLET],[Xe.AREA,$.AREA],[Xe.ARTICLE,$.ARTICLE],[Xe.ASIDE,$.ASIDE],[Xe.B,$.B],[Xe.BASE,$.BASE],[Xe.BASEFONT,$.BASEFONT],[Xe.BGSOUND,$.BGSOUND],[Xe.BIG,$.BIG],[Xe.BLOCKQUOTE,$.BLOCKQUOTE],[Xe.BODY,$.BODY],[Xe.BR,$.BR],[Xe.BUTTON,$.BUTTON],[Xe.CAPTION,$.CAPTION],[Xe.CENTER,$.CENTER],[Xe.CODE,$.CODE],[Xe.COL,$.COL],[Xe.COLGROUP,$.COLGROUP],[Xe.DD,$.DD],[Xe.DESC,$.DESC],[Xe.DETAILS,$.DETAILS],[Xe.DIALOG,$.DIALOG],[Xe.DIR,$.DIR],[Xe.DIV,$.DIV],[Xe.DL,$.DL],[Xe.DT,$.DT],[Xe.EM,$.EM],[Xe.EMBED,$.EMBED],[Xe.FIELDSET,$.FIELDSET],[Xe.FIGCAPTION,$.FIGCAPTION],[Xe.FIGURE,$.FIGURE],[Xe.FONT,$.FONT],[Xe.FOOTER,$.FOOTER],[Xe.FOREIGN_OBJECT,$.FOREIGN_OBJECT],[Xe.FORM,$.FORM],[Xe.FRAME,$.FRAME],[Xe.FRAMESET,$.FRAMESET],[Xe.H1,$.H1],[Xe.H2,$.H2],[Xe.H3,$.H3],[Xe.H4,$.H4],[Xe.H5,$.H5],[Xe.H6,$.H6],[Xe.HEAD,$.HEAD],[Xe.HEADER,$.HEADER],[Xe.HGROUP,$.HGROUP],[Xe.HR,$.HR],[Xe.HTML,$.HTML],[Xe.I,$.I],[Xe.IMG,$.IMG],[Xe.IMAGE,$.IMAGE],[Xe.INPUT,$.INPUT],[Xe.IFRAME,$.IFRAME],[Xe.KEYGEN,$.KEYGEN],[Xe.LABEL,$.LABEL],[Xe.LI,$.LI],[Xe.LINK,$.LINK],[Xe.LISTING,$.LISTING],[Xe.MAIN,$.MAIN],[Xe.MALIGNMARK,$.MALIGNMARK],[Xe.MARQUEE,$.MARQUEE],[Xe.MATH,$.MATH],[Xe.MENU,$.MENU],[Xe.META,$.META],[Xe.MGLYPH,$.MGLYPH],[Xe.MI,$.MI],[Xe.MO,$.MO],[Xe.MN,$.MN],[Xe.MS,$.MS],[Xe.MTEXT,$.MTEXT],[Xe.NAV,$.NAV],[Xe.NOBR,$.NOBR],[Xe.NOFRAMES,$.NOFRAMES],[Xe.NOEMBED,$.NOEMBED],[Xe.NOSCRIPT,$.NOSCRIPT],[Xe.OBJECT,$.OBJECT],[Xe.OL,$.OL],[Xe.OPTGROUP,$.OPTGROUP],[Xe.OPTION,$.OPTION],[Xe.P,$.P],[Xe.PARAM,$.PARAM],[Xe.PLAINTEXT,$.PLAINTEXT],[Xe.PRE,$.PRE],[Xe.RB,$.RB],[Xe.RP,$.RP],[Xe.RT,$.RT],[Xe.RTC,$.RTC],[Xe.RUBY,$.RUBY],[Xe.S,$.S],[Xe.SCRIPT,$.SCRIPT],[Xe.SEARCH,$.SEARCH],[Xe.SECTION,$.SECTION],[Xe.SELECT,$.SELECT],[Xe.SOURCE,$.SOURCE],[Xe.SMALL,$.SMALL],[Xe.SPAN,$.SPAN],[Xe.STRIKE,$.STRIKE],[Xe.STRONG,$.STRONG],[Xe.STYLE,$.STYLE],[Xe.SUB,$.SUB],[Xe.SUMMARY,$.SUMMARY],[Xe.SUP,$.SUP],[Xe.TABLE,$.TABLE],[Xe.TBODY,$.TBODY],[Xe.TEMPLATE,$.TEMPLATE],[Xe.TEXTAREA,$.TEXTAREA],[Xe.TFOOT,$.TFOOT],[Xe.TD,$.TD],[Xe.TH,$.TH],[Xe.THEAD,$.THEAD],[Xe.TITLE,$.TITLE],[Xe.TR,$.TR],[Xe.TRACK,$.TRACK],[Xe.TT,$.TT],[Xe.U,$.U],[Xe.UL,$.UL],[Xe.SVG,$.SVG],[Xe.VAR,$.VAR],[Xe.WBR,$.WBR],[Xe.XMP,$.XMP]]);function n1(e){var t;return(t=pjt.get(e))!==null&&t!==void 0?t:$.UNKNOWN}const Pt=$,mjt={[_t.HTML]:new Set([Pt.ADDRESS,Pt.APPLET,Pt.AREA,Pt.ARTICLE,Pt.ASIDE,Pt.BASE,Pt.BASEFONT,Pt.BGSOUND,Pt.BLOCKQUOTE,Pt.BODY,Pt.BR,Pt.BUTTON,Pt.CAPTION,Pt.CENTER,Pt.COL,Pt.COLGROUP,Pt.DD,Pt.DETAILS,Pt.DIR,Pt.DIV,Pt.DL,Pt.DT,Pt.EMBED,Pt.FIELDSET,Pt.FIGCAPTION,Pt.FIGURE,Pt.FOOTER,Pt.FORM,Pt.FRAME,Pt.FRAMESET,Pt.H1,Pt.H2,Pt.H3,Pt.H4,Pt.H5,Pt.H6,Pt.HEAD,Pt.HEADER,Pt.HGROUP,Pt.HR,Pt.HTML,Pt.IFRAME,Pt.IMG,Pt.INPUT,Pt.LI,Pt.LINK,Pt.LISTING,Pt.MAIN,Pt.MARQUEE,Pt.MENU,Pt.META,Pt.NAV,Pt.NOEMBED,Pt.NOFRAMES,Pt.NOSCRIPT,Pt.OBJECT,Pt.OL,Pt.P,Pt.PARAM,Pt.PLAINTEXT,Pt.PRE,Pt.SCRIPT,Pt.SECTION,Pt.SELECT,Pt.SOURCE,Pt.STYLE,Pt.SUMMARY,Pt.TABLE,Pt.TBODY,Pt.TD,Pt.TEMPLATE,Pt.TEXTAREA,Pt.TFOOT,Pt.TH,Pt.THEAD,Pt.TITLE,Pt.TR,Pt.TRACK,Pt.UL,Pt.WBR,Pt.XMP]),[_t.MATHML]:new Set([Pt.MI,Pt.MO,Pt.MN,Pt.MS,Pt.MTEXT,Pt.ANNOTATION_XML]),[_t.SVG]:new Set([Pt.TITLE,Pt.FOREIGN_OBJECT,Pt.DESC]),[_t.XLINK]:new Set,[_t.XML]:new Set,[_t.XMLNS]:new Set},u8=new Set([Pt.H1,Pt.H2,Pt.H3,Pt.H4,Pt.H5,Pt.H6]);Xe.STYLE,Xe.SCRIPT,Xe.XMP,Xe.IFRAME,Xe.NOEMBED,Xe.NOFRAMES,Xe.PLAINTEXT;var Oe;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(Oe||(Oe={}));const ho={DATA:Oe.DATA,RCDATA:Oe.RCDATA,RAWTEXT:Oe.RAWTEXT,SCRIPT_DATA:Oe.SCRIPT_DATA,PLAINTEXT:Oe.PLAINTEXT,CDATA_SECTION:Oe.CDATA_SECTION};function gjt(e){return e>=fe.DIGIT_0&&e<=fe.DIGIT_9}function YO(e){return e>=fe.LATIN_CAPITAL_A&&e<=fe.LATIN_CAPITAL_Z}function bjt(e){return e>=fe.LATIN_SMALL_A&&e<=fe.LATIN_SMALL_Z}function em(e){return bjt(e)||YO(e)}function gte(e){return em(e)||gjt(e)}function e2(e){return e+32}function oDe(e){return e===fe.SPACE||e===fe.LINE_FEED||e===fe.TABULATION||e===fe.FORM_FEED}function bte(e){return oDe(e)||e===fe.SOLIDUS||e===fe.GREATER_THAN_SIGN}function yjt(e){return e===fe.NULL?at.nullCharacterReference:e>1114111?at.characterReferenceOutsideUnicodeRange:nDe(e)?at.surrogateCharacterReference:rDe(e)?at.noncharacterCharacterReference:iDe(e)||e===fe.CARRIAGE_RETURN?at.controlCharacterReference:null}class vjt{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Oe.DATA,this.returnState=Oe.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new rjt(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new fjt(sjt,(i,r)=>{this.preprocessor.pos=this.entityStartPos+r-1,this._flushCodePointConsumedAsCharacterReference(i)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(at.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:i=>{this._err(at.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+i)},validateNumericCharacterReference:i=>{const r=yjt(i);r&&this._err(r,1)}}:void 0)}_err(t,n=0){var i,r;(r=(i=this.handler).onParseError)===null||r===void 0||r.call(i,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,i){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||i==null||i()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(at.endTagWithAttributes),t.selfClosing&&this._err(at.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Si.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Si.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Si.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Si.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=oDe(t)?Si.WHITESPACE_CHARACTER:t===fe.NULL?Si.NULL_CHARACTER:Si.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Si.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=Oe.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?jh.Attribute:jh.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Oe.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Oe.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Oe.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case Oe.DATA:{this._stateData(t);break}case Oe.RCDATA:{this._stateRcdata(t);break}case Oe.RAWTEXT:{this._stateRawtext(t);break}case Oe.SCRIPT_DATA:{this._stateScriptData(t);break}case Oe.PLAINTEXT:{this._statePlaintext(t);break}case Oe.TAG_OPEN:{this._stateTagOpen(t);break}case Oe.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case Oe.TAG_NAME:{this._stateTagName(t);break}case Oe.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case Oe.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case Oe.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case Oe.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case Oe.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case Oe.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case Oe.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case Oe.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case Oe.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case Oe.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case Oe.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case Oe.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case Oe.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case Oe.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case Oe.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case Oe.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case Oe.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case Oe.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case Oe.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case Oe.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case Oe.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case Oe.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case Oe.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case Oe.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case Oe.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case Oe.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case Oe.BOGUS_COMMENT:{this._stateBogusComment(t);break}case Oe.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case Oe.COMMENT_START:{this._stateCommentStart(t);break}case Oe.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case Oe.COMMENT:{this._stateComment(t);break}case Oe.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case Oe.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case Oe.COMMENT_END:{this._stateCommentEnd(t);break}case Oe.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case Oe.DOCTYPE:{this._stateDoctype(t);break}case Oe.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case Oe.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case Oe.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case Oe.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case Oe.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case Oe.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case Oe.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case Oe.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case Oe.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case Oe.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case Oe.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case Oe.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case Oe.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case Oe.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case Oe.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case Oe.CDATA_SECTION:{this._stateCdataSection(t);break}case Oe.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case Oe.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case Oe.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case Oe.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.TAG_OPEN;break}case fe.AMPERSAND:{this._startCharacterReference();break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitCodePoint(t);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case fe.AMPERSAND:{this._startCharacterReference();break}case fe.LESS_THAN_SIGN:{this.state=Oe.RCDATA_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.RAWTEXT_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.SCRIPT_DATA_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(em(t))this._createStartTagToken(),this.state=Oe.TAG_NAME,this._stateTagName(t);else switch(t){case fe.EXCLAMATION_MARK:{this.state=Oe.MARKUP_DECLARATION_OPEN;break}case fe.SOLIDUS:{this.state=Oe.END_TAG_OPEN;break}case fe.QUESTION_MARK:{this._err(at.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Oe.BOGUS_COMMENT,this._stateBogusComment(t);break}case fe.EOF:{this._err(at.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(at.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Oe.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(em(t))this._createEndTagToken(),this.state=Oe.TAG_NAME,this._stateTagName(t);else switch(t){case fe.GREATER_THAN_SIGN:{this._err(at.missingEndTagName),this.state=Oe.DATA;break}case fe.EOF:{this._err(at.eofBeforeTagName),this._emitChars("");break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this.state=Oe.SCRIPT_DATA_ESCAPED,this._emitChars(Ss);break}case fe.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Oe.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===fe.SOLIDUS?this.state=Oe.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:em(t)?(this._emitChars("<"),this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=Oe.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){em(t)?(this.state=Oe.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ss);break}case fe.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===fe.SOLIDUS?(this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(zl.SCRIPT,!1)&&bte(this.preprocessor.peek(zl.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const i=this._indexOf(t);this.items[i]=n,i===this.stackTop&&(this.current=n)}insertAfter(t,n,i){const r=this._indexOf(t)+1;this.items.splice(r,0,n),this.tagIDs.splice(r,0,i),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==_t.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;i--)if(t.has(this.tagIDs[i])&&this.treeAdapter.getNamespaceURI(this.items[i])===n)return i;return-1}clearBackTo(t,n){const i=this._indexOfTagNames(t,n);this.shortenToLength(i+1)}clearBackToTableContext(){this.clearBackTo(Sjt,_t.HTML)}clearBackToTableBodyContext(){this.clearBackTo(kjt,_t.HTML)}clearBackToTableRowContext(){this.clearBackTo(Ojt,_t.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===$.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===$.HTML}hasInDynamicScope(t,n){for(let i=this.stackTop;i>=0;i--){const r=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case _t.HTML:{if(r===t)return!0;if(n.has(r))return!1;break}case _t.SVG:{if(xte.has(r))return!1;break}case _t.MATHML:{if(vte.has(r))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,WN)}hasInListItemScope(t){return this.hasInDynamicScope(t,xjt)}hasInButtonScope(t){return this.hasInDynamicScope(t,wjt)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case _t.HTML:{if(u8.has(n))return!0;if(WN.has(n))return!1;break}case _t.SVG:{if(xte.has(n))return!1;break}case _t.MATHML:{if(vte.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===_t.HTML)switch(this.tagIDs[n]){case t:return!0;case $.TABLE:case $.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===_t.HTML)switch(this.tagIDs[t]){case $.TBODY:case $.THEAD:case $.TFOOT:return!0;case $.TABLE:case $.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===_t.HTML)switch(this.tagIDs[n]){case t:return!0;case $.OPTION:case $.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&aDe.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&yte.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&yte.has(this.currentTagId);)this.pop()}}const H5=3;var cf;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(cf||(cf={}));const wte={type:cf.Marker};class Tjt{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],r=n.length,s=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[o.name,o.value]));let s=0;for(let o=0;or.get(c.name)===c.value)&&(s+=1,s>=H5&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(wte)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:cf.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:cf.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(wte);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===cf.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===cf.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===cf.Element&&n.element===t)}}const tm={createDocument(){return{nodeName:"#document",mode:Eu.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const i=e.childNodes.indexOf(n);e.childNodes.splice(i,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,i){const r=e.childNodes.find(s=>s.nodeName==="#documentType");if(r)r.name=t,r.publicId=n,r.systemId=i;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:i,parentNode:null};tm.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(tm.isTextNode(n)){n.value+=t;return}}tm.appendChild(e,tm.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&tm.isTextNode(i)?i.value+=t:tm.insertBefore(e,tm.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function Ijt(e){return e.name===lDe&&e.publicId===null&&(e.systemId===null||e.systemId===Ajt)}function Pjt(e){if(e.name!==lDe)return Eu.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===_jt)return Eu.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Njt.has(n))return Eu.QUIRKS;let i=t===null?jjt:cDe;if(Ote(n,i))return Eu.QUIRKS;if(i=t===null?uDe:Rjt,Ote(n,i))return Eu.LIMITED_QUIRKS}return Eu.NO_QUIRKS}const kte={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Djt="definitionurl",Mjt="definitionURL",Ljt=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),$jt=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:_t.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:_t.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:_t.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:_t.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:_t.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:_t.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:_t.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:_t.XML}],["xml:space",{prefix:"xml",name:"space",namespace:_t.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:_t.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:_t.XMLNS}]]),Fjt=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Bjt=new Set([$.B,$.BIG,$.BLOCKQUOTE,$.BODY,$.BR,$.CENTER,$.CODE,$.DD,$.DIV,$.DL,$.DT,$.EM,$.EMBED,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HR,$.I,$.IMG,$.LI,$.LISTING,$.MENU,$.META,$.NOBR,$.OL,$.P,$.PRE,$.RUBY,$.S,$.SMALL,$.SPAN,$.STRONG,$.STRIKE,$.SUB,$.SUP,$.TABLE,$.TT,$.U,$.UL,$.VAR]);function Ujt(e){const t=e.tagID;return t===$.FONT&&e.attrs.some(({name:i})=>i===ty.COLOR||i===ty.SIZE||i===ty.FACE)||Bjt.has(t)}function dDe(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var i,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(r=(i=this.treeAdapter).onItemPop)===null||r===void 0||r.call(i,t,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(t,n){const i=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===_t.HTML;this.currentNotInHTML=!i,this.tokenizer.inForeignNode=!i&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,_t.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=je.TEXT}switchToPlaintextParsing(){this.insertionMode=je.TEXT,this.originalInsertionMode=je.IN_BODY,this.tokenizer.state=ho.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Xe.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==_t.HTML))switch(this.fragmentContextID){case $.TITLE:case $.TEXTAREA:{this.tokenizer.state=ho.RCDATA;break}case $.STYLE:case $.XMP:case $.IFRAME:case $.NOEMBED:case $.NOFRAMES:case $.NOSCRIPT:{this.tokenizer.state=ho.RAWTEXT;break}case $.SCRIPT:{this.tokenizer.state=ho.SCRIPT_DATA;break}case $.PLAINTEXT:{this.tokenizer.state=ho.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",i=t.publicId||"",r=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,i,r),t.location){const o=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));o&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const i=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,i)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const i=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(i??this.document,t)}}_appendElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location)}_insertElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location),this.openElements.push(i,t.tagID)}_insertFakeElement(t,n){const i=this.treeAdapter.createElement(t,_t.HTML,[]);this._attachElementToTree(i,null),this.openElements.push(i,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,_t.HTML,t.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,i),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Xe.HTML,_t.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,$.HTML)}_appendCommentNode(t,n){const i=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,i),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_insertCharacters(t){let n,i;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:i}=this._findFosterParentingLocation(),i?this.treeAdapter.insertTextBefore(n,t.chars,i):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const r=this.treeAdapter.getChildNodes(n),s=i?r.lastIndexOf(i):r.length,o=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,n){for(let i=this.treeAdapter.getFirstChild(t);i;i=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(n,i)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const i=n.location,r=this.treeAdapter.getTagName(t),s=n.type===Si.END_TAG&&r===n.tagName?{endTag:{...i},endLine:i.endLine,endCol:i.endCol,endOffset:i.endOffset}:{endLine:i.startLine,endCol:i.startCol,endOffset:i.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,s)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,i;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,i=this.fragmentContextID):{current:n,currentTagId:i}=this.openElements,t.tagID===$.SVG&&this.treeAdapter.getTagName(n)===Xe.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===_t.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===$.MGLYPH||t.tagID===$.MALIGNMARK)&&i!==void 0&&!this._isIntegrationPoint(i,n,_t.HTML)}_processToken(t){switch(t.type){case Si.CHARACTER:{this.onCharacter(t);break}case Si.NULL_CHARACTER:{this.onNullCharacter(t);break}case Si.COMMENT:{this.onComment(t);break}case Si.DOCTYPE:{this.onDoctype(t);break}case Si.START_TAG:{this._processStartTag(t);break}case Si.END_TAG:{this.onEndTag(t);break}case Si.EOF:{this.onEof(t);break}case Si.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,i){const r=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return Hjt(t,r,s,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(r=>r.type===cf.Marker||this.openElements.contains(r.element)),i=n===-1?t-1:n-1;for(let r=i;r>=0;r--){const s=this.activeFormattingElements.entries[r];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=je.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion($.P),this.openElements.popUntilTagNamePopped($.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case $.TR:{this.insertionMode=je.IN_ROW;return}case $.TBODY:case $.THEAD:case $.TFOOT:{this.insertionMode=je.IN_TABLE_BODY;return}case $.CAPTION:{this.insertionMode=je.IN_CAPTION;return}case $.COLGROUP:{this.insertionMode=je.IN_COLUMN_GROUP;return}case $.TABLE:{this.insertionMode=je.IN_TABLE;return}case $.BODY:{this.insertionMode=je.IN_BODY;return}case $.FRAMESET:{this.insertionMode=je.IN_FRAMESET;return}case $.SELECT:{this._resetInsertionModeForSelect(t);return}case $.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case $.HTML:{this.insertionMode=this.headElement?je.AFTER_HEAD:je.BEFORE_HEAD;return}case $.TD:case $.TH:{if(t>0){this.insertionMode=je.IN_CELL;return}break}case $.HEAD:{if(t>0){this.insertionMode=je.IN_HEAD;return}break}}this.insertionMode=je.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const i=this.openElements.tagIDs[n];if(i===$.TEMPLATE)break;if(i===$.TABLE){this.insertionMode=je.IN_SELECT_IN_TABLE;return}}this.insertionMode=je.IN_SELECT}_isElementCausesFosterParenting(t){return hDe.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case $.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===_t.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case $.TABLE:{const i=this.treeAdapter.getParentNode(n);return i?{parent:i,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const i=this.treeAdapter.getNamespaceURI(t);return mjt[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){ERt(this,t);return}switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.IN_BODY:case je.IN_CAPTION:case je.IN_CELL:case je.IN_TEMPLATE:{mDe(this,t);break}case je.TEXT:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_TABLE_TEXT:{wDe(this,t);break}case je.IN_COLUMN_GROUP:{KN(this,t);break}case je.AFTER_BODY:{GN(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){SRt(this,t);return}switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.TEXT:{this._insertCharacters(t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_COLUMN_GROUP:{KN(this,t);break}case je.AFTER_BODY:{GN(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){d8(this,t);return}switch(this.insertionMode){case je.INITIAL:case je.BEFORE_HTML:case je.BEFORE_HEAD:case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:case je.IN_BODY:case je.IN_TABLE:case je.IN_CAPTION:case je.IN_COLUMN_GROUP:case je.IN_TABLE_BODY:case je.IN_ROW:case je.IN_CELL:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:case je.IN_TEMPLATE:case je.IN_FRAMESET:case je.AFTER_FRAMESET:{d8(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.AFTER_BODY:{nNt(this,t);break}case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{iNt(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case je.INITIAL:{rNt(this,t);break}case je.BEFORE_HEAD:case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:{this._err(t,at.misplacedDoctype);break}case je.IN_TABLE_TEXT:{uO(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,at.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?CRt(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{sNt(this,t);break}case je.BEFORE_HEAD:{aNt(this,t);break}case je.IN_HEAD:{Bd(this,t);break}case je.IN_HEAD_NO_SCRIPT:{uNt(this,t);break}case je.AFTER_HEAD:{fNt(this,t);break}case je.IN_BODY:{ll(this,t);break}case je.IN_TABLE:{uw(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_CAPTION:{lRt(this,t);break}case je.IN_COLUMN_GROUP:{nV(this,t);break}case je.IN_TABLE_BODY:{VP(this,t);break}case je.IN_ROW:{HP(this,t);break}case je.IN_CELL:{dRt(this,t);break}case je.IN_SELECT:{SDe(this,t);break}case je.IN_SELECT_IN_TABLE:{hRt(this,t);break}case je.IN_TEMPLATE:{mRt(this,t);break}case je.AFTER_BODY:{bRt(this,t);break}case je.IN_FRAMESET:{yRt(this,t);break}case je.AFTER_FRAMESET:{xRt(this,t);break}case je.AFTER_AFTER_BODY:{ORt(this,t);break}case je.AFTER_AFTER_FRAMESET:{kRt(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?TRt(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{oNt(this,t);break}case je.BEFORE_HEAD:{lNt(this,t);break}case je.IN_HEAD:{cNt(this,t);break}case je.IN_HEAD_NO_SCRIPT:{dNt(this,t);break}case je.AFTER_HEAD:{hNt(this,t);break}case je.IN_BODY:{zP(this,t);break}case je.TEXT:{ZNt(this,t);break}case je.IN_TABLE:{dE(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_CAPTION:{cRt(this,t);break}case je.IN_COLUMN_GROUP:{uRt(this,t);break}case je.IN_TABLE_BODY:{f8(this,t);break}case je.IN_ROW:{kDe(this,t);break}case je.IN_CELL:{fRt(this,t);break}case je.IN_SELECT:{EDe(this,t);break}case je.IN_SELECT_IN_TABLE:{pRt(this,t);break}case je.IN_TEMPLATE:{gRt(this,t);break}case je.AFTER_BODY:{TDe(this,t);break}case je.IN_FRAMESET:{vRt(this,t);break}case je.AFTER_FRAMESET:{wRt(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onEof(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.IN_BODY:case je.IN_TABLE:case je.IN_CAPTION:case je.IN_COLUMN_GROUP:case je.IN_TABLE_BODY:case je.IN_ROW:case je.IN_CELL:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:{vDe(this,t);break}case je.TEXT:{JNt(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_TEMPLATE:{CDe(this,t);break}case je.AFTER_BODY:case je.IN_FRAMESET:case je.AFTER_FRAMESET:case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{tV(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===fe.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:case je.TEXT:case je.IN_COLUMN_GROUP:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:case je.IN_FRAMESET:case je.AFTER_FRAMESET:{this._insertCharacters(t);break}case je.IN_BODY:case je.IN_CAPTION:case je.IN_CELL:case je.IN_TEMPLATE:case je.AFTER_BODY:case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{pDe(this,t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_TABLE_TEXT:{xDe(this,t);break}}}};function Xjt(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):yDe(e,t),n}function Yjt(e,t){let n=null,i=e.openElements.stackTop;for(;i>=0;i--){const r=e.openElements.items[i];if(r===t.element)break;e._isSpecialElement(r,e.openElements.tagIDs[i])&&(n=r)}return n||(e.openElements.shortenToLength(Math.max(i,0)),e.activeFormattingElements.removeEntry(t)),n}function Zjt(e,t,n){let i=t,r=e.openElements.getCommonAncestor(t);for(let s=0,o=r;o!==n;s++,o=r){r=e.openElements.getCommonAncestor(o);const l=e.activeFormattingElements.getElementEntry(o),c=l&&s>=Kjt;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(o)):(o=Jjt(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(o,i),i=o)}return i}function Jjt(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),i=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,i),t.element=i,i}function eNt(e,t,n){const i=e.treeAdapter.getTagName(t),r=n1(i);if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);r===$.TEMPLATE&&s===_t.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function tNt(e,t,n){const i=e.treeAdapter.getNamespaceURI(n.element),{token:r}=n,s=e.treeAdapter.createElement(r.tagName,i,r.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,r),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,r.tagID)}function eV(e,t){for(let n=0;n=n;i--)e._setEndLocation(e.openElements.items[i],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const i=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(i);if(r&&!r.endTag&&(e._setEndLocation(i,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&e._setEndLocation(s,t)}}}}function rNt(e,t){e._setDocumentType(t);const n=t.forceQuirks?Eu.QUIRKS:Pjt(t);Ijt(t)||e._err(t,at.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=je.BEFORE_HTML}function cO(e,t){e._err(t,at.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Eu.QUIRKS),e.insertionMode=je.BEFORE_HTML,e._processToken(t)}function sNt(e,t){t.tagID===$.HTML?(e._insertElement(t,_t.HTML),e.insertionMode=je.BEFORE_HEAD):Hk(e,t)}function oNt(e,t){const n=t.tagID;(n===$.HTML||n===$.HEAD||n===$.BODY||n===$.BR)&&Hk(e,t)}function Hk(e,t){e._insertFakeRootElement(),e.insertionMode=je.BEFORE_HEAD,e._processToken(t)}function aNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.HEAD:{e._insertElement(t,_t.HTML),e.headElement=e.openElements.current,e.insertionMode=je.IN_HEAD;break}default:qk(e,t)}}function lNt(e,t){const n=t.tagID;n===$.HEAD||n===$.BODY||n===$.HTML||n===$.BR?qk(e,t):e._err(t,at.endTagWithoutMatchingOpenElement)}function qk(e,t){e._insertFakeElement(Xe.HEAD,$.HEAD),e.headElement=e.openElements.current,e.insertionMode=je.IN_HEAD,e._processToken(t)}function Bd(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.TITLE:{e._switchToTextParsing(t,ho.RCDATA);break}case $.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ho.RAWTEXT):(e._insertElement(t,_t.HTML),e.insertionMode=je.IN_HEAD_NO_SCRIPT);break}case $.NOFRAMES:case $.STYLE:{e._switchToTextParsing(t,ho.RAWTEXT);break}case $.SCRIPT:{e._switchToTextParsing(t,ho.SCRIPT_DATA);break}case $.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=je.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(je.IN_TEMPLATE);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:Wk(e,t)}}function cNt(e,t){switch(t.tagID){case $.HEAD:{e.openElements.pop(),e.insertionMode=je.AFTER_HEAD;break}case $.BODY:case $.BR:case $.HTML:{Wk(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function i0(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==$.TEMPLATE&&e._err(t,at.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,at.endTagWithoutMatchingOpenElement)}function Wk(e,t){e.openElements.pop(),e.insertionMode=je.AFTER_HEAD,e._processToken(t)}function uNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BASEFONT:case $.BGSOUND:case $.HEAD:case $.LINK:case $.META:case $.NOFRAMES:case $.STYLE:{Bd(e,t);break}case $.NOSCRIPT:{e._err(t,at.nestedNoscriptInHead);break}default:Kk(e,t)}}function dNt(e,t){switch(t.tagID){case $.NOSCRIPT:{e.openElements.pop(),e.insertionMode=je.IN_HEAD;break}case $.BR:{Kk(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function Kk(e,t){const n=t.type===Si.EOF?at.openElementsLeftAfterEof:at.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=je.IN_HEAD,e._processToken(t)}function fNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BODY:{e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=je.IN_BODY;break}case $.FRAMESET:{e._insertElement(t,_t.HTML),e.insertionMode=je.IN_FRAMESET;break}case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:case $.NOFRAMES:case $.SCRIPT:case $.STYLE:case $.TEMPLATE:case $.TITLE:{e._err(t,at.abandonedHeadElementChild),e.openElements.push(e.headElement,$.HEAD),Bd(e,t),e.openElements.remove(e.headElement);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:Gk(e,t)}}function hNt(e,t){switch(t.tagID){case $.BODY:case $.HTML:case $.BR:{Gk(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function Gk(e,t){e._insertFakeElement(Xe.BODY,$.BODY),e.insertionMode=je.IN_BODY,QP(e,t)}function QP(e,t){switch(t.type){case Si.CHARACTER:{mDe(e,t);break}case Si.WHITESPACE_CHARACTER:{pDe(e,t);break}case Si.COMMENT:{d8(e,t);break}case Si.START_TAG:{ll(e,t);break}case Si.END_TAG:{zP(e,t);break}case Si.EOF:{vDe(e,t);break}}}function pDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function mDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function pNt(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function mNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function gNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_FRAMESET)}function bNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function yNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&u8.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,_t.HTML)}function vNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function xNt(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),n||(e.formElement=e.openElements.current))}function wNt(e,t){e.framesetOk=!1;const n=t.tagID;for(let i=e.openElements.stackTop;i>=0;i--){const r=e.openElements.tagIDs[i];if(n===$.LI&&r===$.LI||(n===$.DD||n===$.DT)&&(r===$.DD||r===$.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==$.ADDRESS&&r!==$.DIV&&r!==$.P&&e._isSpecialElement(e.openElements.items[i],r))break}e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function ONt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.tokenizer.state=ho.PLAINTEXT}function kNt(e,t){e.openElements.hasInScope($.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped($.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1}function SNt(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Xe.A);n&&(eV(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ENt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function CNt(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope($.NOBR)&&(eV(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function TNt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function ANt(e,t){e.treeAdapter.getDocumentMode(e.document)!==Eu.QUIRKS&&e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=je.IN_TABLE}function gDe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function bDe(e){const t=sDe(e,ty.TYPE);return t!=null&&t.toLowerCase()===qjt}function _Nt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),bDe(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function jNt(e,t){e._appendElement(t,_t.HTML),t.ackSelfClosing=!0}function NNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function RNt(e,t){t.tagName=Xe.IMG,t.tagID=$.IMG,gDe(e,t)}function INt(e,t){e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ho.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=je.TEXT}function PNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ho.RAWTEXT)}function DNt(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ho.RAWTEXT)}function Cte(e,t){e._switchToTextParsing(t,ho.RAWTEXT)}function MNt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===je.IN_TABLE||e.insertionMode===je.IN_CAPTION||e.insertionMode===je.IN_TABLE_BODY||e.insertionMode===je.IN_ROW||e.insertionMode===je.IN_CELL?je.IN_SELECT_IN_TABLE:je.IN_SELECT}function LNt(e,t){e.openElements.currentTagId===$.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function $Nt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,_t.HTML)}function FNt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion($.RTC),e._insertElement(t,_t.HTML)}function BNt(e,t){e._reconstructActiveFormattingElements(),dDe(t),Jz(t),t.selfClosing?e._appendElement(t,_t.MATHML):e._insertElement(t,_t.MATHML),t.ackSelfClosing=!0}function UNt(e,t){e._reconstructActiveFormattingElements(),fDe(t),Jz(t),t.selfClosing?e._appendElement(t,_t.SVG):e._insertElement(t,_t.SVG),t.ackSelfClosing=!0}function Tte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function ll(e,t){switch(t.tagID){case $.I:case $.S:case $.B:case $.U:case $.EM:case $.TT:case $.BIG:case $.CODE:case $.FONT:case $.SMALL:case $.STRIKE:case $.STRONG:{ENt(e,t);break}case $.A:{SNt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{yNt(e,t);break}case $.P:case $.DL:case $.OL:case $.UL:case $.DIV:case $.DIR:case $.NAV:case $.MAIN:case $.MENU:case $.ASIDE:case $.CENTER:case $.FIGURE:case $.FOOTER:case $.HEADER:case $.HGROUP:case $.DIALOG:case $.DETAILS:case $.ADDRESS:case $.ARTICLE:case $.SEARCH:case $.SECTION:case $.SUMMARY:case $.FIELDSET:case $.BLOCKQUOTE:case $.FIGCAPTION:{bNt(e,t);break}case $.LI:case $.DD:case $.DT:{wNt(e,t);break}case $.BR:case $.IMG:case $.WBR:case $.AREA:case $.EMBED:case $.KEYGEN:{gDe(e,t);break}case $.HR:{NNt(e,t);break}case $.RB:case $.RTC:{$Nt(e,t);break}case $.RT:case $.RP:{FNt(e,t);break}case $.PRE:case $.LISTING:{vNt(e,t);break}case $.XMP:{PNt(e,t);break}case $.SVG:{UNt(e,t);break}case $.HTML:{pNt(e,t);break}case $.BASE:case $.LINK:case $.META:case $.STYLE:case $.TITLE:case $.SCRIPT:case $.BGSOUND:case $.BASEFONT:case $.TEMPLATE:{Bd(e,t);break}case $.BODY:{mNt(e,t);break}case $.FORM:{xNt(e,t);break}case $.NOBR:{CNt(e,t);break}case $.MATH:{BNt(e,t);break}case $.TABLE:{ANt(e,t);break}case $.INPUT:{_Nt(e,t);break}case $.PARAM:case $.TRACK:case $.SOURCE:{jNt(e,t);break}case $.IMAGE:{RNt(e,t);break}case $.BUTTON:{kNt(e,t);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{TNt(e,t);break}case $.IFRAME:{DNt(e,t);break}case $.SELECT:{MNt(e,t);break}case $.OPTION:case $.OPTGROUP:{LNt(e,t);break}case $.NOEMBED:case $.NOFRAMES:{Cte(e,t);break}case $.FRAMESET:{gNt(e,t);break}case $.TEXTAREA:{INt(e,t);break}case $.NOSCRIPT:{e.options.scriptingEnabled?Cte(e,t):Tte(e,t);break}case $.PLAINTEXT:{ONt(e,t);break}case $.COL:case $.TH:case $.TD:case $.TR:case $.HEAD:case $.FRAME:case $.TBODY:case $.TFOOT:case $.THEAD:case $.CAPTION:case $.COLGROUP:break;default:Tte(e,t)}}function QNt(e,t){if(e.openElements.hasInScope($.BODY)&&(e.insertionMode=je.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function zNt(e,t){e.openElements.hasInScope($.BODY)&&(e.insertionMode=je.AFTER_BODY,TDe(e,t))}function VNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function HNt(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope($.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped($.FORM):n&&e.openElements.remove(n))}function qNt(e){e.openElements.hasInButtonScope($.P)||e._insertFakeElement(Xe.P,$.P),e._closePElement()}function WNt(e){e.openElements.hasInListItemScope($.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion($.LI),e.openElements.popUntilTagNamePopped($.LI))}function KNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function GNt(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function XNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function YNt(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Xe.BR,$.BR),e.openElements.pop(),e.framesetOk=!1}function yDe(e,t){const n=t.tagName,i=t.tagID;for(let r=e.openElements.stackTop;r>0;r--){const s=e.openElements.items[r],o=e.openElements.tagIDs[r];if(i===o&&(i!==$.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=r&&e.openElements.shortenToLength(r);break}if(e._isSpecialElement(s,o))break}}function zP(e,t){switch(t.tagID){case $.A:case $.B:case $.I:case $.S:case $.U:case $.EM:case $.TT:case $.BIG:case $.CODE:case $.FONT:case $.NOBR:case $.SMALL:case $.STRIKE:case $.STRONG:{eV(e,t);break}case $.P:{qNt(e);break}case $.DL:case $.UL:case $.OL:case $.DIR:case $.DIV:case $.NAV:case $.PRE:case $.MAIN:case $.MENU:case $.ASIDE:case $.BUTTON:case $.CENTER:case $.FIGURE:case $.FOOTER:case $.HEADER:case $.HGROUP:case $.DIALOG:case $.ADDRESS:case $.ARTICLE:case $.DETAILS:case $.SEARCH:case $.SECTION:case $.SUMMARY:case $.LISTING:case $.FIELDSET:case $.BLOCKQUOTE:case $.FIGCAPTION:{VNt(e,t);break}case $.LI:{WNt(e);break}case $.DD:case $.DT:{KNt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{GNt(e);break}case $.BR:{YNt(e);break}case $.BODY:{QNt(e,t);break}case $.HTML:{zNt(e,t);break}case $.FORM:{HNt(e);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{XNt(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:yDe(e,t)}}function vDe(e,t){e.tmplInsertionModeStack.length>0?CDe(e,t):tV(e,t)}function ZNt(e,t){var n;t.tagID===$.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function JNt(e,t){e._err(t,at.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function q5(e,t){if(e.openElements.currentTagId!==void 0&&hDe.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=je.IN_TABLE_TEXT,t.type){case Si.CHARACTER:{wDe(e,t);break}case Si.WHITESPACE_CHARACTER:{xDe(e,t);break}}else qC(e,t)}function eRt(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_CAPTION}function tRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_COLUMN_GROUP}function nRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.COLGROUP,$.COLGROUP),e.insertionMode=je.IN_COLUMN_GROUP,nV(e,t)}function iRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_TABLE_BODY}function rRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.TBODY,$.TBODY),e.insertionMode=je.IN_TABLE_BODY,VP(e,t)}function sRt(e,t){e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function oRt(e,t){bDe(t)?e._appendElement(t,_t.HTML):qC(e,t),t.ackSelfClosing=!0}function aRt(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,_t.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function uw(e,t){switch(t.tagID){case $.TD:case $.TH:case $.TR:{rRt(e,t);break}case $.STYLE:case $.SCRIPT:case $.TEMPLATE:{Bd(e,t);break}case $.COL:{nRt(e,t);break}case $.FORM:{aRt(e,t);break}case $.TABLE:{sRt(e,t);break}case $.TBODY:case $.TFOOT:case $.THEAD:{iRt(e,t);break}case $.INPUT:{oRt(e,t);break}case $.CAPTION:{eRt(e,t);break}case $.COLGROUP:{tRt(e,t);break}default:qC(e,t)}}function dE(e,t){switch(t.tagID){case $.TABLE:{e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode());break}case $.TEMPLATE:{i0(e,t);break}case $.BODY:case $.CAPTION:case $.COL:case $.COLGROUP:case $.HTML:case $.TBODY:case $.TD:case $.TFOOT:case $.TH:case $.THEAD:case $.TR:break;default:qC(e,t)}}function qC(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,QP(e,t),e.fosterParentingEnabled=n}function xDe(e,t){e.pendingCharacterTokens.push(t)}function wDe(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function uO(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===$.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===$.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===$.OPTGROUP&&e.openElements.pop();break}case $.OPTION:{e.openElements.currentTagId===$.OPTION&&e.openElements.pop();break}case $.SELECT:{e.openElements.hasInSelectScope($.SELECT)&&(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode());break}case $.TEMPLATE:{i0(e,t);break}}}function hRt(e,t){const n=t.tagID;n===$.CAPTION||n===$.TABLE||n===$.TBODY||n===$.TFOOT||n===$.THEAD||n===$.TR||n===$.TD||n===$.TH?(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode(),e._processStartTag(t)):SDe(e,t)}function pRt(e,t){const n=t.tagID;n===$.CAPTION||n===$.TABLE||n===$.TBODY||n===$.TFOOT||n===$.THEAD||n===$.TR||n===$.TD||n===$.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode(),e.onEndTag(t)):EDe(e,t)}function mRt(e,t){switch(t.tagID){case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:case $.NOFRAMES:case $.SCRIPT:case $.STYLE:case $.TEMPLATE:case $.TITLE:{Bd(e,t);break}case $.CAPTION:case $.COLGROUP:case $.TBODY:case $.TFOOT:case $.THEAD:{e.tmplInsertionModeStack[0]=je.IN_TABLE,e.insertionMode=je.IN_TABLE,uw(e,t);break}case $.COL:{e.tmplInsertionModeStack[0]=je.IN_COLUMN_GROUP,e.insertionMode=je.IN_COLUMN_GROUP,nV(e,t);break}case $.TR:{e.tmplInsertionModeStack[0]=je.IN_TABLE_BODY,e.insertionMode=je.IN_TABLE_BODY,VP(e,t);break}case $.TD:case $.TH:{e.tmplInsertionModeStack[0]=je.IN_ROW,e.insertionMode=je.IN_ROW,HP(e,t);break}default:e.tmplInsertionModeStack[0]=je.IN_BODY,e.insertionMode=je.IN_BODY,ll(e,t)}}function gRt(e,t){t.tagID===$.TEMPLATE&&i0(e,t)}function CDe(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):tV(e,t)}function bRt(e,t){t.tagID===$.HTML?ll(e,t):GN(e,t)}function TDe(e,t){var n;if(t.tagID===$.HTML){if(e.fragmentContext||(e.insertionMode=je.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===$.HTML){e._setEndLocation(e.openElements.items[0],t);const i=e.openElements.items[1];i&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(i))===null||n===void 0)&&n.endTag)&&e._setEndLocation(i,t)}}else GN(e,t)}function GN(e,t){e.insertionMode=je.IN_BODY,QP(e,t)}function yRt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.FRAMESET:{e._insertElement(t,_t.HTML);break}case $.FRAME:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.NOFRAMES:{Bd(e,t);break}}}function vRt(e,t){t.tagID===$.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==$.FRAMESET&&(e.insertionMode=je.AFTER_FRAMESET))}function xRt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.NOFRAMES:{Bd(e,t);break}}}function wRt(e,t){t.tagID===$.HTML&&(e.insertionMode=je.AFTER_AFTER_FRAMESET)}function ORt(e,t){t.tagID===$.HTML?ll(e,t):X_(e,t)}function X_(e,t){e.insertionMode=je.IN_BODY,QP(e,t)}function kRt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.NOFRAMES:{Bd(e,t);break}}}function SRt(e,t){t.chars=Ss,e._insertCharacters(t)}function ERt(e,t){e._insertCharacters(t),e.framesetOk=!1}function ADe(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==_t.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function CRt(e,t){if(Ujt(t))ADe(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===_t.MATHML?dDe(t):i===_t.SVG&&(Qjt(t),fDe(t)),Jz(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function TRt(e,t){if(t.tagID===$.P||t.tagID===$.BR){ADe(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const i=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(i)===_t.HTML){e._endTagOutsideForeignContent(t);break}const r=e.treeAdapter.getTagName(i);if(r.toLowerCase()===t.tagName){t.tagName=r,e.openElements.shortenToLength(n);break}}}Xe.AREA,Xe.BASE,Xe.BASEFONT,Xe.BGSOUND,Xe.BR,Xe.COL,Xe.EMBED,Xe.FRAME,Xe.HR,Xe.IMG,Xe.INPUT,Xe.KEYGEN,Xe.LINK,Xe.META,Xe.PARAM,Xe.SOURCE,Xe.TRACK,Xe.WBR;const ARt=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,_Rt=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Ate={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function _De(e,t){const n=FRt(e),i=HIe("type",{handlers:{root:jRt,element:NRt,text:RRt,comment:NDe,doctype:IRt,raw:DRt},unknown:MRt}),r={parser:n?new Ete(Ate):Ete.getFragmentParser(void 0,Ate),handle(l){i(l,r)},stitches:!1,options:t||{}};i(e,r),i1(r,Vf());const s=n?r.parser.document:r.parser.getFragment(),o=B_t(s,{file:r.options.file});return r.stitches&&VC(o,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),o.type==="root"&&o.children.length===1&&o.children[0].type===e.type?o.children[0]:o}function jDe(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Si.CHARACTER,chars:e.value,location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function IRt(e,t){const n={type:Si.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function PRt(e,t){t.stitches=!0;const n=BRt(e);if("children"in e&&"children"in n){const i=_De({type:"root",children:e.children},t.options);n.children=i.children}NDe({type:"comment",value:{stitch:n}},t)}function NDe(e,t){const n=e.value,i={type:Si.COMMENT,data:n,location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function DRt(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,RDe(t,Vf(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(ARt,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function MRt(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))PRt(n,t);else{let i="";throw _Rt.has(n.type)&&(i=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+i)}}function i1(e,t){RDe(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ho.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function RDe(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function LRt(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ho.PLAINTEXT)return;i1(t,Vf(e));const i=t.parser.openElements.current;let r="namespaceURI"in i?i.namespaceURI:Pb.html;r===Pb.html&&n==="svg"&&(r=Pb.svg);const s=H_t({...e,children:[]},{space:r===Pb.svg?"svg":"html"}),o={type:Si.START_TAG,tagName:n,tagID:n1(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:WC(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function $Rt(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&J_t.includes(n)||t.parser.tokenizer.state===ho.PLAINTEXT)return;i1(t,MP(e));const i={type:Si.END_TAG,tagName:n,tagID:n1(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:WC(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ho.RCDATA||t.parser.tokenizer.state===ho.RAWTEXT||t.parser.tokenizer.state===ho.SCRIPT_DATA)&&(t.parser.tokenizer.state=ho.DATA)}function FRt(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function WC(e){const t=Vf(e)||{line:void 0,column:void 0,offset:void 0},n=MP(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function BRt(e){return"children"in e?lw({...e,children:[]}):lw(e)}function URt(e){return function(t,n){return _De(t,{...e,file:n})}}const QRt="modulepreload",zRt=function(e){return"/"+e},_te={},Vu=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=zRt(c),c in _te)return;_te[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":QRt,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var VRt=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,HRt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,qRt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,W5={Space_Separator:VRt,ID_Start:HRt,ID_Continue:qRt},so={isSpaceSeparator(e){return typeof e=="string"&&W5.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||W5.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="‌"||e==="‍"||W5.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}};let h8,Sl,Nh,XN,dg,Ad,ca,iV,Xk;var WRt=function(t,n){h8=String(t),Sl="start",Nh=[],XN=0,dg=1,Ad=0,ca=void 0,iV=void 0,Xk=void 0;do ca=KRt(),YRt[Sl]();while(ca.type!=="eof");return typeof n=="function"?p8({"":Xk},"",n):Xk};function p8(e,t,n){const i=e[t];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let r=0;r0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const FTt={tokenize:WTt,partial:!0};function BTt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:VTt,continuation:{tokenize:HTt},exit:qTt}},text:{91:{name:"gfmFootnoteCall",tokenize:zTt},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:UTt,resolveTo:QTt}}}}function UTt(e,t,n){const i=this;let r=i.events.length;const s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;r--;){const c=i.events[r][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Td(i.sliceSerialize({start:o.end,end:i.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function QTt(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function zTt(e,t,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!o||f===null||f===91||Vr(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return r.includes(Td(i.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Vr(f)||(o=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function VTt(e,t,n){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Vr(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return s=Td(i.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Vr(g)||(l=!0),o++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),r.includes(s)||r.push(s),tr(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function HTt(e,t,n){return e.check(QC,t,e.attempt(FTt,t,n))}function qTt(e){e.exit("gfmFootnoteDefinition")}function WTt(e,t,n){const i=this;return tr(e,r,"gfmFootnoteDefinitionIndent",5);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function KTt(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:s,resolveAll:r};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function r(o,l){let c=-1;for(;++c1?c(g):(o.consume(g),f++,m);if(f<2&&!n)return c(g);const v=o.exit("strikethroughSequenceTemporary"),y=aw(g);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(g)}}}class GTt{constructor(){this.map=[]}add(t,n,i){XTt(this,t,n,i)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let r=i.pop();for(;r;){for(const s of r)t.push(s);r=i.pop()}this.map.length=0}}function XTt(e,t,n,i){let r=0;if(!(n===0&&i.length===0)){for(;r-1;){const A=i.events[j][1].type;if(A==="lineEnding"||A==="linePrefix")j--;else break}const T=j>-1?i.events[j][1].type:null,N=T==="tableHead"||T==="tableRow"?k:c;return N===k&&i.parser.lazy[i.now().line]?n(_):N(_)}function c(_){return e.enter("tableHead"),e.enter("tableRow"),u(_)}function u(_){return _===124||(o=!0,s+=1),d(_)}function d(_){return _===null?n(_):Dn(_)?s>1?(s=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),m):n(_):Mi(_)?tr(e,d,"whitespace")(_):(s+=1,o&&(o=!1,r+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(_)))}function f(_){return _===null||_===124||Vr(_)?(e.exit("data"),d(_)):(e.consume(_),_===92?h:f)}function h(_){return _===92||_===124?(e.consume(_),f):f(_)}function m(_){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(_):(e.enter("tableDelimiterRow"),o=!1,Mi(_)?tr(e,g,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):g(_))}function g(_){return _===45||_===58?v(_):_===124?(o=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),b):S(_)}function b(_){return Mi(_)?tr(e,v,"whitespace")(_):v(_)}function v(_){return _===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),y):_===45?(s+=1,y(_)):_===null||Dn(_)?O(_):S(_)}function y(_){return _===45?(e.enter("tableDelimiterFiller"),x(_)):S(_)}function x(_){return _===45?(e.consume(_),x):_===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(_))}function w(_){return Mi(_)?tr(e,O,"whitespace")(_):O(_)}function O(_){return _===124?g(_):_===null||Dn(_)?!o||r!==s?S(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):S(_)}function S(_){return n(_)}function k(_){return e.enter("tableRow"),C(_)}function C(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),C):_===null||Dn(_)?(e.exit("tableRow"),t(_)):Mi(_)?tr(e,C,"whitespace")(_):(e.enter("data"),E(_))}function E(_){return _===null||_===124||Vr(_)?(e.exit("data"),C(_)):(e.consume(_),_===92?R:E)}function R(_){return _===92||_===124?(e.consume(_),E):E(_)}}function eAt(e,t){let n=-1,i=!0,r=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,f;const h=new GTt;for(;++nn[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return r!==void 0&&(s.end=Object.assign({},ov(t.events,r)),e.add(r,0,[["exit",s,t]]),s=void 0),s}function qee(e,t,n,i,r){const s=[],o=ov(t.events,n);r&&(r.end=Object.assign({},o),s.push(["exit",r,t])),i.end=Object.assign({},o),s.push(["exit",i,t]),e.add(n+1,0,s)}function ov(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const tAt={name:"tasklistCheck",tokenize:iAt};function nAt(){return{text:{91:tAt}}}function iAt(e,t,n){const i=this;return r;function r(c){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return Vr(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Dn(c)?t(c):Mi(c)?e.check({tokenize:rAt},t,n)(c):n(c)}}function rAt(e,t,n){return tr(e,i,"whitespace");function i(r){return r===null?n(r):t(r)}}function sAt(e){return vIe([jTt(),BTt(),KTt(e),ZTt(),nAt()])}const oAt={};function aAt(e){const t=this,n=e||oAt,i=t.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(sAt(n)),s.push(CTt()),o.push(TTt(n))}const Wee=function(e,t,n){const i=zC(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` +`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function fPe(e,t,n){return e.type==="element"?mAt(e,t,n):e.type==="text"?n.whitespace==="normal"?hPe(e,n):gAt(e):[]}function mAt(e,t,n){const i=pPe(e,n),r=e.children||[];let s=-1,o=[];if(hAt(e))return o;let l,c;for(a8(e)||Yee(e)&&Wee(t,e,Yee)?c=` +`:fAt(e)?(l=2,c=2):dPe(e)&&(l=1,c=1);++s]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",g=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:k.concat([{begin:/\(/,end:/\)/,keywords:O,contains:k.concat(["self"]),relevance:0}]),relevance:0},E={className:"function",begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:O,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"",keywords:O,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function kAt(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=OAt(e),i=n.keywords;return i.type=[...i.type,...t.type],i.literal=[...i.literal,...t.literal],i.built_in=[...i.built_in,...t.built_in],i._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function Hz(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],m=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],O=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:v,built_in:[...x,...w,"set","shopt",...O,...S]},contains:[m,e.SHEBANG(),g,f,s,o,y,l,c,u,d,n]}}function SAt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",o="("+i+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",v={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},w={begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:v,relevance:0},{begin:m,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function EAt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",o="(?!struct)("+i+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},m=t.optional(r)+e.IDENT_RE+"\\s*\\(",g=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],O={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:k.concat([{begin:/\(/,end:/\)/,keywords:O,contains:k.concat(["self"]),relevance:0}]),relevance:0},E={className:"function",begin:"("+o+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:i,keywords:O,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:O,illegal:"",keywords:O,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:O},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function CAt(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],i=["default","false","null","true"],r=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:r.concat(s),built_in:t,literal:i},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},m=e.inherit(h,{illegal:/\n/}),g={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,m]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],m.contains=[v,g,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},w=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",O={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+w+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},O]}}const TAt=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),AAt=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],_At=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],jAt=[...AAt,..._At],NAt=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),RAt=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),IAt=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),PAt=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function DAt(e){const t=e.regex,n=TAt(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",l=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,i,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+RAt.join("|")+")"},{begin:":(:)?("+IAt.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+PAt.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:NAt.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jAt.join("|")+")\\b"}]}}function MAt(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function LAt(e){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"gPe(e,t,n-1))}function FAt(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",i=n+gPe("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+i+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Zee,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Zee,u]}}const Jee="[A-Za-z$_][0-9A-Za-z$_]*",BAt=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],UAt=["true","false","null","undefined","NaN","Infinity"],bPe=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],yPe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],vPe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],QAt=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zAt=[].concat(vPe,bPe,yPe);function xPe(e){const t=e.regex,n=(L,{after:U})=>{const I="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const I=L[0].length+L.index,H=L.input[I];if(H==="<"||H===","){U.ignoreMatch();return}H===">"&&(n(L,{after:I})||U.ignoreMatch());let K;const F=L.input.substring(I);if(K=F.match(/^\s*=/)){U.ignoreMatch();return}if((K=F.match(/^\s+extends\s+/))&&K.index===0){U.ignoreMatch();return}}},l={$pattern:Jee,keyword:BAt,literal:UAt,built_in:zAt,"variable.language":QAt},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,{match:/\$\d+/},f];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(w)});const O=[].concat(x,h.contains),S=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(O)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},C={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...bPe,...yPe]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,T([...vPe,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},A={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,x,{match:/\$\d+/},f,E,{scope:"attr",match:i+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},N,j,C,P,{match:/\$[(.]/}]}}function wPe(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var lv="[0-9](_*[0-9])*",XA=`\\.(${lv})`,YA="[0-9a-fA-F](_*[0-9a-fA-F])*",VAt={className:"number",variants:[{begin:`(\\b(${lv})((${XA})|\\.)?|(${XA}))[eE][+-]?(${lv})[fFdD]?\\b`},{begin:`\\b(${lv})((${XA})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${XA})[fFdD]?\\b`},{begin:`\\b(${lv})[fFdD]\\b`},{begin:`\\b0[xX]((${YA})\\.?|(${YA})?\\.(${YA}))[pP][+-]?(${lv})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${YA})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function HAt(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},i={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,r]}]};r.contains.push(o);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},u=VAt,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,i,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,o,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const qAt=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),WAt=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],KAt=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],GAt=[...WAt,...KAt],XAt=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),OPe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),kPe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),YAt=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),ZAt=OPe.concat(kPe).sort().reverse();function JAt(e){const t=qAt(e),n=ZAt,i="and or not only",r="[\\w-]+",s="("+r+"|@\\{"+r+"\\})",o=[],l=[],c=function(w){return{className:"string",begin:"~?"+w+".*?"+w}},u=function(w,O,S){return{className:w,begin:O,relevance:S}},d={$pattern:/[a-z-]+/,keyword:i,attribute:XAt.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+r,10),u("variable","@\\{"+r+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:o}),m={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},g={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+YAt.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,u("keyword","all\\b"),u("variable","@\\{"+r+"\\}"),{begin:"\\b("+GAt.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+OPe.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+kPe.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,g,y,m,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function e2t(e){const t="\\[=*\\[",n="\\]=*\\]",i={begin:t,end:n,contains:["self"]},r=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[i],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:r.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:r}].concat(r)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[i],relevance:5}])}}function SPe(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let m=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(m)}),m=m.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:m},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:m}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:m,end:"$"},r,i,c,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function t2t(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function n2t(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],i=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},o={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,s,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,i)},m=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,i),g=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:m("(?:m|qr)?",/\//,/\//)},{begin:m("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:m("m|qr",/\(/,/\)/)},{begin:m("m|qr",/\[/,/\]/)},{begin:m("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=g,o.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:g}}function i2t(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,i=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+i},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(A,P)=>{P.data._beginMatch=A[1]||A[2]},"on:end":(A,P)=>{P.data._beginMatch!==A[1]&&P.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ +]`,g={scope:"string",variants:[d,u,f,h]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],x=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],O={keyword:y,literal:(A=>{const P=[];return A.forEach(D=>{P.push(D),D.toLowerCase()===D?P.push(D.toUpperCase()):P.push(D.toLowerCase())}),P})(v),built_in:x},S=A=>A.map(P=>P.replace(/\|\d+$/,"")),k={variants:[{match:[/new/,t.concat(m,"+"),t.concat("(?!",S(x).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(i,"\\b(?!\\()"),E={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},_={relevance:0,begin:/\(/,end:/\)/,keywords:O,contains:[R,o,E,e.C_BLOCK_COMMENT_MODE,g,b,k]},j={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(x).join("\\b|"),"\\b)"),i,t.concat(m,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[_]};_.contains.push(j);const T=[R,E,e.C_BLOCK_COMMENT_MODE,g,b,k],N={begin:t.concat(/#\[\s*\\?/,t.either(r,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...T]},...T,{scope:"meta",variants:[{match:r},{match:s}]}]};return{case_insensitive:!1,keywords:O,contains:[N,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},o,j,E,{match:[/const/,/\s/,i],scope:{1:"keyword",3:"variable.constant"}},k,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:O,contains:["self",N,o,E,e.C_BLOCK_COMMENT_MODE,g,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},g,b]}}function r2t(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function s2t(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function CPe(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",m=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${i.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${m}))[eE][+-]?(${h})[jJ]?(?=${g})`},{begin:`(${m})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${h})[jJ](?=${g})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,y,f]}]}}function o2t(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function a2t(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[r,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[s,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function l2t(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",i=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=t.concat(i,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",m="[0-9](_?[0-9])*",g={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${m}))?([eE][+-]?(${m})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},k=[f,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:o},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:i,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},g,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=k,b.contains=k;const _=[{begin:/^\s*=>/,starts:{end:"$",contains:k}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:k}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(_).concat(u).concat(k)}}function c2t(e){const t=e.regex,n=/(r#)?/,i=t.concat(n,e.UNDERSCORE_IDENT_RE),r=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},illegal:""},s]}}const u2t=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),d2t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],f2t=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],h2t=[...d2t,...f2t],p2t=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),m2t=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),g2t=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),b2t=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function y2t(e){const t=u2t(e),n=g2t,i=m2t,r="@[a-z-]+",s="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+h2t.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+i.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+b2t.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:p2t.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function v2t(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function x2t(e){const t=e.regex,n=e.COMMENT("--","$"),i={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],m=d,g=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...m),/\s*\(/),relevance:0,keywords:{built_in:m}};function x(S){return t.concat(/\b/,t.either(...S.map(k=>k.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:x(h),relevance:0};function O(S,{exceptions:k,when:C}={}){const E=C;return k=k||[],S.map(R=>R.match(/\|\d+$/)||k.includes(R)?R:E(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:O(g,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:x(o)},w,y,b,i,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function TPe(e){return e?typeof e=="string"?e:e.source:null}function lO(e){return Nr("(?=",e,")")}function Nr(...e){return e.map(n=>TPe(n)).join("")}function w2t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vl(...e){return"("+(w2t(e).capture?"":"?:")+e.map(i=>TPe(i)).join("|")+")"}const qz=e=>Nr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),O2t=["Protocol","Type"].map(qz),ete=["init","self"].map(qz),k2t=["Any","Self"],Q5=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],tte=["false","nil","true"],S2t=["assignment","associativity","higherThan","left","lowerThan","none","right"],E2t=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],nte=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],APe=vl(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_Pe=vl(APe,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),z5=Nr(APe,_Pe,"*"),jPe=vl(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),VN=vl(jPe,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),sf=Nr(jPe,VN,"*"),ZA=Nr(/[A-Z]/,VN,"*"),C2t=["attached","autoclosure",Nr(/convention\(/,vl("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Nr(/objc\(/,sf,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],T2t=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function A2t(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),i=[e.C_LINE_COMMENT_MODE,n],r={match:[/\./,vl(...O2t,...ete)],className:{2:"keyword"}},s={match:Nr(/\./,vl(...Q5)),relevance:0},o=Q5.filter(Ne=>typeof Ne=="string").concat(["_|0"]),l=Q5.filter(Ne=>typeof Ne!="string").concat(k2t).map(qz),c={variants:[{className:"keyword",match:vl(...l,...ete)}]},u={$pattern:vl(/\b\w+/,/#\w+/),keyword:o.concat(E2t),literal:tte},d=[r,s,c],f={match:Nr(/\./,vl(...nte)),relevance:0},h={className:"built_in",match:Nr(/\b/,vl(...nte),/(?=\()/)},m=[f,h],g={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:z5},{match:`\\.(\\.|${_Pe})+`}]},v=[g,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},O=(Ne="")=>({className:"subst",variants:[{match:Nr(/\\/,Ne,/[0\\tnr"']/)},{match:Nr(/\\/,Ne,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(Ne="")=>({className:"subst",match:Nr(/\\/,Ne,/[\t ]*(?:[\r\n]|\r\n)/)}),k=(Ne="")=>({className:"subst",label:"interpol",begin:Nr(/\\/,Ne,/\(/),end:/\)/}),C=(Ne="")=>({begin:Nr(Ne,/"""/),end:Nr(/"""/,Ne),contains:[O(Ne),S(Ne),k(Ne)]}),E=(Ne="")=>({begin:Nr(Ne,/"/),end:Nr(/"/,Ne),contains:[O(Ne),k(Ne)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),E(),E("#"),E("##"),E("###")]},_=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:_},T=Ne=>{const pe=Nr(Ne,/\//),me=Nr(/\//,Ne);return{begin:pe,end:me,contains:[..._,{scope:"comment",begin:`#(?!.*${me})`,end:/$/}]}},N={scope:"regexp",variants:[T("###"),T("##"),T("#"),j]},A={match:Nr(/`/,sf,/`/)},P={className:"variable",match:/\$\d+/},D={className:"variable",match:`\\$${VN}+`},M=[A,P,D],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:T2t,contains:[...v,w,R]}]}},U={scope:"keyword",match:Nr(/@/,vl(...C2t),lO(vl(/\(/,/\s+/)))},I={scope:"meta",match:Nr(/@/,sf)},H=[L,U,I],K={match:lO(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Nr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,VN,"+")},{className:"type",match:ZA,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Nr(/\s+&\s+/,lO(ZA)),relevance:0}]},F={begin://,keywords:u,contains:[...i,...d,...H,g,K]};K.contains.push(F);const W={match:Nr(sf,/\s*:/),keywords:"_|0",relevance:0},V={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",W,...i,N,...d,...m,...v,w,R,...M,...H,K]},X={begin://,keywords:"repeat each",contains:[...i,K]},ie={begin:vl(lO(Nr(sf,/\s*:/)),lO(Nr(sf,/\s+/,sf,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:sf}]},Q={begin:/\(/,end:/\)/,keywords:u,contains:[ie,...i,...d,...v,w,R,...H,K,V],endsParent:!0,illegal:/["']/},Z={match:[/(func|macro)/,/\s+/,vl(A.match,sf,z5)],className:{1:"keyword",3:"title.function"},contains:[X,Q,t],illegal:[/\[/,/%/]},ce={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,Q,t],illegal:/\[|%/},Ee={match:[/operator/,/\s+/,z5],className:{1:"keyword",3:"title"}},Y={begin:[/precedencegroup/,/\s+/,ZA],className:{1:"keyword",3:"title"},contains:[K],keywords:[...S2t,...tte],end:/}/},G={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},te={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ye={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,sf,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[X,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:ZA},...d],relevance:0}]};for(const Ne of R.variants){const pe=Ne.contains.find(se=>se.label==="interpol");pe.keywords=u;const me=[...d,...m,...v,w,R,...M];pe.contains=[...me,{begin:/\(/,end:/\)/,contains:["self",...me]}]}return{name:"Swift",keywords:u,contains:[...i,Z,ce,G,te,ye,Ee,Y,{beginKeywords:"import",end:/$/,contains:[...i],relevance:0},N,...d,...m,...v,w,R,...M,...H,K,V]}}const HN="[A-Za-z$_][0-9A-Za-z$_]*",NPe=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],RPe=["true","false","null","undefined","NaN","Infinity"],IPe=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],PPe=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],DPe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],MPe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LPe=[].concat(DPe,IPe,PPe);function _2t(e){const t=e.regex,n=(L,{after:U})=>{const I="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const I=L[0].length+L.index,H=L.input[I];if(H==="<"||H===","){U.ignoreMatch();return}H===">"&&(n(L,{after:I})||U.ignoreMatch());let K;const F=L.input.substring(I);if(K=F.match(/^\s*=/)){U.ignoreMatch();return}if((K=F.match(/^\s+extends\s+/))&&K.index===0){U.ignoreMatch();return}}},l={$pattern:HN,keyword:NPe,literal:RPe,built_in:LPe,"variable.language":MPe},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,{match:/\$\d+/},f];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(w)});const O=[].concat(x,h.contains),S=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(O)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},C={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...IPe,...PPe]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,T([...DPe,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},A={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,v,x,{match:/\$\d+/},f,E,{scope:"attr",match:i+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},N,j,C,P,{match:/\$[(.]/}]}}function $Pe(e){const t=e.regex,n=_2t(e),i=HN,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:HN,keyword:NPe.concat(c),literal:RPe,built_in:LPe.concat(r),"variable.language":MPe},d={className:"meta",begin:"@"+i},f=(b,v,y)=>{const x=b.contains.findIndex(w=>w.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),m=Object.assign({},h,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([d,s,o,m]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function j2t(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},i={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,r),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(s,r),/ +/,t.either(o,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,i,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function N2t(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),i=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:i},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,r,e.QUOTE_STRING_MODE,c,u,l]}}function R2t(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),i=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(s,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,c,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function FPe(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",i={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},l=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},v=[i,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,b,s,o],y=[...v];return y.pop(),y.push(l),m.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const I2t={arduino:kAt,bash:Hz,c:SAt,cpp:EAt,csharp:CAt,css:DAt,diff:MAt,go:LAt,graphql:$At,ini:mPe,java:FAt,javascript:xPe,json:wPe,kotlin:HAt,less:JAt,lua:e2t,makefile:SPe,markdown:EPe,objectivec:t2t,perl:n2t,php:i2t,"php-template":r2t,plaintext:s2t,python:CPe,"python-repl":o2t,r:a2t,ruby:l2t,rust:c2t,scss:y2t,shell:v2t,sql:x2t,swift:A2t,typescript:$Pe,vbnet:j2t,wasm:N2t,xml:R2t,yaml:FPe};function BPe(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],i=typeof n;(i==="object"||i==="function")&&!Object.isFrozen(n)&&BPe(n)}),e}let ite=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function UPe(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Cm(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(i){for(const r in i)n[r]=i[r]}),n}const P2t="",rte=e=>!!e.scope,D2t=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((i,r)=>`${i}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class M2t{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=UPe(t)}openNode(t){if(!rte(t))return;const n=D2t(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){rte(t)&&(this.buffer+=P2t)}value(){return this.buffer}span(t){this.buffer+=``}}const ste=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Wz{constructor(){this.rootNode=ste(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=ste({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(i=>this._walk(t,i)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Wz._collapse(n)}))}}class L2t extends Wz{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const i=t.root;n&&(i.scope=`language:${n}`),this.add(i)}toHTML(){return new M2t(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function cE(e){return e?typeof e=="string"?e:e.source:null}function QPe(e){return n0("(?=",e,")")}function $2t(e){return n0("(?:",e,")*")}function F2t(e){return n0("(?:",e,")?")}function n0(...e){return e.map(n=>cE(n)).join("")}function B2t(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Kz(...e){return"("+(B2t(e).capture?"":"?:")+e.map(i=>cE(i)).join("|")+")"}function zPe(e){return new RegExp(e.toString()+"|").exec("").length-1}function U2t(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Q2t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gz(e,{joinWith:t}){let n=0;return e.map(i=>{n+=1;const r=n;let s=cE(i),o="";for(;s.length>0;){const l=Q2t.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&n++)}return o}).map(i=>`(${i})`).join(t)}const z2t=/\b\B/,VPe="[a-zA-Z]\\w*",Xz="[a-zA-Z_]\\w*",HPe="\\b\\d+(\\.\\d+)?",qPe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",WPe="\\b(0b[01]+)",V2t="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",H2t=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=n0(t,/.*\b/,e.binary,/\b.*/)),Cm({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},uE={begin:"\\\\[\\s\\S]",relevance:0},q2t={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[uE]},W2t={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[uE]},K2t={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},UP=function(e,t,n={}){const i=Cm({scope:"comment",begin:e,end:t,contains:[]},n);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const r=Kz("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:n0(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},G2t=UP("//","$"),X2t=UP("/\\*","\\*/"),Y2t=UP("#","$"),Z2t={scope:"number",begin:HPe,relevance:0},J2t={scope:"number",begin:qPe,relevance:0},e_t={scope:"number",begin:WPe,relevance:0},t_t={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[uE,{begin:/\[/,end:/\]/,relevance:0,contains:[uE]}]},n_t={scope:"title",begin:VPe,relevance:0},i_t={scope:"title",begin:Xz,relevance:0},r_t={begin:"\\.\\s*"+Xz,relevance:0},s_t=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var JA=Object.freeze({__proto__:null,APOS_STRING_MODE:q2t,BACKSLASH_ESCAPE:uE,BINARY_NUMBER_MODE:e_t,BINARY_NUMBER_RE:WPe,COMMENT:UP,C_BLOCK_COMMENT_MODE:X2t,C_LINE_COMMENT_MODE:G2t,C_NUMBER_MODE:J2t,C_NUMBER_RE:qPe,END_SAME_AS_BEGIN:s_t,HASH_COMMENT_MODE:Y2t,IDENT_RE:VPe,MATCH_NOTHING_RE:z2t,METHOD_GUARD:r_t,NUMBER_MODE:Z2t,NUMBER_RE:HPe,PHRASAL_WORDS_MODE:K2t,QUOTE_STRING_MODE:W2t,REGEXP_MODE:t_t,RE_STARTERS_RE:V2t,SHEBANG:H2t,TITLE_MODE:n_t,UNDERSCORE_IDENT_RE:Xz,UNDERSCORE_TITLE_MODE:i_t});function o_t(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function a_t(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function l_t(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=o_t,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function c_t(e,t){Array.isArray(e.illegal)&&(e.illegal=Kz(...e.illegal))}function u_t(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function d_t(e,t){e.relevance===void 0&&(e.relevance=1)}const f_t=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(i=>{delete e[i]}),e.keywords=n.keywords,e.begin=n0(n.beforeMatch,QPe(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},h_t=["of","and","for","in","not","or","if","then","parent","list","value"],p_t="keyword";function KPe(e,t,n=p_t){const i=Object.create(null);return typeof e=="string"?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach(function(s){Object.assign(i,KPe(e[s],t,s))}),i;function r(s,o){t&&(o=o.map(l=>l.toLowerCase())),o.forEach(function(l){const c=l.split("|");i[c[0]]=[s,m_t(c[0],c[1])]})}}function m_t(e,t){return t?Number(t):g_t(e)?0:1}function g_t(e){return h_t.includes(e.toLowerCase())}const ote={},ey=e=>{console.error(e)},ate=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Q0=(e,t)=>{ote[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),ote[`${e}/${t}`]=!0)},qN=new Error;function GPe(e,t,{key:n}){let i=0;const r=e[n],s={},o={};for(let l=1;l<=t.length;l++)o[l+i]=r[l],s[l+i]=!0,i+=zPe(t[l-1]);e[n]=o,e[n]._emit=s,e[n]._multi=!0}function b_t(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ey("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),qN;if(typeof e.beginScope!="object"||e.beginScope===null)throw ey("beginScope must be object"),qN;GPe(e,e.begin,{key:"beginScope"}),e.begin=Gz(e.begin,{joinWith:""})}}function y_t(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ey("skip, excludeEnd, returnEnd not compatible with endScope: {}"),qN;if(typeof e.endScope!="object"||e.endScope===null)throw ey("endScope must be object"),qN;GPe(e,e.end,{key:"endScope"}),e.end=Gz(e.end,{joinWith:""})}}function v_t(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function x_t(e){v_t(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),b_t(e),y_t(e)}function w_t(e){function t(o,l){return new RegExp(cE(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=zPe(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(Gz(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function r(o){const l=new i;return o.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),o.terminatorEnd&&l.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&l.addRule(o.illegal,{type:"illegal"}),l}function s(o,l){const c=o;if(o.isCompiled)return c;[a_t,u_t,x_t,f_t].forEach(d=>d(o,l)),e.compilerExtensions.forEach(d=>d(o,l)),o.__beforeBegin=null,[l_t,c_t,d_t].forEach(d=>d(o,l)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=KPe(o.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(o.begin||(o.begin=/\B|\b/),c.beginRe=t(c.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(c.endRe=t(c.end)),c.terminatorEnd=cE(c.end)||"",o.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(o.end?"|":"")+l.terminatorEnd)),o.illegal&&(c.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(d){return O_t(d==="self"?o:d)})),o.contains.forEach(function(d){s(d,c)}),o.starts&&s(o.starts,l),c.matcher=r(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Cm(e.classNameAliases||{}),s(e)}function XPe(e){return e?e.endsWithParent||XPe(e.starts):!1}function O_t(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Cm(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:XPe(e)?Cm(e,{starts:e.starts?Cm(e.starts):null}):Object.isFrozen(e)?Cm(e):e}var k_t="11.11.1";class S_t extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const V5=UPe,lte=Cm,cte=Symbol("nomatch"),E_t=7,YPe=function(e){const t=Object.create(null),n=Object.create(null),i=[];let r=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:L2t};function c(D){return l.noHighlightRe.test(D)}function u(D){let M=D.className+" ";M+=D.parentNode?D.parentNode.className:"";const L=l.languageDetectRe.exec(M);if(L){const U=E(L[1]);return U||(ate(s.replace("{}",L[1])),ate("Falling back to no-highlight mode for this block.",D)),U?L[1]:"no-highlight"}return M.split(/\s+/).find(U=>c(U)||E(U))}function d(D,M,L){let U="",I="";typeof M=="object"?(U=D,L=M.ignoreIllegals,I=M.language):(Q0("10.7.0","highlight(lang, code, ...args) has been deprecated."),Q0("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),I=D,U=M),L===void 0&&(L=!0);const H={code:U,language:I};A("before:highlight",H);const K=H.result?H.result:f(H.language,H.code,L);return K.code=H.code,A("after:highlight",K),K}function f(D,M,L,U){const I=Object.create(null);function H(ne,ge){return ne.keywords[ge]}function K(){if(!me.keywords){Se.addText(Le);return}let ne=0;me.keywordPatternRe.lastIndex=0;let ge=me.keywordPatternRe.exec(Le),Ce="";for(;ge;){Ce+=Le.substring(ne,ge.index);const ke=ye.case_insensitive?ge[0].toLowerCase():ge[0],Ke=H(me,ke);if(Ke){const[it,ue]=Ke;if(Se.addText(Ce),Ce="",I[ke]=(I[ke]||0)+1,I[ke]<=E_t&&(be+=ue),it.startsWith("_"))Ce+=ge[0];else{const xe=ye.classNameAliases[it]||it;V(ge[0],xe)}}else Ce+=ge[0];ne=me.keywordPatternRe.lastIndex,ge=me.keywordPatternRe.exec(Le)}Ce+=Le.substring(ne),Se.addText(Ce)}function F(){if(Le==="")return;let ne=null;if(typeof me.subLanguage=="string"){if(!t[me.subLanguage]){Se.addText(Le);return}ne=f(me.subLanguage,Le,!0,se[me.subLanguage]),se[me.subLanguage]=ne._top}else ne=m(Le,me.subLanguage.length?me.subLanguage:null);me.relevance>0&&(be+=ne.relevance),Se.__addSublanguage(ne._emitter,ne.language)}function W(){me.subLanguage!=null?F():K(),Le=""}function V(ne,ge){ne!==""&&(Se.startScope(ge),Se.addText(ne),Se.endScope())}function X(ne,ge){let Ce=1;const ke=ge.length-1;for(;Ce<=ke;){if(!ne._emit[Ce]){Ce++;continue}const Ke=ye.classNameAliases[ne[Ce]]||ne[Ce],it=ge[Ce];Ke?V(it,Ke):(Le=it,K(),Le=""),Ce++}}function ie(ne,ge){return ne.scope&&typeof ne.scope=="string"&&Se.openNode(ye.classNameAliases[ne.scope]||ne.scope),ne.beginScope&&(ne.beginScope._wrap?(V(Le,ye.classNameAliases[ne.beginScope._wrap]||ne.beginScope._wrap),Le=""):ne.beginScope._multi&&(X(ne.beginScope,ge),Le="")),me=Object.create(ne,{parent:{value:me}}),me}function Q(ne,ge,Ce){let ke=U2t(ne.endRe,Ce);if(ke){if(ne["on:end"]){const Ke=new ite(ne);ne["on:end"](ge,Ke),Ke.isMatchIgnored&&(ke=!1)}if(ke){for(;ne.endsParent&&ne.parent;)ne=ne.parent;return ne}}if(ne.endsWithParent)return Q(ne.parent,ge,Ce)}function Z(ne){return me.matcher.regexIndex===0?(Le+=ne[0],1):(Re=!0,0)}function ce(ne){const ge=ne[0],Ce=ne.rule,ke=new ite(Ce),Ke=[Ce.__beforeBegin,Ce["on:begin"]];for(const it of Ke)if(it&&(it(ne,ke),ke.isMatchIgnored))return Z(ge);return Ce.skip?Le+=ge:(Ce.excludeBegin&&(Le+=ge),W(),!Ce.returnBegin&&!Ce.excludeBegin&&(Le=ge)),ie(Ce,ne),Ce.returnBegin?0:ge.length}function Ee(ne){const ge=ne[0],Ce=M.substring(ne.index),ke=Q(me,ne,Ce);if(!ke)return cte;const Ke=me;me.endScope&&me.endScope._wrap?(W(),V(ge,me.endScope._wrap)):me.endScope&&me.endScope._multi?(W(),X(me.endScope,ne)):Ke.skip?Le+=ge:(Ke.returnEnd||Ke.excludeEnd||(Le+=ge),W(),Ke.excludeEnd&&(Le=ge));do me.scope&&Se.closeNode(),!me.skip&&!me.subLanguage&&(be+=me.relevance),me=me.parent;while(me!==ke.parent);return ke.starts&&ie(ke.starts,ne),Ke.returnEnd?0:ge.length}function Y(){const ne=[];for(let ge=me;ge!==ye;ge=ge.parent)ge.scope&&ne.unshift(ge.scope);ne.forEach(ge=>Se.openNode(ge))}let G={};function te(ne,ge){const Ce=ge&&ge[0];if(Le+=ne,Ce==null)return W(),0;if(G.type==="begin"&&ge.type==="end"&&G.index===ge.index&&Ce===""){if(Le+=M.slice(ge.index,ge.index+1),!r){const ke=new Error(`0 width match regex (${D})`);throw ke.languageName=D,ke.badRule=G.rule,ke}return 1}if(G=ge,ge.type==="begin")return ce(ge);if(ge.type==="illegal"&&!L){const ke=new Error('Illegal lexeme "'+Ce+'" for mode "'+(me.scope||"")+'"');throw ke.mode=me,ke}else if(ge.type==="end"){const ke=Ee(ge);if(ke!==cte)return ke}if(ge.type==="illegal"&&Ce==="")return Le+=` +`,1;if(ve>1e5&&ve>ge.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Le+=Ce,Ce.length}const ye=E(D);if(!ye)throw ey(s.replace("{}",D)),new Error('Unknown language: "'+D+'"');const Ne=w_t(ye);let pe="",me=U||Ne;const se={},Se=new l.__emitter(l);Y();let Le="",be=0,Ve=0,ve=0,Re=!1;try{if(ye.__emitTokens)ye.__emitTokens(M,Se);else{for(me.matcher.considerAll();;){ve++,Re?Re=!1:me.matcher.considerAll(),me.matcher.lastIndex=Ve;const ne=me.matcher.exec(M);if(!ne)break;const ge=M.substring(Ve,ne.index),Ce=te(ge,ne);Ve=ne.index+Ce}te(M.substring(Ve))}return Se.finalize(),pe=Se.toHTML(),{language:D,value:pe,relevance:be,illegal:!1,_emitter:Se,_top:me}}catch(ne){if(ne.message&&ne.message.includes("Illegal"))return{language:D,value:V5(M),illegal:!0,relevance:0,_illegalBy:{message:ne.message,index:Ve,context:M.slice(Ve-100,Ve+100),mode:ne.mode,resultSoFar:pe},_emitter:Se};if(r)return{language:D,value:V5(M),illegal:!1,relevance:0,errorRaised:ne,_emitter:Se,_top:me};throw ne}}function h(D){const M={value:V5(D),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return M._emitter.addText(D),M}function m(D,M){M=M||l.languages||Object.keys(t);const L=h(D),U=M.filter(E).filter(_).map(W=>f(W,D,!1));U.unshift(L);const I=U.sort((W,V)=>{if(W.relevance!==V.relevance)return V.relevance-W.relevance;if(W.language&&V.language){if(E(W.language).supersetOf===V.language)return 1;if(E(V.language).supersetOf===W.language)return-1}return 0}),[H,K]=I,F=H;return F.secondBest=K,F}function g(D,M,L){const U=M&&n[M]||L;D.classList.add("hljs"),D.classList.add(`language-${U}`)}function b(D){let M=null;const L=u(D);if(c(L))return;if(A("before:highlightElement",{el:D,language:L}),D.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",D);return}if(D.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(D)),l.throwUnescapedHTML))throw new S_t("One of your code blocks includes unescaped HTML.",D.innerHTML);M=D;const U=M.textContent,I=L?d(U,{language:L,ignoreIllegals:!0}):m(U);D.innerHTML=I.value,D.dataset.highlighted="yes",g(D,L,I.language),D.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(D.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),A("after:highlightElement",{el:D,result:I,text:U})}function v(D){l=lte(l,D)}const y=()=>{O(),Q0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){O(),Q0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function O(){function D(){O()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",D,!1),w=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(D,M){let L=null;try{L=M(e)}catch(U){if(ey("Language definition for '{}' could not be registered.".replace("{}",D)),r)ey(U);else throw U;L=o}L.name||(L.name=D),t[D]=L,L.rawDefinition=M.bind(null,e),L.aliases&&R(L.aliases,{languageName:D})}function k(D){delete t[D];for(const M of Object.keys(n))n[M]===D&&delete n[M]}function C(){return Object.keys(t)}function E(D){return D=(D||"").toLowerCase(),t[D]||t[n[D]]}function R(D,{languageName:M}){typeof D=="string"&&(D=[D]),D.forEach(L=>{n[L.toLowerCase()]=M})}function _(D){const M=E(D);return M&&!M.disableAutodetect}function j(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=M=>{D["before:highlightBlock"](Object.assign({block:M.el},M))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=M=>{D["after:highlightBlock"](Object.assign({block:M.el},M))})}function T(D){j(D),i.push(D)}function N(D){const M=i.indexOf(D);M!==-1&&i.splice(M,1)}function A(D,M){const L=D;i.forEach(function(U){U[L]&&U[L](M)})}function P(D){return Q0("10.7.0","highlightBlock will be removed entirely in v12.0"),Q0("10.7.0","Please use highlightElement now."),b(D)}Object.assign(e,{highlight:d,highlightAuto:m,highlightAll:O,highlightElement:b,highlightBlock:P,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:S,unregisterLanguage:k,listLanguages:C,getLanguage:E,registerAliases:R,autoDetection:_,inherit:lte,addPlugin:T,removePlugin:N}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=k_t,e.regex={concat:n0,lookahead:QPe,either:Kz,optional:F2t,anyNumberOfTimes:$2t};for(const D in JA)typeof JA[D]=="object"&&BPe(JA[D]);return Object.assign(e,JA),e},cw=YPe({});cw.newInstance=()=>YPe({});var C_t=cw;cw.HighlightJS=cw;cw.default=cw;const sl=Ew(C_t),ute={},T_t="hljs-";function A_t(e){const t=sl.newInstance();return e&&s(e),{highlight:n,highlightAuto:i,listLanguages:r,register:s,registerAlias:o,registered:l};function n(c,u,d){const f=d||ute,h=typeof f.prefix=="string"?f.prefix:T_t;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:__t,classPrefix:h});const m=t.highlight(u,{ignoreIllegals:!0,language:c});if(m.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:m.errorRaised});const g=m._emitter.root,b=g.data;return b.language=m.language,b.relevance=m.relevance,g}function i(c,u){const f=(u||ute).subset||r();let h=-1,m=0,g;for(;++hm&&(m=v.data.relevance,g=v)}return g||{type:"root",children:[],data:{language:void 0,relevance:m}}}function r(){return t.listLanguages()}function s(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function o(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class __t{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],i=n.children[n.children.length-1];i&&i.type==="text"?i.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const i=this.stack[this.stack.length-1],r=t.root.children;n?i.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):i.children.push(...r)}openNode(t){const n=this,i=t.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),r=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:i},children:[]};r.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const j_t={};function dte(e){const t=e||j_t,n=t.aliases,i=t.detect||!1,r=t.languages||I2t,s=t.plainText,o=t.prefix,l=t.subset;let c="hljs";const u=A_t(r);if(n&&u.registerAlias(n),o){const d=o.indexOf("-");c=d===-1?o:o.slice(0,d)}return function(d,f){VC(d,"element",function(h,m,g){if(h.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const b=N_t(h);if(b===!1||!b&&!i||b&&s&&s.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=pAt(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:o}):u.highlightAuto(v,{prefix:o,subset:l})}catch(x){const w=x;if(b&&/Unknown language/.test(w.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[g,h],cause:w,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function N_t(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let i;for(;++n-1&&s<=t.length){let o=0;for(;;){let l=n[o];if(l===void 0){const c=pte(t,n[o-1]);l=c===-1?t.length+1:c+1,n[o]=l}if(l>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function r(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length1?n[s.line-2]:0)+s.column-1;if(o=55296&&e<=57343}function ijt(e){return e>=56320&&e<=57343}function rjt(e,t){return(e-55296)*1024+9216+t}function iDe(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function rDe(e){return e>=64976&&e<=65007||njt.has(e)}var at;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(at||(at={}));const sjt=65536;class ojt{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=sjt,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:i,col:r,offset:s}=this,o=r+n,l=s+n;return{code:t,startLine:i,endLine:i,startCol:o,endCol:o,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(ijt(n))return this.pos++,this._addGap(),rjt(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,fe.EOF;return this._err(at.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let i=0;i=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fe.EOF;const i=this.html.charCodeAt(n);return i===fe.CARRIAGE_RETURN?fe.LINE_FEED:i}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fe.EOF;let t=this.html.charCodeAt(this.pos);return t===fe.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,fe.LINE_FEED):t===fe.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,nDe(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===fe.LINE_FEED||t===fe.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){iDe(t)?this._err(at.controlCharacterInInputStream):rDe(t)&&this._err(at.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const ajt=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),ljt=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function cjt(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=ljt.get(e))!==null&&t!==void 0?t:e}var pa;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(pa||(pa={}));const ujt=32;var Tm;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Tm||(Tm={}));function c8(e){return e>=pa.ZERO&&e<=pa.NINE}function djt(e){return e>=pa.UPPER_A&&e<=pa.UPPER_F||e>=pa.LOWER_A&&e<=pa.LOWER_F}function fjt(e){return e>=pa.UPPER_A&&e<=pa.UPPER_Z||e>=pa.LOWER_A&&e<=pa.LOWER_Z||c8(e)}function hjt(e){return e===pa.EQUALS||fjt(e)}var la;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(la||(la={}));var jh;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(jh||(jh={}));class pjt{constructor(t,n,i){this.decodeTree=t,this.emitCodePoint=n,this.errors=i,this.state=la.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=jh.Strict}startEntity(t){this.decodeMode=t,this.state=la.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case la.EntityStart:return t.charCodeAt(n)===pa.NUM?(this.state=la.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=la.NamedEntity,this.stateNamedEntity(t,n));case la.NumericStart:return this.stateNumericStart(t,n);case la.NumericDecimal:return this.stateNumericDecimal(t,n);case la.NumericHex:return this.stateNumericHex(t,n);case la.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|ujt)===pa.LOWER_X?(this.state=la.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=la.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,i,r){if(n!==i){const s=i-n;this.result=this.result*Math.pow(r,s)+Number.parseInt(t.substr(n,s),r),this.consumed+=s}}stateNumericHex(t,n){const i=n;for(;n>14;for(;n>14,s!==0){if(o===pa.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==jh.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:i}=this,r=(i[n]&Tm.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,r,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,i){const{decodeTree:r}=this;return this.emitCodePoint(n===1?r[t]&~Tm.VALUE_LENGTH:r[t+1],i),n===3&&this.emitCodePoint(r[t+2],i),i}end(){var t;switch(this.state){case la.NamedEntity:return this.result!==0&&(this.decodeMode!==jh.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case la.NumericDecimal:return this.emitNumericEntity(0,2);case la.NumericHex:return this.emitNumericEntity(0,3);case la.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case la.EntityStart:return 0}}}function mjt(e,t,n,i){const r=(t&Tm.BRANCH_LENGTH)>>7,s=t&Tm.JUMP_TABLE;if(r===0)return s!==0&&i===s?n:-1;if(s){const c=i-s;return c<0||c>=r?-1:e[n+c]-1}let o=n,l=o+r-1;for(;o<=l;){const c=o+l>>>1,u=e[c];if(ui)l=c-1;else return e[c+r]}return-1}var _t;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(_t||(_t={}));var ty;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(ty||(ty={}));var Eu;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Eu||(Eu={}));var Xe;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(Xe||(Xe={}));var $;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})($||($={}));const gjt=new Map([[Xe.A,$.A],[Xe.ADDRESS,$.ADDRESS],[Xe.ANNOTATION_XML,$.ANNOTATION_XML],[Xe.APPLET,$.APPLET],[Xe.AREA,$.AREA],[Xe.ARTICLE,$.ARTICLE],[Xe.ASIDE,$.ASIDE],[Xe.B,$.B],[Xe.BASE,$.BASE],[Xe.BASEFONT,$.BASEFONT],[Xe.BGSOUND,$.BGSOUND],[Xe.BIG,$.BIG],[Xe.BLOCKQUOTE,$.BLOCKQUOTE],[Xe.BODY,$.BODY],[Xe.BR,$.BR],[Xe.BUTTON,$.BUTTON],[Xe.CAPTION,$.CAPTION],[Xe.CENTER,$.CENTER],[Xe.CODE,$.CODE],[Xe.COL,$.COL],[Xe.COLGROUP,$.COLGROUP],[Xe.DD,$.DD],[Xe.DESC,$.DESC],[Xe.DETAILS,$.DETAILS],[Xe.DIALOG,$.DIALOG],[Xe.DIR,$.DIR],[Xe.DIV,$.DIV],[Xe.DL,$.DL],[Xe.DT,$.DT],[Xe.EM,$.EM],[Xe.EMBED,$.EMBED],[Xe.FIELDSET,$.FIELDSET],[Xe.FIGCAPTION,$.FIGCAPTION],[Xe.FIGURE,$.FIGURE],[Xe.FONT,$.FONT],[Xe.FOOTER,$.FOOTER],[Xe.FOREIGN_OBJECT,$.FOREIGN_OBJECT],[Xe.FORM,$.FORM],[Xe.FRAME,$.FRAME],[Xe.FRAMESET,$.FRAMESET],[Xe.H1,$.H1],[Xe.H2,$.H2],[Xe.H3,$.H3],[Xe.H4,$.H4],[Xe.H5,$.H5],[Xe.H6,$.H6],[Xe.HEAD,$.HEAD],[Xe.HEADER,$.HEADER],[Xe.HGROUP,$.HGROUP],[Xe.HR,$.HR],[Xe.HTML,$.HTML],[Xe.I,$.I],[Xe.IMG,$.IMG],[Xe.IMAGE,$.IMAGE],[Xe.INPUT,$.INPUT],[Xe.IFRAME,$.IFRAME],[Xe.KEYGEN,$.KEYGEN],[Xe.LABEL,$.LABEL],[Xe.LI,$.LI],[Xe.LINK,$.LINK],[Xe.LISTING,$.LISTING],[Xe.MAIN,$.MAIN],[Xe.MALIGNMARK,$.MALIGNMARK],[Xe.MARQUEE,$.MARQUEE],[Xe.MATH,$.MATH],[Xe.MENU,$.MENU],[Xe.META,$.META],[Xe.MGLYPH,$.MGLYPH],[Xe.MI,$.MI],[Xe.MO,$.MO],[Xe.MN,$.MN],[Xe.MS,$.MS],[Xe.MTEXT,$.MTEXT],[Xe.NAV,$.NAV],[Xe.NOBR,$.NOBR],[Xe.NOFRAMES,$.NOFRAMES],[Xe.NOEMBED,$.NOEMBED],[Xe.NOSCRIPT,$.NOSCRIPT],[Xe.OBJECT,$.OBJECT],[Xe.OL,$.OL],[Xe.OPTGROUP,$.OPTGROUP],[Xe.OPTION,$.OPTION],[Xe.P,$.P],[Xe.PARAM,$.PARAM],[Xe.PLAINTEXT,$.PLAINTEXT],[Xe.PRE,$.PRE],[Xe.RB,$.RB],[Xe.RP,$.RP],[Xe.RT,$.RT],[Xe.RTC,$.RTC],[Xe.RUBY,$.RUBY],[Xe.S,$.S],[Xe.SCRIPT,$.SCRIPT],[Xe.SEARCH,$.SEARCH],[Xe.SECTION,$.SECTION],[Xe.SELECT,$.SELECT],[Xe.SOURCE,$.SOURCE],[Xe.SMALL,$.SMALL],[Xe.SPAN,$.SPAN],[Xe.STRIKE,$.STRIKE],[Xe.STRONG,$.STRONG],[Xe.STYLE,$.STYLE],[Xe.SUB,$.SUB],[Xe.SUMMARY,$.SUMMARY],[Xe.SUP,$.SUP],[Xe.TABLE,$.TABLE],[Xe.TBODY,$.TBODY],[Xe.TEMPLATE,$.TEMPLATE],[Xe.TEXTAREA,$.TEXTAREA],[Xe.TFOOT,$.TFOOT],[Xe.TD,$.TD],[Xe.TH,$.TH],[Xe.THEAD,$.THEAD],[Xe.TITLE,$.TITLE],[Xe.TR,$.TR],[Xe.TRACK,$.TRACK],[Xe.TT,$.TT],[Xe.U,$.U],[Xe.UL,$.UL],[Xe.SVG,$.SVG],[Xe.VAR,$.VAR],[Xe.WBR,$.WBR],[Xe.XMP,$.XMP]]);function n1(e){var t;return(t=gjt.get(e))!==null&&t!==void 0?t:$.UNKNOWN}const Pt=$,bjt={[_t.HTML]:new Set([Pt.ADDRESS,Pt.APPLET,Pt.AREA,Pt.ARTICLE,Pt.ASIDE,Pt.BASE,Pt.BASEFONT,Pt.BGSOUND,Pt.BLOCKQUOTE,Pt.BODY,Pt.BR,Pt.BUTTON,Pt.CAPTION,Pt.CENTER,Pt.COL,Pt.COLGROUP,Pt.DD,Pt.DETAILS,Pt.DIR,Pt.DIV,Pt.DL,Pt.DT,Pt.EMBED,Pt.FIELDSET,Pt.FIGCAPTION,Pt.FIGURE,Pt.FOOTER,Pt.FORM,Pt.FRAME,Pt.FRAMESET,Pt.H1,Pt.H2,Pt.H3,Pt.H4,Pt.H5,Pt.H6,Pt.HEAD,Pt.HEADER,Pt.HGROUP,Pt.HR,Pt.HTML,Pt.IFRAME,Pt.IMG,Pt.INPUT,Pt.LI,Pt.LINK,Pt.LISTING,Pt.MAIN,Pt.MARQUEE,Pt.MENU,Pt.META,Pt.NAV,Pt.NOEMBED,Pt.NOFRAMES,Pt.NOSCRIPT,Pt.OBJECT,Pt.OL,Pt.P,Pt.PARAM,Pt.PLAINTEXT,Pt.PRE,Pt.SCRIPT,Pt.SECTION,Pt.SELECT,Pt.SOURCE,Pt.STYLE,Pt.SUMMARY,Pt.TABLE,Pt.TBODY,Pt.TD,Pt.TEMPLATE,Pt.TEXTAREA,Pt.TFOOT,Pt.TH,Pt.THEAD,Pt.TITLE,Pt.TR,Pt.TRACK,Pt.UL,Pt.WBR,Pt.XMP]),[_t.MATHML]:new Set([Pt.MI,Pt.MO,Pt.MN,Pt.MS,Pt.MTEXT,Pt.ANNOTATION_XML]),[_t.SVG]:new Set([Pt.TITLE,Pt.FOREIGN_OBJECT,Pt.DESC]),[_t.XLINK]:new Set,[_t.XML]:new Set,[_t.XMLNS]:new Set},u8=new Set([Pt.H1,Pt.H2,Pt.H3,Pt.H4,Pt.H5,Pt.H6]);Xe.STYLE,Xe.SCRIPT,Xe.XMP,Xe.IFRAME,Xe.NOEMBED,Xe.NOFRAMES,Xe.PLAINTEXT;var Oe;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(Oe||(Oe={}));const ho={DATA:Oe.DATA,RCDATA:Oe.RCDATA,RAWTEXT:Oe.RAWTEXT,SCRIPT_DATA:Oe.SCRIPT_DATA,PLAINTEXT:Oe.PLAINTEXT,CDATA_SECTION:Oe.CDATA_SECTION};function yjt(e){return e>=fe.DIGIT_0&&e<=fe.DIGIT_9}function YO(e){return e>=fe.LATIN_CAPITAL_A&&e<=fe.LATIN_CAPITAL_Z}function vjt(e){return e>=fe.LATIN_SMALL_A&&e<=fe.LATIN_SMALL_Z}function em(e){return vjt(e)||YO(e)}function gte(e){return em(e)||yjt(e)}function e2(e){return e+32}function oDe(e){return e===fe.SPACE||e===fe.LINE_FEED||e===fe.TABULATION||e===fe.FORM_FEED}function bte(e){return oDe(e)||e===fe.SOLIDUS||e===fe.GREATER_THAN_SIGN}function xjt(e){return e===fe.NULL?at.nullCharacterReference:e>1114111?at.characterReferenceOutsideUnicodeRange:nDe(e)?at.surrogateCharacterReference:rDe(e)?at.noncharacterCharacterReference:iDe(e)||e===fe.CARRIAGE_RETURN?at.controlCharacterReference:null}class wjt{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Oe.DATA,this.returnState=Oe.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new ojt(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new pjt(ajt,(i,r)=>{this.preprocessor.pos=this.entityStartPos+r-1,this._flushCodePointConsumedAsCharacterReference(i)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(at.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:i=>{this._err(at.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+i)},validateNumericCharacterReference:i=>{const r=xjt(i);r&&this._err(r,1)}}:void 0)}_err(t,n=0){var i,r;(r=(i=this.handler).onParseError)===null||r===void 0||r.call(i,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,i){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||i==null||i()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(at.endTagWithAttributes),t.selfClosing&&this._err(at.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Si.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Si.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Si.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Si.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=oDe(t)?Si.WHITESPACE_CHARACTER:t===fe.NULL?Si.NULL_CHARACTER:Si.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Si.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=Oe.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?jh.Attribute:jh.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Oe.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Oe.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Oe.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case Oe.DATA:{this._stateData(t);break}case Oe.RCDATA:{this._stateRcdata(t);break}case Oe.RAWTEXT:{this._stateRawtext(t);break}case Oe.SCRIPT_DATA:{this._stateScriptData(t);break}case Oe.PLAINTEXT:{this._statePlaintext(t);break}case Oe.TAG_OPEN:{this._stateTagOpen(t);break}case Oe.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case Oe.TAG_NAME:{this._stateTagName(t);break}case Oe.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case Oe.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case Oe.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case Oe.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case Oe.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case Oe.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case Oe.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case Oe.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case Oe.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case Oe.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case Oe.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case Oe.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case Oe.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case Oe.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case Oe.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case Oe.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case Oe.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case Oe.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case Oe.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case Oe.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case Oe.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case Oe.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case Oe.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case Oe.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case Oe.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case Oe.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case Oe.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case Oe.BOGUS_COMMENT:{this._stateBogusComment(t);break}case Oe.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case Oe.COMMENT_START:{this._stateCommentStart(t);break}case Oe.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case Oe.COMMENT:{this._stateComment(t);break}case Oe.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case Oe.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case Oe.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case Oe.COMMENT_END:{this._stateCommentEnd(t);break}case Oe.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case Oe.DOCTYPE:{this._stateDoctype(t);break}case Oe.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case Oe.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case Oe.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case Oe.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case Oe.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case Oe.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case Oe.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case Oe.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case Oe.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case Oe.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case Oe.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case Oe.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case Oe.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case Oe.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case Oe.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case Oe.CDATA_SECTION:{this._stateCdataSection(t);break}case Oe.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case Oe.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case Oe.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case Oe.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.TAG_OPEN;break}case fe.AMPERSAND:{this._startCharacterReference();break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitCodePoint(t);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case fe.AMPERSAND:{this._startCharacterReference();break}case fe.LESS_THAN_SIGN:{this.state=Oe.RCDATA_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.RAWTEXT_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case fe.LESS_THAN_SIGN:{this.state=Oe.SCRIPT_DATA_LESS_THAN_SIGN;break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case fe.NULL:{this._err(at.unexpectedNullCharacter),this._emitChars(Ss);break}case fe.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(em(t))this._createStartTagToken(),this.state=Oe.TAG_NAME,this._stateTagName(t);else switch(t){case fe.EXCLAMATION_MARK:{this.state=Oe.MARKUP_DECLARATION_OPEN;break}case fe.SOLIDUS:{this.state=Oe.END_TAG_OPEN;break}case fe.QUESTION_MARK:{this._err(at.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Oe.BOGUS_COMMENT,this._stateBogusComment(t);break}case fe.EOF:{this._err(at.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(at.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Oe.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(em(t))this._createEndTagToken(),this.state=Oe.TAG_NAME,this._stateTagName(t);else switch(t){case fe.GREATER_THAN_SIGN:{this._err(at.missingEndTagName),this.state=Oe.DATA;break}case fe.EOF:{this._err(at.eofBeforeTagName),this._emitChars("");break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this.state=Oe.SCRIPT_DATA_ESCAPED,this._emitChars(Ss);break}case fe.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Oe.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===fe.SOLIDUS?this.state=Oe.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:em(t)?(this._emitChars("<"),this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=Oe.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){em(t)?(this.state=Oe.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case fe.NULL:{this._err(at.unexpectedNullCharacter),this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ss);break}case fe.EOF:{this._err(at.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===fe.SOLIDUS?(this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Oe.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(zl.SCRIPT,!1)&&bte(this.preprocessor.peek(zl.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const i=this._indexOf(t);this.items[i]=n,i===this.stackTop&&(this.current=n)}insertAfter(t,n,i){const r=this._indexOf(t)+1;this.items.splice(r,0,n),this.tagIDs.splice(r,0,i),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==_t.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;i--)if(t.has(this.tagIDs[i])&&this.treeAdapter.getNamespaceURI(this.items[i])===n)return i;return-1}clearBackTo(t,n){const i=this._indexOfTagNames(t,n);this.shortenToLength(i+1)}clearBackToTableContext(){this.clearBackTo(Cjt,_t.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Ejt,_t.HTML)}clearBackToTableRowContext(){this.clearBackTo(Sjt,_t.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===$.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===$.HTML}hasInDynamicScope(t,n){for(let i=this.stackTop;i>=0;i--){const r=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case _t.HTML:{if(r===t)return!0;if(n.has(r))return!1;break}case _t.SVG:{if(xte.has(r))return!1;break}case _t.MATHML:{if(vte.has(r))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,WN)}hasInListItemScope(t){return this.hasInDynamicScope(t,Ojt)}hasInButtonScope(t){return this.hasInDynamicScope(t,kjt)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case _t.HTML:{if(u8.has(n))return!0;if(WN.has(n))return!1;break}case _t.SVG:{if(xte.has(n))return!1;break}case _t.MATHML:{if(vte.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===_t.HTML)switch(this.tagIDs[n]){case t:return!0;case $.TABLE:case $.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===_t.HTML)switch(this.tagIDs[t]){case $.TBODY:case $.THEAD:case $.TFOOT:return!0;case $.TABLE:case $.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===_t.HTML)switch(this.tagIDs[n]){case t:return!0;case $.OPTION:case $.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&aDe.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&yte.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&yte.has(this.currentTagId);)this.pop()}}const H5=3;var cf;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(cf||(cf={}));const wte={type:cf.Marker};class _jt{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const i=[],r=n.length,s=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[o.name,o.value]));let s=0;for(let o=0;or.get(c.name)===c.value)&&(s+=1,s>=H5&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(wte)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:cf.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:cf.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(wte);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(i=>i.type===cf.Marker||this.treeAdapter.getTagName(i.element)===t);return n&&n.type===cf.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===cf.Element&&n.element===t)}}const tm={createDocument(){return{nodeName:"#document",mode:Eu.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const i=e.childNodes.indexOf(n);e.childNodes.splice(i,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,i){const r=e.childNodes.find(s=>s.nodeName==="#documentType");if(r)r.name=t,r.publicId=n,r.systemId=i;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:i,parentNode:null};tm.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(tm.isTextNode(n)){n.value+=t;return}}tm.appendChild(e,tm.createTextNode(t))},insertTextBefore(e,t,n){const i=e.childNodes[e.childNodes.indexOf(n)-1];i&&tm.isTextNode(i)?i.value+=t:tm.insertBefore(e,tm.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(i=>i.name));for(let i=0;ie.startsWith(n))}function Djt(e){return e.name===lDe&&e.publicId===null&&(e.systemId===null||e.systemId===jjt)}function Mjt(e){if(e.name!==lDe)return Eu.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===Njt)return Eu.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Ijt.has(n))return Eu.QUIRKS;let i=t===null?Rjt:cDe;if(Ote(n,i))return Eu.QUIRKS;if(i=t===null?uDe:Pjt,Ote(n,i))return Eu.LIMITED_QUIRKS}return Eu.NO_QUIRKS}const kte={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Ljt="definitionurl",$jt="definitionURL",Fjt=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Bjt=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:_t.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:_t.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:_t.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:_t.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:_t.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:_t.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:_t.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:_t.XML}],["xml:space",{prefix:"xml",name:"space",namespace:_t.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:_t.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:_t.XMLNS}]]),Ujt=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Qjt=new Set([$.B,$.BIG,$.BLOCKQUOTE,$.BODY,$.BR,$.CENTER,$.CODE,$.DD,$.DIV,$.DL,$.DT,$.EM,$.EMBED,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HR,$.I,$.IMG,$.LI,$.LISTING,$.MENU,$.META,$.NOBR,$.OL,$.P,$.PRE,$.RUBY,$.S,$.SMALL,$.SPAN,$.STRONG,$.STRIKE,$.SUB,$.SUP,$.TABLE,$.TT,$.U,$.UL,$.VAR]);function zjt(e){const t=e.tagID;return t===$.FONT&&e.attrs.some(({name:i})=>i===ty.COLOR||i===ty.SIZE||i===ty.FACE)||Qjt.has(t)}function dDe(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var i,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(r=(i=this.treeAdapter).onItemPop)===null||r===void 0||r.call(i,t,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(t,n){const i=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===_t.HTML;this.currentNotInHTML=!i,this.tokenizer.inForeignNode=!i&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,_t.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=je.TEXT}switchToPlaintextParsing(){this.insertionMode=je.TEXT,this.originalInsertionMode=je.IN_BODY,this.tokenizer.state=ho.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Xe.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==_t.HTML))switch(this.fragmentContextID){case $.TITLE:case $.TEXTAREA:{this.tokenizer.state=ho.RCDATA;break}case $.STYLE:case $.XMP:case $.IFRAME:case $.NOEMBED:case $.NOFRAMES:case $.NOSCRIPT:{this.tokenizer.state=ho.RAWTEXT;break}case $.SCRIPT:{this.tokenizer.state=ho.SCRIPT_DATA;break}case $.PLAINTEXT:{this.tokenizer.state=ho.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",i=t.publicId||"",r=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,i,r),t.location){const o=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));o&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const i=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,i)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const i=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(i??this.document,t)}}_appendElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location)}_insertElement(t,n){const i=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(i,t.location),this.openElements.push(i,t.tagID)}_insertFakeElement(t,n){const i=this.treeAdapter.createElement(t,_t.HTML,[]);this._attachElementToTree(i,null),this.openElements.push(i,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,_t.HTML,t.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,i),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Xe.HTML,_t.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,$.HTML)}_appendCommentNode(t,n){const i=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,i),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_insertCharacters(t){let n,i;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:i}=this._findFosterParentingLocation(),i?this.treeAdapter.insertTextBefore(n,t.chars,i):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const r=this.treeAdapter.getChildNodes(n),s=i?r.lastIndexOf(i):r.length,o=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,n){for(let i=this.treeAdapter.getFirstChild(t);i;i=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(n,i)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const i=n.location,r=this.treeAdapter.getTagName(t),s=n.type===Si.END_TAG&&r===n.tagName?{endTag:{...i},endLine:i.endLine,endCol:i.endCol,endOffset:i.endOffset}:{endLine:i.startLine,endCol:i.startCol,endOffset:i.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,s)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,i;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,i=this.fragmentContextID):{current:n,currentTagId:i}=this.openElements,t.tagID===$.SVG&&this.treeAdapter.getTagName(n)===Xe.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===_t.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===$.MGLYPH||t.tagID===$.MALIGNMARK)&&i!==void 0&&!this._isIntegrationPoint(i,n,_t.HTML)}_processToken(t){switch(t.type){case Si.CHARACTER:{this.onCharacter(t);break}case Si.NULL_CHARACTER:{this.onNullCharacter(t);break}case Si.COMMENT:{this.onComment(t);break}case Si.DOCTYPE:{this.onDoctype(t);break}case Si.START_TAG:{this._processStartTag(t);break}case Si.END_TAG:{this.onEndTag(t);break}case Si.EOF:{this.onEof(t);break}case Si.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,i){const r=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return Wjt(t,r,s,i)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(r=>r.type===cf.Marker||this.openElements.contains(r.element)),i=n===-1?t-1:n-1;for(let r=i;r>=0;r--){const s=this.activeFormattingElements.entries[r];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=je.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion($.P),this.openElements.popUntilTagNamePopped($.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case $.TR:{this.insertionMode=je.IN_ROW;return}case $.TBODY:case $.THEAD:case $.TFOOT:{this.insertionMode=je.IN_TABLE_BODY;return}case $.CAPTION:{this.insertionMode=je.IN_CAPTION;return}case $.COLGROUP:{this.insertionMode=je.IN_COLUMN_GROUP;return}case $.TABLE:{this.insertionMode=je.IN_TABLE;return}case $.BODY:{this.insertionMode=je.IN_BODY;return}case $.FRAMESET:{this.insertionMode=je.IN_FRAMESET;return}case $.SELECT:{this._resetInsertionModeForSelect(t);return}case $.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case $.HTML:{this.insertionMode=this.headElement?je.AFTER_HEAD:je.BEFORE_HEAD;return}case $.TD:case $.TH:{if(t>0){this.insertionMode=je.IN_CELL;return}break}case $.HEAD:{if(t>0){this.insertionMode=je.IN_HEAD;return}break}}this.insertionMode=je.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const i=this.openElements.tagIDs[n];if(i===$.TEMPLATE)break;if(i===$.TABLE){this.insertionMode=je.IN_SELECT_IN_TABLE;return}}this.insertionMode=je.IN_SELECT}_isElementCausesFosterParenting(t){return hDe.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case $.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===_t.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case $.TABLE:{const i=this.treeAdapter.getParentNode(n);return i?{parent:i,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const i=this.treeAdapter.getNamespaceURI(t);return bjt[i].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){TRt(this,t);return}switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.IN_BODY:case je.IN_CAPTION:case je.IN_CELL:case je.IN_TEMPLATE:{mDe(this,t);break}case je.TEXT:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_TABLE_TEXT:{wDe(this,t);break}case je.IN_COLUMN_GROUP:{KN(this,t);break}case je.AFTER_BODY:{GN(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){CRt(this,t);return}switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.TEXT:{this._insertCharacters(t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_COLUMN_GROUP:{KN(this,t);break}case je.AFTER_BODY:{GN(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){d8(this,t);return}switch(this.insertionMode){case je.INITIAL:case je.BEFORE_HTML:case je.BEFORE_HEAD:case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:case je.IN_BODY:case je.IN_TABLE:case je.IN_CAPTION:case je.IN_COLUMN_GROUP:case je.IN_TABLE_BODY:case je.IN_ROW:case je.IN_CELL:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:case je.IN_TEMPLATE:case je.IN_FRAMESET:case je.AFTER_FRAMESET:{d8(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.AFTER_BODY:{rNt(this,t);break}case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{sNt(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case je.INITIAL:{oNt(this,t);break}case je.BEFORE_HEAD:case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:{this._err(t,at.misplacedDoctype);break}case je.IN_TABLE_TEXT:{uO(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,at.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?ARt(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{aNt(this,t);break}case je.BEFORE_HEAD:{cNt(this,t);break}case je.IN_HEAD:{Bd(this,t);break}case je.IN_HEAD_NO_SCRIPT:{fNt(this,t);break}case je.AFTER_HEAD:{pNt(this,t);break}case je.IN_BODY:{ll(this,t);break}case je.IN_TABLE:{uw(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_CAPTION:{uRt(this,t);break}case je.IN_COLUMN_GROUP:{nV(this,t);break}case je.IN_TABLE_BODY:{VP(this,t);break}case je.IN_ROW:{HP(this,t);break}case je.IN_CELL:{hRt(this,t);break}case je.IN_SELECT:{SDe(this,t);break}case je.IN_SELECT_IN_TABLE:{mRt(this,t);break}case je.IN_TEMPLATE:{bRt(this,t);break}case je.AFTER_BODY:{vRt(this,t);break}case je.IN_FRAMESET:{xRt(this,t);break}case je.AFTER_FRAMESET:{ORt(this,t);break}case je.AFTER_AFTER_BODY:{SRt(this,t);break}case je.AFTER_AFTER_FRAMESET:{ERt(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?_Rt(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{lNt(this,t);break}case je.BEFORE_HEAD:{uNt(this,t);break}case je.IN_HEAD:{dNt(this,t);break}case je.IN_HEAD_NO_SCRIPT:{hNt(this,t);break}case je.AFTER_HEAD:{mNt(this,t);break}case je.IN_BODY:{zP(this,t);break}case je.TEXT:{eRt(this,t);break}case je.IN_TABLE:{dE(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_CAPTION:{dRt(this,t);break}case je.IN_COLUMN_GROUP:{fRt(this,t);break}case je.IN_TABLE_BODY:{f8(this,t);break}case je.IN_ROW:{kDe(this,t);break}case je.IN_CELL:{pRt(this,t);break}case je.IN_SELECT:{EDe(this,t);break}case je.IN_SELECT_IN_TABLE:{gRt(this,t);break}case je.IN_TEMPLATE:{yRt(this,t);break}case je.AFTER_BODY:{TDe(this,t);break}case je.IN_FRAMESET:{wRt(this,t);break}case je.AFTER_FRAMESET:{kRt(this,t);break}case je.AFTER_AFTER_BODY:{X_(this,t);break}}}onEof(t){switch(this.insertionMode){case je.INITIAL:{cO(this,t);break}case je.BEFORE_HTML:{Hk(this,t);break}case je.BEFORE_HEAD:{qk(this,t);break}case je.IN_HEAD:{Wk(this,t);break}case je.IN_HEAD_NO_SCRIPT:{Kk(this,t);break}case je.AFTER_HEAD:{Gk(this,t);break}case je.IN_BODY:case je.IN_TABLE:case je.IN_CAPTION:case je.IN_COLUMN_GROUP:case je.IN_TABLE_BODY:case je.IN_ROW:case je.IN_CELL:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:{vDe(this,t);break}case je.TEXT:{tRt(this,t);break}case je.IN_TABLE_TEXT:{uO(this,t);break}case je.IN_TEMPLATE:{CDe(this,t);break}case je.AFTER_BODY:case je.IN_FRAMESET:case je.AFTER_FRAMESET:case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{tV(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===fe.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case je.IN_HEAD:case je.IN_HEAD_NO_SCRIPT:case je.AFTER_HEAD:case je.TEXT:case je.IN_COLUMN_GROUP:case je.IN_SELECT:case je.IN_SELECT_IN_TABLE:case je.IN_FRAMESET:case je.AFTER_FRAMESET:{this._insertCharacters(t);break}case je.IN_BODY:case je.IN_CAPTION:case je.IN_CELL:case je.IN_TEMPLATE:case je.AFTER_BODY:case je.AFTER_AFTER_BODY:case je.AFTER_AFTER_FRAMESET:{pDe(this,t);break}case je.IN_TABLE:case je.IN_TABLE_BODY:case je.IN_ROW:{q5(this,t);break}case je.IN_TABLE_TEXT:{xDe(this,t);break}}}};function Zjt(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):yDe(e,t),n}function Jjt(e,t){let n=null,i=e.openElements.stackTop;for(;i>=0;i--){const r=e.openElements.items[i];if(r===t.element)break;e._isSpecialElement(r,e.openElements.tagIDs[i])&&(n=r)}return n||(e.openElements.shortenToLength(Math.max(i,0)),e.activeFormattingElements.removeEntry(t)),n}function eNt(e,t,n){let i=t,r=e.openElements.getCommonAncestor(t);for(let s=0,o=r;o!==n;s++,o=r){r=e.openElements.getCommonAncestor(o);const l=e.activeFormattingElements.getElementEntry(o),c=l&&s>=Xjt;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(o)):(o=tNt(e,l),i===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(i),e.treeAdapter.appendChild(o,i),i=o)}return i}function tNt(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),i=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,i),t.element=i,i}function nNt(e,t,n){const i=e.treeAdapter.getTagName(t),r=n1(i);if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);r===$.TEMPLATE&&s===_t.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function iNt(e,t,n){const i=e.treeAdapter.getNamespaceURI(n.element),{token:r}=n,s=e.treeAdapter.createElement(r.tagName,i,r.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,r),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,r.tagID)}function eV(e,t){for(let n=0;n=n;i--)e._setEndLocation(e.openElements.items[i],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const i=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(i);if(r&&!r.endTag&&(e._setEndLocation(i,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&e._setEndLocation(s,t)}}}}function oNt(e,t){e._setDocumentType(t);const n=t.forceQuirks?Eu.QUIRKS:Mjt(t);Djt(t)||e._err(t,at.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=je.BEFORE_HTML}function cO(e,t){e._err(t,at.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Eu.QUIRKS),e.insertionMode=je.BEFORE_HTML,e._processToken(t)}function aNt(e,t){t.tagID===$.HTML?(e._insertElement(t,_t.HTML),e.insertionMode=je.BEFORE_HEAD):Hk(e,t)}function lNt(e,t){const n=t.tagID;(n===$.HTML||n===$.HEAD||n===$.BODY||n===$.BR)&&Hk(e,t)}function Hk(e,t){e._insertFakeRootElement(),e.insertionMode=je.BEFORE_HEAD,e._processToken(t)}function cNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.HEAD:{e._insertElement(t,_t.HTML),e.headElement=e.openElements.current,e.insertionMode=je.IN_HEAD;break}default:qk(e,t)}}function uNt(e,t){const n=t.tagID;n===$.HEAD||n===$.BODY||n===$.HTML||n===$.BR?qk(e,t):e._err(t,at.endTagWithoutMatchingOpenElement)}function qk(e,t){e._insertFakeElement(Xe.HEAD,$.HEAD),e.headElement=e.openElements.current,e.insertionMode=je.IN_HEAD,e._processToken(t)}function Bd(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.TITLE:{e._switchToTextParsing(t,ho.RCDATA);break}case $.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ho.RAWTEXT):(e._insertElement(t,_t.HTML),e.insertionMode=je.IN_HEAD_NO_SCRIPT);break}case $.NOFRAMES:case $.STYLE:{e._switchToTextParsing(t,ho.RAWTEXT);break}case $.SCRIPT:{e._switchToTextParsing(t,ho.SCRIPT_DATA);break}case $.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=je.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(je.IN_TEMPLATE);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:Wk(e,t)}}function dNt(e,t){switch(t.tagID){case $.HEAD:{e.openElements.pop(),e.insertionMode=je.AFTER_HEAD;break}case $.BODY:case $.BR:case $.HTML:{Wk(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function i0(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==$.TEMPLATE&&e._err(t,at.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,at.endTagWithoutMatchingOpenElement)}function Wk(e,t){e.openElements.pop(),e.insertionMode=je.AFTER_HEAD,e._processToken(t)}function fNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BASEFONT:case $.BGSOUND:case $.HEAD:case $.LINK:case $.META:case $.NOFRAMES:case $.STYLE:{Bd(e,t);break}case $.NOSCRIPT:{e._err(t,at.nestedNoscriptInHead);break}default:Kk(e,t)}}function hNt(e,t){switch(t.tagID){case $.NOSCRIPT:{e.openElements.pop(),e.insertionMode=je.IN_HEAD;break}case $.BR:{Kk(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function Kk(e,t){const n=t.type===Si.EOF?at.openElementsLeftAfterEof:at.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=je.IN_HEAD,e._processToken(t)}function pNt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.BODY:{e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=je.IN_BODY;break}case $.FRAMESET:{e._insertElement(t,_t.HTML),e.insertionMode=je.IN_FRAMESET;break}case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:case $.NOFRAMES:case $.SCRIPT:case $.STYLE:case $.TEMPLATE:case $.TITLE:{e._err(t,at.abandonedHeadElementChild),e.openElements.push(e.headElement,$.HEAD),Bd(e,t),e.openElements.remove(e.headElement);break}case $.HEAD:{e._err(t,at.misplacedStartTagForHeadElement);break}default:Gk(e,t)}}function mNt(e,t){switch(t.tagID){case $.BODY:case $.HTML:case $.BR:{Gk(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:e._err(t,at.endTagWithoutMatchingOpenElement)}}function Gk(e,t){e._insertFakeElement(Xe.BODY,$.BODY),e.insertionMode=je.IN_BODY,QP(e,t)}function QP(e,t){switch(t.type){case Si.CHARACTER:{mDe(e,t);break}case Si.WHITESPACE_CHARACTER:{pDe(e,t);break}case Si.COMMENT:{d8(e,t);break}case Si.START_TAG:{ll(e,t);break}case Si.END_TAG:{zP(e,t);break}case Si.EOF:{vDe(e,t);break}}}function pDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function mDe(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function gNt(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function bNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function yNt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_FRAMESET)}function vNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function xNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&u8.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,_t.HTML)}function wNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function ONt(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),n||(e.formElement=e.openElements.current))}function kNt(e,t){e.framesetOk=!1;const n=t.tagID;for(let i=e.openElements.stackTop;i>=0;i--){const r=e.openElements.tagIDs[i];if(n===$.LI&&r===$.LI||(n===$.DD||n===$.DT)&&(r===$.DD||r===$.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==$.ADDRESS&&r!==$.DIV&&r!==$.P&&e._isSpecialElement(e.openElements.items[i],r))break}e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML)}function SNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.tokenizer.state=ho.PLAINTEXT}function ENt(e,t){e.openElements.hasInScope($.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped($.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1}function CNt(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Xe.A);n&&(eV(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function TNt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ANt(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope($.NOBR)&&(eV(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,_t.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function _Nt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function jNt(e,t){e.treeAdapter.getDocumentMode(e.document)!==Eu.QUIRKS&&e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=je.IN_TABLE}function gDe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function bDe(e){const t=sDe(e,ty.TYPE);return t!=null&&t.toLowerCase()===Kjt}function NNt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,_t.HTML),bDe(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function RNt(e,t){e._appendElement(t,_t.HTML),t.ackSelfClosing=!0}function INt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._appendElement(t,_t.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function PNt(e,t){t.tagName=Xe.IMG,t.tagID=$.IMG,gDe(e,t)}function DNt(e,t){e._insertElement(t,_t.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ho.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=je.TEXT}function MNt(e,t){e.openElements.hasInButtonScope($.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ho.RAWTEXT)}function LNt(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ho.RAWTEXT)}function Cte(e,t){e._switchToTextParsing(t,ho.RAWTEXT)}function $Nt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===je.IN_TABLE||e.insertionMode===je.IN_CAPTION||e.insertionMode===je.IN_TABLE_BODY||e.insertionMode===je.IN_ROW||e.insertionMode===je.IN_CELL?je.IN_SELECT_IN_TABLE:je.IN_SELECT}function FNt(e,t){e.openElements.currentTagId===$.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function BNt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,_t.HTML)}function UNt(e,t){e.openElements.hasInScope($.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion($.RTC),e._insertElement(t,_t.HTML)}function QNt(e,t){e._reconstructActiveFormattingElements(),dDe(t),Jz(t),t.selfClosing?e._appendElement(t,_t.MATHML):e._insertElement(t,_t.MATHML),t.ackSelfClosing=!0}function zNt(e,t){e._reconstructActiveFormattingElements(),fDe(t),Jz(t),t.selfClosing?e._appendElement(t,_t.SVG):e._insertElement(t,_t.SVG),t.ackSelfClosing=!0}function Tte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,_t.HTML)}function ll(e,t){switch(t.tagID){case $.I:case $.S:case $.B:case $.U:case $.EM:case $.TT:case $.BIG:case $.CODE:case $.FONT:case $.SMALL:case $.STRIKE:case $.STRONG:{TNt(e,t);break}case $.A:{CNt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{xNt(e,t);break}case $.P:case $.DL:case $.OL:case $.UL:case $.DIV:case $.DIR:case $.NAV:case $.MAIN:case $.MENU:case $.ASIDE:case $.CENTER:case $.FIGURE:case $.FOOTER:case $.HEADER:case $.HGROUP:case $.DIALOG:case $.DETAILS:case $.ADDRESS:case $.ARTICLE:case $.SEARCH:case $.SECTION:case $.SUMMARY:case $.FIELDSET:case $.BLOCKQUOTE:case $.FIGCAPTION:{vNt(e,t);break}case $.LI:case $.DD:case $.DT:{kNt(e,t);break}case $.BR:case $.IMG:case $.WBR:case $.AREA:case $.EMBED:case $.KEYGEN:{gDe(e,t);break}case $.HR:{INt(e,t);break}case $.RB:case $.RTC:{BNt(e,t);break}case $.RT:case $.RP:{UNt(e,t);break}case $.PRE:case $.LISTING:{wNt(e,t);break}case $.XMP:{MNt(e,t);break}case $.SVG:{zNt(e,t);break}case $.HTML:{gNt(e,t);break}case $.BASE:case $.LINK:case $.META:case $.STYLE:case $.TITLE:case $.SCRIPT:case $.BGSOUND:case $.BASEFONT:case $.TEMPLATE:{Bd(e,t);break}case $.BODY:{bNt(e,t);break}case $.FORM:{ONt(e,t);break}case $.NOBR:{ANt(e,t);break}case $.MATH:{QNt(e,t);break}case $.TABLE:{jNt(e,t);break}case $.INPUT:{NNt(e,t);break}case $.PARAM:case $.TRACK:case $.SOURCE:{RNt(e,t);break}case $.IMAGE:{PNt(e,t);break}case $.BUTTON:{ENt(e,t);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{_Nt(e,t);break}case $.IFRAME:{LNt(e,t);break}case $.SELECT:{$Nt(e,t);break}case $.OPTION:case $.OPTGROUP:{FNt(e,t);break}case $.NOEMBED:case $.NOFRAMES:{Cte(e,t);break}case $.FRAMESET:{yNt(e,t);break}case $.TEXTAREA:{DNt(e,t);break}case $.NOSCRIPT:{e.options.scriptingEnabled?Cte(e,t):Tte(e,t);break}case $.PLAINTEXT:{SNt(e,t);break}case $.COL:case $.TH:case $.TD:case $.TR:case $.HEAD:case $.FRAME:case $.TBODY:case $.TFOOT:case $.THEAD:case $.CAPTION:case $.COLGROUP:break;default:Tte(e,t)}}function VNt(e,t){if(e.openElements.hasInScope($.BODY)&&(e.insertionMode=je.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function HNt(e,t){e.openElements.hasInScope($.BODY)&&(e.insertionMode=je.AFTER_BODY,TDe(e,t))}function qNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function WNt(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope($.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped($.FORM):n&&e.openElements.remove(n))}function KNt(e){e.openElements.hasInButtonScope($.P)||e._insertFakeElement(Xe.P,$.P),e._closePElement()}function GNt(e){e.openElements.hasInListItemScope($.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion($.LI),e.openElements.popUntilTagNamePopped($.LI))}function XNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function YNt(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ZNt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function JNt(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Xe.BR,$.BR),e.openElements.pop(),e.framesetOk=!1}function yDe(e,t){const n=t.tagName,i=t.tagID;for(let r=e.openElements.stackTop;r>0;r--){const s=e.openElements.items[r],o=e.openElements.tagIDs[r];if(i===o&&(i!==$.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.stackTop>=r&&e.openElements.shortenToLength(r);break}if(e._isSpecialElement(s,o))break}}function zP(e,t){switch(t.tagID){case $.A:case $.B:case $.I:case $.S:case $.U:case $.EM:case $.TT:case $.BIG:case $.CODE:case $.FONT:case $.NOBR:case $.SMALL:case $.STRIKE:case $.STRONG:{eV(e,t);break}case $.P:{KNt(e);break}case $.DL:case $.UL:case $.OL:case $.DIR:case $.DIV:case $.NAV:case $.PRE:case $.MAIN:case $.MENU:case $.ASIDE:case $.BUTTON:case $.CENTER:case $.FIGURE:case $.FOOTER:case $.HEADER:case $.HGROUP:case $.DIALOG:case $.ADDRESS:case $.ARTICLE:case $.DETAILS:case $.SEARCH:case $.SECTION:case $.SUMMARY:case $.LISTING:case $.FIELDSET:case $.BLOCKQUOTE:case $.FIGCAPTION:{qNt(e,t);break}case $.LI:{GNt(e);break}case $.DD:case $.DT:{XNt(e,t);break}case $.H1:case $.H2:case $.H3:case $.H4:case $.H5:case $.H6:{YNt(e);break}case $.BR:{JNt(e);break}case $.BODY:{VNt(e,t);break}case $.HTML:{HNt(e,t);break}case $.FORM:{WNt(e);break}case $.APPLET:case $.OBJECT:case $.MARQUEE:{ZNt(e,t);break}case $.TEMPLATE:{i0(e,t);break}default:yDe(e,t)}}function vDe(e,t){e.tmplInsertionModeStack.length>0?CDe(e,t):tV(e,t)}function eRt(e,t){var n;t.tagID===$.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function tRt(e,t){e._err(t,at.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function q5(e,t){if(e.openElements.currentTagId!==void 0&&hDe.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=je.IN_TABLE_TEXT,t.type){case Si.CHARACTER:{wDe(e,t);break}case Si.WHITESPACE_CHARACTER:{xDe(e,t);break}}else qC(e,t)}function nRt(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_CAPTION}function iRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_COLUMN_GROUP}function rRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.COLGROUP,$.COLGROUP),e.insertionMode=je.IN_COLUMN_GROUP,nV(e,t)}function sRt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,_t.HTML),e.insertionMode=je.IN_TABLE_BODY}function oRt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Xe.TBODY,$.TBODY),e.insertionMode=je.IN_TABLE_BODY,VP(e,t)}function aRt(e,t){e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function lRt(e,t){bDe(t)?e._appendElement(t,_t.HTML):qC(e,t),t.ackSelfClosing=!0}function cRt(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,_t.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function uw(e,t){switch(t.tagID){case $.TD:case $.TH:case $.TR:{oRt(e,t);break}case $.STYLE:case $.SCRIPT:case $.TEMPLATE:{Bd(e,t);break}case $.COL:{rRt(e,t);break}case $.FORM:{cRt(e,t);break}case $.TABLE:{aRt(e,t);break}case $.TBODY:case $.TFOOT:case $.THEAD:{sRt(e,t);break}case $.INPUT:{lRt(e,t);break}case $.CAPTION:{nRt(e,t);break}case $.COLGROUP:{iRt(e,t);break}default:qC(e,t)}}function dE(e,t){switch(t.tagID){case $.TABLE:{e.openElements.hasInTableScope($.TABLE)&&(e.openElements.popUntilTagNamePopped($.TABLE),e._resetInsertionMode());break}case $.TEMPLATE:{i0(e,t);break}case $.BODY:case $.CAPTION:case $.COL:case $.COLGROUP:case $.HTML:case $.TBODY:case $.TD:case $.TFOOT:case $.TH:case $.THEAD:case $.TR:break;default:qC(e,t)}}function qC(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,QP(e,t),e.fosterParentingEnabled=n}function xDe(e,t){e.pendingCharacterTokens.push(t)}function wDe(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function uO(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===$.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===$.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===$.OPTGROUP&&e.openElements.pop();break}case $.OPTION:{e.openElements.currentTagId===$.OPTION&&e.openElements.pop();break}case $.SELECT:{e.openElements.hasInSelectScope($.SELECT)&&(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode());break}case $.TEMPLATE:{i0(e,t);break}}}function mRt(e,t){const n=t.tagID;n===$.CAPTION||n===$.TABLE||n===$.TBODY||n===$.TFOOT||n===$.THEAD||n===$.TR||n===$.TD||n===$.TH?(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode(),e._processStartTag(t)):SDe(e,t)}function gRt(e,t){const n=t.tagID;n===$.CAPTION||n===$.TABLE||n===$.TBODY||n===$.TFOOT||n===$.THEAD||n===$.TR||n===$.TD||n===$.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped($.SELECT),e._resetInsertionMode(),e.onEndTag(t)):EDe(e,t)}function bRt(e,t){switch(t.tagID){case $.BASE:case $.BASEFONT:case $.BGSOUND:case $.LINK:case $.META:case $.NOFRAMES:case $.SCRIPT:case $.STYLE:case $.TEMPLATE:case $.TITLE:{Bd(e,t);break}case $.CAPTION:case $.COLGROUP:case $.TBODY:case $.TFOOT:case $.THEAD:{e.tmplInsertionModeStack[0]=je.IN_TABLE,e.insertionMode=je.IN_TABLE,uw(e,t);break}case $.COL:{e.tmplInsertionModeStack[0]=je.IN_COLUMN_GROUP,e.insertionMode=je.IN_COLUMN_GROUP,nV(e,t);break}case $.TR:{e.tmplInsertionModeStack[0]=je.IN_TABLE_BODY,e.insertionMode=je.IN_TABLE_BODY,VP(e,t);break}case $.TD:case $.TH:{e.tmplInsertionModeStack[0]=je.IN_ROW,e.insertionMode=je.IN_ROW,HP(e,t);break}default:e.tmplInsertionModeStack[0]=je.IN_BODY,e.insertionMode=je.IN_BODY,ll(e,t)}}function yRt(e,t){t.tagID===$.TEMPLATE&&i0(e,t)}function CDe(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped($.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):tV(e,t)}function vRt(e,t){t.tagID===$.HTML?ll(e,t):GN(e,t)}function TDe(e,t){var n;if(t.tagID===$.HTML){if(e.fragmentContext||(e.insertionMode=je.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===$.HTML){e._setEndLocation(e.openElements.items[0],t);const i=e.openElements.items[1];i&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(i))===null||n===void 0)&&n.endTag)&&e._setEndLocation(i,t)}}else GN(e,t)}function GN(e,t){e.insertionMode=je.IN_BODY,QP(e,t)}function xRt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.FRAMESET:{e._insertElement(t,_t.HTML);break}case $.FRAME:{e._appendElement(t,_t.HTML),t.ackSelfClosing=!0;break}case $.NOFRAMES:{Bd(e,t);break}}}function wRt(e,t){t.tagID===$.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==$.FRAMESET&&(e.insertionMode=je.AFTER_FRAMESET))}function ORt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.NOFRAMES:{Bd(e,t);break}}}function kRt(e,t){t.tagID===$.HTML&&(e.insertionMode=je.AFTER_AFTER_FRAMESET)}function SRt(e,t){t.tagID===$.HTML?ll(e,t):X_(e,t)}function X_(e,t){e.insertionMode=je.IN_BODY,QP(e,t)}function ERt(e,t){switch(t.tagID){case $.HTML:{ll(e,t);break}case $.NOFRAMES:{Bd(e,t);break}}}function CRt(e,t){t.chars=Ss,e._insertCharacters(t)}function TRt(e,t){e._insertCharacters(t),e.framesetOk=!1}function ADe(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==_t.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function ARt(e,t){if(zjt(t))ADe(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),i=e.treeAdapter.getNamespaceURI(n);i===_t.MATHML?dDe(t):i===_t.SVG&&(Vjt(t),fDe(t)),Jz(t),t.selfClosing?e._appendElement(t,i):e._insertElement(t,i),t.ackSelfClosing=!0}}function _Rt(e,t){if(t.tagID===$.P||t.tagID===$.BR){ADe(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const i=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(i)===_t.HTML){e._endTagOutsideForeignContent(t);break}const r=e.treeAdapter.getTagName(i);if(r.toLowerCase()===t.tagName){t.tagName=r,e.openElements.shortenToLength(n);break}}}Xe.AREA,Xe.BASE,Xe.BASEFONT,Xe.BGSOUND,Xe.BR,Xe.COL,Xe.EMBED,Xe.FRAME,Xe.HR,Xe.IMG,Xe.INPUT,Xe.KEYGEN,Xe.LINK,Xe.META,Xe.PARAM,Xe.SOURCE,Xe.TRACK,Xe.WBR;const jRt=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,NRt=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Ate={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function _De(e,t){const n=URt(e),i=HIe("type",{handlers:{root:RRt,element:IRt,text:PRt,comment:NDe,doctype:DRt,raw:LRt},unknown:$Rt}),r={parser:n?new Ete(Ate):Ete.getFragmentParser(void 0,Ate),handle(l){i(l,r)},stitches:!1,options:t||{}};i(e,r),i1(r,Vf());const s=n?r.parser.document:r.parser.getFragment(),o=Q_t(s,{file:r.options.file});return r.stitches&&VC(o,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),o.type==="root"&&o.children.length===1&&o.children[0].type===e.type?o.children[0]:o}function jDe(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Si.CHARACTER,chars:e.value,location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function DRt(e,t){const n={type:Si.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function MRt(e,t){t.stitches=!0;const n=QRt(e);if("children"in e&&"children"in n){const i=_De({type:"root",children:e.children},t.options);n.children=i.children}NDe({type:"comment",value:{stitch:n}},t)}function NDe(e,t){const n=e.value,i={type:Si.COMMENT,data:n,location:WC(e)};i1(t,Vf(e)),t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)}function LRt(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,RDe(t,Vf(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(jRt,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function $Rt(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))MRt(n,t);else{let i="";throw NRt.has(n.type)&&(i=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+i)}}function i1(e,t){RDe(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ho.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function RDe(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function FRt(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ho.PLAINTEXT)return;i1(t,Vf(e));const i=t.parser.openElements.current;let r="namespaceURI"in i?i.namespaceURI:Pb.html;r===Pb.html&&n==="svg"&&(r=Pb.svg);const s=W_t({...e,children:[]},{space:r===Pb.svg?"svg":"html"}),o={type:Si.START_TAG,tagName:n,tagID:n1(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:WC(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function BRt(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&tjt.includes(n)||t.parser.tokenizer.state===ho.PLAINTEXT)return;i1(t,MP(e));const i={type:Si.END_TAG,tagName:n,tagID:n1(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:WC(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ho.RCDATA||t.parser.tokenizer.state===ho.RAWTEXT||t.parser.tokenizer.state===ho.SCRIPT_DATA)&&(t.parser.tokenizer.state=ho.DATA)}function URt(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function WC(e){const t=Vf(e)||{line:void 0,column:void 0,offset:void 0},n=MP(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function QRt(e){return"children"in e?lw({...e,children:[]}):lw(e)}function zRt(e){return function(t,n){return _De(t,{...e,file:n})}}const VRt="modulepreload",HRt=function(e){return"/"+e},_te={},Vu=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=HRt(c),c in _te)return;_te[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":VRt,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var qRt=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,WRt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,KRt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,W5={Space_Separator:qRt,ID_Start:WRt,ID_Continue:KRt},so={isSpaceSeparator(e){return typeof e=="string"&&W5.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||W5.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="‌"||e==="‍"||W5.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}};let h8,Sl,Nh,XN,dg,Ad,ca,iV,Xk;var GRt=function(t,n){h8=String(t),Sl="start",Nh=[],XN=0,dg=1,Ad=0,ca=void 0,iV=void 0,Xk=void 0;do ca=XRt(),JRt[Sl]();while(ca.type!=="eof");return typeof n=="function"?p8({"":Xk},"",n):Xk};function p8(e,t,n){const i=e[t];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let r=0;r0;){const n=Yh();if(!so.isHexDigit(n))throw ds(Et());e+=Et()}return String.fromCodePoint(parseInt(e,16))}const YRt={start(){if(ca.type==="eof")throw nb();K5()},beforePropertyName(){switch(ca.type){case"identifier":case"string":iV=ca.value,Sl="afterPropertyName";return;case"punctuator":t2();return;case"eof":throw nb()}},afterPropertyName(){if(ca.type==="eof")throw nb();Sl="beforePropertyValue"},beforePropertyValue(){if(ca.type==="eof")throw nb();K5()},beforeArrayValue(){if(ca.type==="eof")throw nb();if(ca.type==="punctuator"&&ca.value==="]"){t2();return}K5()},afterPropertyValue(){if(ca.type==="eof")throw nb();switch(ca.value){case",":Sl="beforePropertyName";return;case"}":t2()}},afterArrayValue(){if(ca.type==="eof")throw nb();switch(ca.value){case",":Sl="beforeArrayValue";return;case"]":t2()}},end(){}};function K5(){let e;switch(ca.type){case"punctuator":switch(ca.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=ca.value;break}if(Xk===void 0)Xk=e;else{const t=Nh[Nh.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,iV,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Nh.push(e),Array.isArray(e)?Sl="beforeArrayValue":Sl="beforePropertyName";else{const t=Nh[Nh.length-1];t==null?Sl="end":Array.isArray(t)?Sl="afterArrayValue":Sl="afterPropertyValue"}}function t2(){Nh.pop();const e=Nh[Nh.length-1];e==null?Sl="end":Array.isArray(e)?Sl="afterArrayValue":Sl="afterPropertyValue"}function ds(e){return YN(e===void 0?`JSON5: invalid end of input at ${dg}:${Ad}`:`JSON5: invalid character '${PDe(e)}' at ${dg}:${Ad}`)}function nb(){return YN(`JSON5: invalid end of input at ${dg}:${Ad}`)}function jte(){return Ad-=5,YN(`JSON5: invalid identifier character at ${dg}:${Ad}`)}function ZRt(e){console.warn(`JSON5: '${PDe(e)}' in strings is not valid ECMAScript; consider escaping`)}function PDe(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const n=e.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return e}function YN(e){const t=new SyntaxError(e);return t.lineNumber=dg,t.columnNumber=Ad,t}var JRt=function(t,n,i){const r=[];let s="",o,l,c="",u;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(i=n.space,u=n.quote,n=n.replacer),typeof n=="function")l=n;else if(Array.isArray(n)){o=[];for(const b of n){let v;typeof b=="string"?v=b:(typeof b=="number"||b instanceof String||b instanceof Number)&&(v=String(b)),v!==void 0&&o.indexOf(v)<0&&o.push(v)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),typeof i=="number"?i>0&&(i=Math.min(10,Math.floor(i)),c=" ".substr(0,i)):typeof i=="string"&&(c=i.substr(0,10)),d("",{"":t});function d(b,v){let y=v[b];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(b):typeof y.toJSON=="function"&&(y=y.toJSON(b))),l&&(y=l.call(v,b,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?g(y):h(y)}function f(b){const v={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let x="";for(let O=0;Ov[O]=0)throw TypeError("Converting circular structure to JSON5");r.push(b);let v=s;s=s+c;let y=o||Object.keys(b),x=[];for(const O of y){const S=d(O,b);if(S!==void 0){let k=m(O)+":";c!==""&&(k+=" "),k+=S,x.push(k)}}let w;if(x.length===0)w="{}";else{let O;if(c==="")O=x.join(","),w="{"+O+"}";else{let S=`, +`&&Et(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw ds(Et());case void 0:throw ds(Et())}return Et()}function ZRt(){let e="",t=Yh();if(!so.isHexDigit(t)||(e+=Et(),t=Yh(),!so.isHexDigit(t)))throw ds(Et());return e+=Et(),String.fromCodePoint(parseInt(e,16))}function m8(){let e="",t=4;for(;t-- >0;){const n=Yh();if(!so.isHexDigit(n))throw ds(Et());e+=Et()}return String.fromCodePoint(parseInt(e,16))}const JRt={start(){if(ca.type==="eof")throw nb();K5()},beforePropertyName(){switch(ca.type){case"identifier":case"string":iV=ca.value,Sl="afterPropertyName";return;case"punctuator":t2();return;case"eof":throw nb()}},afterPropertyName(){if(ca.type==="eof")throw nb();Sl="beforePropertyValue"},beforePropertyValue(){if(ca.type==="eof")throw nb();K5()},beforeArrayValue(){if(ca.type==="eof")throw nb();if(ca.type==="punctuator"&&ca.value==="]"){t2();return}K5()},afterPropertyValue(){if(ca.type==="eof")throw nb();switch(ca.value){case",":Sl="beforePropertyName";return;case"}":t2()}},afterArrayValue(){if(ca.type==="eof")throw nb();switch(ca.value){case",":Sl="beforeArrayValue";return;case"]":t2()}},end(){}};function K5(){let e;switch(ca.type){case"punctuator":switch(ca.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=ca.value;break}if(Xk===void 0)Xk=e;else{const t=Nh[Nh.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,iV,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Nh.push(e),Array.isArray(e)?Sl="beforeArrayValue":Sl="beforePropertyName";else{const t=Nh[Nh.length-1];t==null?Sl="end":Array.isArray(t)?Sl="afterArrayValue":Sl="afterPropertyValue"}}function t2(){Nh.pop();const e=Nh[Nh.length-1];e==null?Sl="end":Array.isArray(e)?Sl="afterArrayValue":Sl="afterPropertyValue"}function ds(e){return YN(e===void 0?`JSON5: invalid end of input at ${dg}:${Ad}`:`JSON5: invalid character '${PDe(e)}' at ${dg}:${Ad}`)}function nb(){return YN(`JSON5: invalid end of input at ${dg}:${Ad}`)}function jte(){return Ad-=5,YN(`JSON5: invalid identifier character at ${dg}:${Ad}`)}function eIt(e){console.warn(`JSON5: '${PDe(e)}' in strings is not valid ECMAScript; consider escaping`)}function PDe(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const n=e.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return e}function YN(e){const t=new SyntaxError(e);return t.lineNumber=dg,t.columnNumber=Ad,t}var tIt=function(t,n,i){const r=[];let s="",o,l,c="",u;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(i=n.space,u=n.quote,n=n.replacer),typeof n=="function")l=n;else if(Array.isArray(n)){o=[];for(const b of n){let v;typeof b=="string"?v=b:(typeof b=="number"||b instanceof String||b instanceof Number)&&(v=String(b)),v!==void 0&&o.indexOf(v)<0&&o.push(v)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),typeof i=="number"?i>0&&(i=Math.min(10,Math.floor(i)),c=" ".substr(0,i)):typeof i=="string"&&(c=i.substr(0,10)),d("",{"":t});function d(b,v){let y=v[b];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(b):typeof y.toJSON=="function"&&(y=y.toJSON(b))),l&&(y=l.call(v,b,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?g(y):h(y)}function f(b){const v={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let x="";for(let O=0;Ov[O]=0)throw TypeError("Converting circular structure to JSON5");r.push(b);let v=s;s=s+c;let y=o||Object.keys(b),x=[];for(const O of y){const S=d(O,b);if(S!==void 0){let k=m(O)+":";c!==""&&(k+=" "),k+=S,x.push(k)}}let w;if(x.length===0)w="{}";else{let O;if(c==="")O=x.join(","),w="{"+O+"}";else{let S=`, `+s;O=x.join(S),w=`{ `+s+O+`, `+v+"}"}}return r.pop(),s=v,w}function m(b){if(b.length===0)return f(b);const v=String.fromCodePoint(b.codePointAt(0));if(!so.isIdStartChar(v))return f(b);for(let y=v.length;y=0)throw TypeError("Converting circular structure to JSON5");r.push(b);let v=s;s=s+c;let y=[];for(let w=0;w30)throw new Error("ECharts option nesting is too deep");if(typeof e=="number"&&!Number.isFinite(e))throw new Error("ECharts option contains a non-finite number");if(typeof e=="string"&&iIt.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)ZN(n,t+1);return}if(JO(e))for(const[n,i]of Object.entries(e)){if(nIt.has(n))throw new Error("ECharts option contains an unsafe key");ZN(i,t+1)}}function rIt(e){var i;const t=e.trim(),n=t.match(/^(?:(?:const|let|var)\s+)?option\s*=\s*([\s\S]*?)\s*;?$/);return((i=n==null?void 0:n[1])==null?void 0:i.trim())||t}function sIt(e,t){let n=1,i="",r=!1,s=!1,o=!1;for(let l=t+1;li+2)throw new Error("Invalid ECharts gradient argument count");const r=n.slice(0,i).map(oIt),s=n[i],o=n[i+1]??!1;if(!Array.isArray(s)||typeof o!="boolean")throw new Error("Invalid ECharts gradient data");return e==="linear"?{type:e,x:r[0],y:r[1],x2:r[2],y2:r[3],colorStops:s,global:o}:{type:e,x:r[0],y:r[1],r:r[2],colorStops:s,global:o}}function lIt(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let i="",r=!1,s=!1,o=!1;for(let l=t;ltIt)throw new Error("ECharts option is too large");const n=cIt(rIt(e));let i;try{i=DDe.parse(n)}catch(o){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):o}if(!JO(i))throw new Error("ECharts option must be a data object");ZN(i);const r={...i};r.aria={...JO(r.aria)?r.aria:{},enabled:!0};const s=r.tooltip;return JO(s)?r.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(r.tooltip=s.map(o=>JO(o)?{...o,renderMode:"richText"}:o)),t&&(r.animation=!1),r}let G5;function dIt(){return G5??(G5=Vu(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw G5=void 0,e})),G5}function fIt({source:e}){const{t}=Ae("conversation"),n=p.useRef(null),[i,r]=p.useState(!1),[s,o]=p.useState("");return p.useEffect(()=>{let l=!1,c,u,d;r(!1);try{d=uIt(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),o("")}catch{o("invalid");return}return dIt().then(f=>{const h=n.current;l||!h||(c=f.init(h,void 0,{renderer:"svg"}),c.setOption(d,{notMerge:!0}),typeof ResizeObserver<"u"&&(u=new ResizeObserver(()=>c==null?void 0:c.resize()),u.observe(h)),r(!0))}).catch(()=>{c==null||c.dispose(),c=void 0,l||o("render")}),()=>{l=!0,u==null||u.disconnect(),c==null||c.dispose()}},[e]),a.jsxs("div",{className:`echarts-diagram${s?" echarts-diagram--error":""}`,role:"img","aria-label":t("visualization.echartsAria"),"aria-busy":!i&&!s,children:[a.jsx("div",{ref:n,className:"echarts-diagram__canvas",hidden:!!s}),!i&&!s?a.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:a.jsx(yn,{duration:2.2,spread:15,children:t("visualization.rendering")})}):null,s?a.jsx("p",{className:"echarts-diagram__error",role:"alert",children:t(s==="invalid"?"visualization.invalidEcharts":"visualization.renderFailed")}):null]})}const hIt=p.memo(fIt);let Nte,Rte=Promise.resolve(),pIt=0;function mIt(){return Nte??(Nte=Vu(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-CY863Aa9.js").then(t=>t.ay);return{default:e}},__vite__mapDeps([0,1])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),Nte}function gIt(e){const t=Rte.then(async()=>{const n=await mIt(),i=`mermaid-diagram-${pIt+=1}`;return n.render(i,e)});return Rte=t.then(()=>{},()=>{}),t}function bIt({source:e}){const{t}=Ae("conversation"),n=p.useRef(null),[i,r]=p.useState(null),[s,o]=p.useState(!1);return p.useEffect(()=>{let l=!1;return r(null),o(!1),gIt(e).then(c=>{l||r(c)}).catch(()=>{l||o(!0)}),()=>{l=!0}},[e]),p.useEffect(()=>{!(i!=null&&i.bindFunctions)||!n.current||i.bindFunctions(n.current)},[i]),s?a.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:a.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:t("visualization.mermaidFailed")})}):i?a.jsx("div",{ref:n,className:"mermaid-diagram",role:"img","aria-label":t("visualization.mermaidAria"),dangerouslySetInnerHTML:{__html:i.svg}}):a.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:a.jsx(yn,{duration:2.2,spread:15,children:t("visualization.rendering")})})}const yIt=p.memo(bIt),vIt="_SegmentedControl_1sl7d_1",xIt="_SegmentedControlOption_1sl7d_140",wIt="_SegmentedControlThumb_1sl7d_219",g8={SegmentedControl:vIt,SegmentedControlOption:xIt,SegmentedControlThumb:wIt},ju=({value:e,onChange:t,children:n,block:i,pill:r=!0,size:s="md",gutterSize:o,className:l,onClick:c,...u})=>{const d=p.useRef(null),f=p.useRef(null),h=p.useCallback(g=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let w=Math.floor(y.clientWidth);const O=y.offsetLeft;if(x-(w+O)<2&&(w=w-1),v.style.width=`${Math.floor(w)}px`,v.style.transform=`translateX(${O}px)`,b.scrollWidth>x){const S=x*.15,k=b.scrollLeft,C=y.offsetLeft,E=C+w;(Ck+x-S)&&g&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);QAe({ref:d,onResize:()=>{const g=f.current;if(!g)return;const b=g.style.transition;g.style.transition="",h(!1),g.style.transition=b}}),p.useLayoutEffect(()=>{const g=d.current,b=f.current;!g||!b||(h(!!b.style.transition),b.style.transition||xN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,o,r]);const m=g=>{g&&t&&t(g)};return a.jsxs(Rlt,{ref:d,className:Ti(g8.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:m,onClick:c,"data-block":i?"":void 0,"data-pill":r?"":void 0,"data-size":s,"data-gutter-size":o,...u,children:[a.jsx("div",{className:g8.SegmentedControlThumb,ref:f}),n]})},OIt=({children:e,...t})=>a.jsx(Llt,{className:g8.SegmentedControlOption,...t,onPointerEnter:sQ,children:a.jsx("span",{className:"relative",children:e})});ju.Option=OIt;function kIt({children:e,label:t,language:n,source:i,streaming:r=!1}){const{t:s}=Ae("conversation"),[o,l]=p.useState("preview"),c=r?"code":o;return a.jsxs("section",{className:"visualization-card","aria-label":s("visualization.cardAria",{label:t}),children:[a.jsx("div",{className:"visualization-card__toolbar",children:a.jsxs(ju,{className:"visualization-card__tabs",value:c,size:"sm",gutterSize:"sm",pill:!1,"aria-label":s("visualization.viewAria",{label:t}),onChange:u=>{r||l(u)},children:[a.jsx(ju.Option,{value:"preview",disabled:r,children:s("visualization.preview")}),a.jsx(ju.Option,{value:"code",children:s("visualization.code")})]})}),a.jsx("div",{className:"visualization-card__body",children:c==="code"?a.jsx("pre",{className:"visualization-card__code",children:a.jsx("code",{className:`language-${n}`,children:i})}):e})]})}const SIt=p.memo(kIt);function EIt(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const MDe=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function b8(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(b8).join(""):p.isValidElement(e)?b8(e.props.children):""}function CIt(e){var i;const t=p.Children.toArray(e)[0];if(!p.isValidElement(t))return;const n=(i=t.props.className)==null?void 0:i.split(/\s+/).find(r=>r.startsWith("language-"));return EIt(n==null?void 0:n.slice(9))}function LDe(e){if(!e)return!1;try{const t=e.toLowerCase();return MDe.some(n=>t.includes(n))}catch{return!1}}function TIt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(LDe(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const r=n.map(s=>(s==null?void 0:s.value)||"").join("").toLowerCase();return MDe.some(s=>r.includes(s))}return!1}function AIt({text:e,className:t,allowRawHtml:n=!0,streaming:i=!1}){const{t:r}=Ae("conversation"),[s,o]=p.useState(null),l=(d,f)=>{if(d.src)return d.src;if(f){const h=g=>{var b;if(!g)return null;if(g.type==="source"&&((b=g.properties)!=null&&b.src))return g.properties.src;if(g.children)for(const v of g.children){const y=h(v);if(y)return y}return null},m=h({children:f});if(m)return m}return""},c=d=>{try{const h=new URL(d).pathname.split("/");return h[h.length-1]||"video.mp4"}catch{return"video.mp4"}},u=d=>d?Array.isArray(d)?d.map(f=>(f==null?void 0:f.value)||"").join("")||"video":(d==null?void 0:d.value)||"video":"video";return a.jsxs("div",{className:t?`md ${t}`:"md",children:[a.jsx(qEt,{remarkPlugins:[sAt],rehypePlugins:n?[URt,dte]:[dte],components:{pre:({node:d,children:f,...h})=>{const m=CIt(f);if(m==="mermaid"||m==="echarts"){const g=b8(f).replace(/\n$/,"");return a.jsx(SIt,{label:m==="mermaid"?"Mermaid":"ECharts",language:m,source:g,streaming:i,children:m==="mermaid"?a.jsx(yIt,{source:g}):a.jsx(hIt,{source:g})})}return a.jsx("pre",{...h,children:f})},a:({node:d,...f})=>{const h=f.href;if(h&&(LDe(h)||TIt(d))){const m=h,g=u(d==null?void 0:d.children);return a.jsxs("div",{className:"video-container",children:[a.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.playVideo",{name:g}),onClick:()=>o({src:m,title:g}),children:[a.jsx("video",{src:m,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),a.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]}),a.jsx("div",{className:"video-caption",children:a.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:g})})]})}return a.jsx("a",{...f,target:"_blank",rel:"noopener noreferrer"})},img:({node:d,src:f,alt:h,...m})=>{const g=a.jsx("img",{...m,src:f,alt:h??"",loading:"lazy"});return f?a.jsx(BSe,{src:f,children:a.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":r("markdown.enlargeImage",{name:h||r("markdown.image")}),children:[g,a.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]})}):g},video:({node:d,src:f,children:h,...m})=>{const g=l({src:f},h);return g?a.jsx("div",{className:"video-container",children:a.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.enlargeVideo"),onClick:()=>o({src:g}),children:[a.jsx("video",{src:g,...m,playsInline:!0,className:"video-thumbnail",children:h}),a.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]})}):a.jsx("video",{src:f,controls:!0,playsInline:!0,className:"video-inline",...m,children:h})}},children:e}),s&&a.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":r("markdown.videoPreview"),onClick:()=>o(null),children:a.jsxs("div",{className:"video-viewer",onClick:d=>d.stopPropagation(),children:[a.jsxs("div",{className:"video-viewer-header",children:[a.jsx("div",{className:"video-viewer-title",children:s.title||c(s.src)}),a.jsxs("nav",{className:"video-viewer-nav",children:[a.jsx("a",{href:s.src,download:s.title||c(s.src),"aria-label":r("markdown.downloadVideo"),title:r("markdown.downloadVideo"),className:"video-viewer-download",children:a.jsx(eP,{})}),a.jsx("button",{type:"button",className:"video-viewer-close","aria-label":r("markdown.close"),onClick:()=>o(null),children:a.jsx(xa,{})})]})]}),a.jsx("div",{className:"video-viewer-body",children:a.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Yu=p.memo(AIt);function X5(e){return(e==null?void 0:e.trim())||Ig("resourceMetadata.unknownSource")}function $De(e){return(e==null?void 0:e.trim())||Ig("resourceMetadata.unknownCreator")}function _It(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5 5.5A2.5 2.5 0 0 1 7.5 3H19v16H7.5A2.5 2.5 0 0 0 5 21.5v-16Z"}),a.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),a.jsx("path",{d:"M9 7h6M9 10h4"})]})}function jIt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),a.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function NIt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function RIt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 5v14M5 12h14"})})}function KC({title:e,children:t,onClose:n,busy:i=!1,className:r=""}){const{t:s}=Ae("ui"),o=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(i),d=p.useRef(n);return p.useEffect(()=>{u.current=i,d.current=n},[i,n]),p.useEffect(()=>{var g;const f=document.activeElement instanceof HTMLElement?document.activeElement:null,h=document.body.style.overflow;document.body.style.overflow="hidden",(g=l.current)==null||g.focus();const m=b=>{if(b.key==="Escape"&&!u.current){d.current();return}if(b.key!=="Tab")return;const v=c.current;if(!v)return;const y=Array.from(v.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], audio[controls], video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(O=>O.getClientRects().length>0);if(y.length===0){b.preventDefault();return}const x=y[0],w=y[y.length-1];b.shiftKey&&(document.activeElement===x||!v.contains(document.activeElement))?(b.preventDefault(),w.focus()):!b.shiftKey&&(document.activeElement===w||!v.contains(document.activeElement))&&(b.preventDefault(),x.focus())};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),document.body.style.overflow=h,f!=null&&f.isConnected&&f.focus()}},[]),ri.createPortal(a.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&!i&&n()},children:a.jsxs("section",{ref:c,className:`knowledge-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":o,"aria-busy":i||void 0,children:[a.jsxs("header",{className:"knowledge-dialog__header",children:[a.jsx("h2",{id:o,children:e}),a.jsx("button",{ref:l,type:"button",onClick:n,disabled:i,"aria-label":s("common.close"),children:a.jsx(NIt,{})})]}),t]})}),document.body)}function fE({message:e}){return e?a.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function y8(e){return e instanceof DOMException&&e.name==="AbortError"}function IIt(e,t){if(!e)return"";const n=Date.parse(e);return Number.isFinite(n)?new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(n):e}const FDe=[".jpg",".jpeg",".png"].join(","),PIt=new Set(FDe.split(",")),BDe=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),DIt=new Set(BDe.split(",")),MIt=200*1024*1024;function v8(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function LIt(e,t,n){return e.size>MIt?n("knowledge.errors.fileTooLarge"):t==="image"?PIt.has(v8(e.name))?"":n("knowledge.errors.invalidImageType"):DIt.has(v8(e.name))?"":n("knowledge.errors.invalidDocumentType")}function rV(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function x8(e){var r;const t=e.type.trim().replace(/^\./,"");if(t)return t.toUpperCase();const n=e.name.trim(),i=n.includes(".")?(r=n.split(".").pop())==null?void 0:r.trim():"";return i?i.toUpperCase():"-"}function $It({region:e,onClose:t,onCreated:n}){const{t:i}=Ae("ui"),[r,s]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(""),g=r.trim(),b=!!(g&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(g)),v=async y=>{if(y.preventDefault(),u(!0),!g||b)return;f(!0),m("");const x={name:g,description:o.trim()||void 0,region:e};try{n(await o1t(x))}catch(w){m(el(w,i("knowledge.errors.createBase")))}finally{f(!1)}};return a.jsx(KC,{title:i("knowledge.createBase"),onClose:t,busy:d,children:a.jsxs("form",{onSubmit:y=>void v(y),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:i("common.name")}),a.jsx("input",{autoFocus:!0,value:r,maxLength:48,"aria-invalid":c&&b||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>u(!0),onChange:y=>s(y.target.value)})]}),a.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${c&&b?" is-error":""}`,role:c&&b?"alert":void 0,children:i(c&&b?"knowledge.invalidName":"knowledge.nameHelp")}),a.jsxs("label",{children:[a.jsx("span",{children:i("knowledge.optionalDescription")}),a.jsx("textarea",{value:o,maxLength:80,onChange:y=>l(y.target.value)})]}),a.jsx(fE,{message:h})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:d,children:i("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:d||!g||b,children:i(d?"common.creating":"common.create")})]})]})})}function FIt({item:e,onClose:t,onUpdated:n}){const{t:i}=Ae("ui"),[r,s]=p.useState(e.description),[o,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault(),l(!0),u("");try{n(await a1t(e.id,e.region,{description:r.trim()}))}catch(h){u(el(h,i("knowledge.errors.updateBase")))}finally{l(!1)}};return a.jsx(KC,{title:i("knowledge.editBase"),onClose:t,busy:o,children:a.jsxs("form",{onSubmit:f=>void d(f),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:i("common.name")}),a.jsx("input",{value:e.name,disabled:!0})]}),a.jsxs("label",{children:[a.jsx("span",{children:i("common.description")}),a.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:f=>s(f.target.value)})]}),a.jsx("p",{className:"knowledge-dialog__note",children:i("knowledge.descriptionOnly")}),a.jsx(fE,{message:c})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:o,children:i("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:o,children:i(o?"common.saving":"common.save")})]})]})})}function UDe(e,t){if(!e.trim())return{};const n=JSON.parse(e);if(!n||Array.isArray(n)||typeof n!="object")throw new Error(t);return n}function BIt({base:e,onClose:t,onCreated:n,onAssociationInvalid:i}){const{t:r}=Ae("ui"),[s,o]=p.useState("document"),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(""),[m,g]=p.useState(null),[b,v]=p.useState(!1),[y,x]=p.useState("{}"),[w,O]=p.useState(""),[S,k]=p.useState(""),[C,E]=p.useState(null),R=p.useRef(null),_=p.useRef(null),j=p.useRef(null),T=p.useRef(0),N=!!w;p.useEffect(()=>{var L;C&&!N&&((L=j.current)==null||L.focus())},[N,C]);const A=L=>{N||L===s||(o(L),g(null),h(""),c(""),d(""),k(""),E(null),v(!1),T.current=0,R.current&&(R.current.value=""))},P=L=>{if(!L||s==="web")return;const U=LIt(L,s,r);if(U){g(null),c(""),d(""),k(U);return}g(L),k(""),c(L.name.replace(/\.[^.]+$/,"")),d(v8(L.name).slice(1))},D=async L=>{if(L.preventDefault(),s==="web"?!f.trim():!m)return;let U;try{U=UDe(y,r("knowledge.errors.metadataObject"))}catch(I){k(el(I,r("knowledge.errors.metadataFormat")));return}O(s==="web"?C?"save":"preview":"upload"),k("");try{if(s==="web")if(C){const I={sourceType:"url",metadata:C.metadata,url:C.preview.url,sourceTitle:C.preview.name,sourceMarkdown:C.preview.sourceMarkdown};await d1t(e.id,e.region,I),n()}else{const I=await f1t(e.id,e.region,{url:f.trim()});if(!I.sourceMarkdown.trim())throw new Error(r("knowledge.errors.noWebPreview"));E({preview:I,metadata:U})}else m&&(await h1t(e.id,e.region,{file:m,name:l.trim()||void 0,documentType:u.trim()||void 0,metadata:U}),n())}catch(I){I instanceof IP&&I.errorCode===eIe?i(I):k(el(I,r(s==="web"?C?"knowledge.errors.addWeb":"knowledge.errors.previewWeb":"knowledge.errors.uploadFile")))}finally{O("")}},M=()=>{N||(E(null),k(""),requestAnimationFrame(()=>{var L;return(L=_.current)==null?void 0:L.focus()}))};return a.jsx(KC,{title:r(C?"knowledge.previewWeb":"knowledge.addData"),onClose:t,busy:N,className:C?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:a.jsx("form",{onSubmit:L=>void D(L),children:C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[a.jsxs("div",{className:"knowledge-preview__meta",children:[a.jsx("strong",{title:C.preview.name,children:C.preview.name}),a.jsx("a",{href:C.preview.url,target:"_blank",rel:"noopener noreferrer",children:r("knowledge.openOriginalWeb")})]}),a.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:a.jsx("div",{className:"knowledge-preview__markdown-shell",children:a.jsx(Yu,{text:C.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),S?a.jsx("div",{className:"knowledge-web-preview__error",children:a.jsx(fE,{message:S})}):null]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",className:"is-back",onClick:M,disabled:N,children:r("knowledge.backToEdit")}),a.jsx("button",{type:"button",onClick:t,disabled:N,children:r("common.cancel")}),a.jsx("button",{ref:j,type:"submit",className:"is-primary",disabled:N,children:r(w==="save"?"common.adding":"knowledge.confirmAdd")})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsx("div",{className:"knowledge-source-tabs",role:"tablist","aria-label":r("knowledge.source"),children:[["image",r("knowledge.image")],["document",r("knowledge.documentFile")],["web",r("knowledge.webPage")]].map(([L,U])=>a.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${L}-tab`,"aria-controls":`knowledge-source-${L}-panel`,"aria-selected":s===L,tabIndex:s===L?0:-1,className:s===L?"is-active":"",disabled:N,onClick:()=>A(L),onKeyDown:I=>{const H=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(I.key))return;I.preventDefault();const K=H.indexOf(L),F=I.key==="Home"?H[0]:I.key==="End"?H[H.length-1]:H[(K+(I.key==="ArrowRight"?1:-1)+H.length)%H.length];A(F),requestAnimationFrame(()=>{var W;return(W=document.getElementById(`knowledge-source-${F}-tab`))==null?void 0:W.focus()})},children:U},L))}),a.jsx("div",{id:`knowledge-source-${s}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${s}-tab`,children:s==="web"?a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.webUrl")}),a.jsx("input",{ref:_,autoFocus:!0,type:"url",value:f,disabled:N,onChange:L=>{h(L.target.value),k("")},placeholder:"https://example.com/article"})]}),a.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:w==="preview"?a.jsx(yn,{children:r("knowledge.generatingWebPreview")}):null})]}):a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:R,className:"knowledge-upload-input",type:"file","aria-label":r("knowledge.selectFile"),accept:s==="image"?FDe:BDe,disabled:N,onChange:L=>{var U;P(((U=L.currentTarget.files)==null?void 0:U[0])??null),L.currentTarget.value=""}}),a.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${m?" is-ready":""}`,disabled:N,onClick:()=>{var L;return(L=R.current)==null?void 0:L.click()},onDragEnter:L=>{L.preventDefault(),!N&&(T.current+=1,v(!0))},onDragOver:L=>{L.preventDefault(),N||(L.dataTransfer.dropEffect="copy")},onDragLeave:L=>{L.preventDefault(),T.current=Math.max(0,T.current-1),T.current===0&&v(!1)},onDrop:L=>{var U;L.preventDefault(),T.current=0,v(!1),N||P(((U=L.dataTransfer.files)==null?void 0:U[0])??null)},children:[a.jsx("strong",{children:m?m.name:r("knowledge.selectOrDropFile")}),a.jsx("span",{children:m?r("knowledge.selectedFile",{size:rV(m.size)}):r(s==="image"?"knowledge.imageFileHelp":"knowledge.documentFileHelp")})]}),a.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:N?a.jsx(yn,{children:r("knowledge.uploadingFile")}):null})]})}),s!=="web"?a.jsxs("div",{className:"knowledge-dialog__fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.optionalName")}),a.jsx("input",{value:l,disabled:N,maxLength:256,onChange:L=>c(L.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.optionalType")}),a.jsx("input",{value:u,disabled:N,maxLength:64,onChange:L=>d(L.target.value),placeholder:"pdf, docx, png"})]})]}):null,a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.metadataJson")}),a.jsx("textarea",{className:"is-code",value:y,disabled:N,onChange:L=>x(L.target.value),spellCheck:!1})]}),a.jsx(fE,{message:S})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:N,children:r("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:N||(s==="web"?!f.trim():!m),children:r(N?s==="web"?"common.generating":"common.uploading":s==="web"?"knowledge.generatePreview":"knowledge.uploadFile")})]})]})})})}function UIt({base:e,item:t,onClose:n,onUpdated:i}){const{t:r}=Ae("ui"),[s,o]=p.useState(()=>JSON.stringify(t.metadata??{},null,2)),[l,c]=p.useState(!1),[u,d]=p.useState(""),f=async h=>{h.preventDefault();let m;try{m=UDe(s,r("knowledge.errors.metadataObject"))}catch(g){d(el(g,r("knowledge.errors.metadataFormat")));return}c(!0),d("");try{i(await p1t(e.id,t.id,e.region,{metadata:m}))}catch(g){d(el(g,r("knowledge.errors.updateDocument")))}finally{c(!1)}};return a.jsx(KC,{title:r("knowledge.editMetadata"),onClose:n,busy:l,children:a.jsxs("form",{onSubmit:h=>void f(h),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.knowledge")}),a.jsx("input",{value:t.name||t.id,disabled:!0})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.metadataJson")}),a.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:s,onChange:h=>o(h.target.value),spellCheck:!1})]}),a.jsx(fE,{message:u})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:n,disabled:l,children:r("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:l,children:r(l?"common.saving":"common.save")})]})]})})}const QDe=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),zDe=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),VDe=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),QIt=new Set(["pdf"]),zIt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),VIt=new Set(["creating","indexing","pending","processing","queued","submitted"]),HIt=new Set(["error","failed","unavailable"]);function Ite(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function n2(e){if(e==null||e==="")return"-";if(["string","number","boolean"].includes(typeof e))return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function qIt(e,t){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(Ite);if(r.some(s=>Object.keys(s).length>0)){const s=[...new Set(r.flatMap(o=>Object.keys(o)))];return{columns:s,rows:r.map(o=>s.map(l=>n2(o[l])))}}return{columns:[t("knowledge.value")],rows:e.map(s=>[n2(s)])}}const n=Ite(e),i=Object.entries(n);if(i.length===0)return null;if(i.every(([,r])=>Array.isArray(r))){const r=i.map(([o])=>o),s=Math.max(...i.map(([,o])=>o.length));return{columns:r,rows:Array.from({length:s},(o,l)=>i.map(([,c])=>n2(c[l])))}}return{columns:[t("knowledge.field"),t("knowledge.value")],rows:i.map(([r,s])=>[r,n2(s)])}}function HDe(e){const t=e.trim();if(!t||t.startsWith("//"))return"";if(t.startsWith("/"))return t;try{const n=new URL(t);return["http:","https:"].includes(n.protocol)?n.href:""}catch{return""}}function WIt(e){const t=HDe(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function KIt(e){var r;const t=e.attachmentType.trim().toLocaleLowerCase();if(t==="image"||t==="doc-image"||t.startsWith("image/"))return"image";if(t==="audio"||t.startsWith("audio/"))return"audio";if(t==="video"||t.startsWith("video/"))return"video";if(t==="pdf"||t==="application/pdf")return"pdf";const n=e.attachmentUrl.split(/[?#]/,1)[0],i=n.includes(".")?((r=n.split(".").pop())==null?void 0:r.toLocaleLowerCase())??"":"";return QDe.has(i)?"image":zDe.has(i)?"audio":VDe.has(i)?"video":QIt.has(i)?"pdf":t||i?"file":"none"}function GIt(e,t){const n=e.status.trim().toLocaleLowerCase();if(VIt.has(n))return{title:t("knowledge.preview.processingTitle"),detail:t("knowledge.preview.processingDetail")};if(HIt.has(n))return{title:t("knowledge.preview.failedTitle"),detail:t("knowledge.preview.failedDetail")};const i=x8(e).toLocaleLowerCase();return i==="pdf"||zIt.has(i)?{title:t("knowledge.preview.noParsedTitle"),detail:t("knowledge.preview.noParsedDetail")}:QDe.has(i)||zDe.has(i)||VDe.has(i)?{title:t("knowledge.preview.noMediaTitle"),detail:t("knowledge.preview.noMediaDetail")}:{title:t("knowledge.preview.noDataTitle"),detail:t("knowledge.preview.noDataDetail")}}function XIt({chunk:e}){const{t}=Ae("ui"),[n,i]=p.useState(!1),r=HDe(e.attachmentUrl),s=KIt(e);return!r||s==="none"?null:n?a.jsx("div",{className:"knowledge-preview__attachment-error",children:t("knowledge.preview.attachmentError")}):s==="image"?a.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||t("knowledge.preview.imageAlt"),loading:"lazy",onError:()=>i(!0)}):s==="audio"?a.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.audioUnsupported")}):s==="video"?a.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.videoUnsupported")}):s==="pdf"?a.jsxs("div",{className:"knowledge-preview__pdf",children:[a.jsx("iframe",{src:r,title:e.title?t("knowledge.preview.namedPdf",{name:e.title}):t("knowledge.preview.pdf"),sandbox:"",referrerPolicy:"no-referrer",onError:()=>i(!0)}),a.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openPdf")})]}):a.jsxs("div",{className:"knowledge-preview__file-fallback",children:[a.jsx("p",{children:t("knowledge.preview.fileUnsupported")}),a.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openOriginalFile")})]})}function YIt({base:e,item:t,onClose:n}){const{t:i}=Ae("ui"),[r,s]=p.useState([]),[o,l]=p.useState(t),[c,u]=p.useState(""),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(!1),[v,y]=p.useState(""),x=p.useRef(0),w=p.useRef(null),O=p.useCallback(async(E=0)=>{var j;(j=w.current)==null||j.abort();const R=new AbortController;w.current=R;const _=x.current+1;x.current=_,E>0?m(!0):f(!0),y(""),E===0&&(s([]),b(!1));try{const T=await u1t(e.id,t.id,{region:e.region,offset:E,signal:R.signal});if(x.current!==_)return;l(T.document.id?T.document:t),u(T.sourceMarkdown||T.document.sourceMarkdown),s(N=>E>0?[...N,...T.chunks]:T.chunks),b(T.hasMore)}catch(T){!y8(T)&&x.current===_&&y(el(T,i("knowledge.errors.loadPreview")))}finally{x.current===_&&(f(!1),m(!1))}},[e.id,e.region,t,i]);p.useEffect(()=>(O(),()=>{var E;(E=w.current)==null||E.abort(),x.current+=1}),[O]);const S=WIt(o.url||t.url),k=GIt(o,i),C=o.metadata._veadk_content_format==="markdown";return a.jsx(KC,{title:o.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:a.jsxs("div",{className:"knowledge-preview",children:[o.sizeBytes>0||S?a.jsxs("div",{className:"knowledge-preview__meta",children:[o.sizeBytes>0?a.jsx("span",{children:rV(o.sizeBytes)}):null,S?a.jsx("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:i("knowledge.openOriginalWeb")}):null]}):null,a.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:c?a.jsx("div",{className:"knowledge-preview__markdown-shell",children:a.jsx(Yu,{text:c,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):d?a.jsx("div",{className:"knowledge-preview__state",role:"status",children:a.jsx(yn,{as:"span",duration:2.4,children:i("knowledge.preview.loading")})}):v&&r.length===0?a.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[a.jsx("p",{children:v}),a.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.retry")})]}):r.length===0?a.jsxs("div",{className:"knowledge-preview__state",children:[a.jsx("p",{children:k.title}),a.jsx("span",{children:S?i("knowledge.preview.openOriginalHint"):k.detail}),a.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.reload")})]}):a.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((E,R)=>{const _=qIt(E.tableFields,i),j=E.id||`${R}:${E.title}`;return a.jsxs("article",{className:"knowledge-preview__chunk",children:[a.jsx("header",{children:a.jsx("h3",{children:E.title||i("knowledge.preview.chunk",{index:R+1})})}),E.content?C?a.jsx(Yu,{text:E.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):a.jsx("p",{className:"knowledge-preview__content",children:E.content}):null,_?a.jsx("div",{className:"knowledge-preview__table-wrap",children:a.jsxs("table",{children:[a.jsx("thead",{children:a.jsx("tr",{children:_.columns.map((T,N)=>a.jsx("th",{scope:"col",children:T},`${T}:${N}`))})}),a.jsx("tbody",{children:_.rows.map((T,N)=>a.jsx("tr",{children:T.map((A,P)=>a.jsx("td",{children:A},P))},N))})]})}):null,a.jsx(XIt,{chunk:E})]},j)}),v?a.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:v}):null,g?a.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:h,onClick:()=>void O(r.length),children:h?a.jsx(yn,{as:"span",duration:2.4,children:i("knowledge.preview.loadingMore")}):i("knowledge.preview.loadMore")}):null]})})]})})}function ZIt({cloudProvider:e,region:t,active:n=!0,activationRevision:i=0,onDetailChange:r,toolbarLeading:s,toolbarFilters:o}){const{t:l,i18n:c}=Ae("ui"),[u,d]=p.useState([]),[f,h]=p.useState({}),[m,g]=p.useState([]),[b,v]=p.useState(""),[y,x]=p.useState("overview"),[w,O]=p.useState(""),[S,k]=p.useState(""),[C,E]=p.useState(!0),[R,_]=p.useState(!1),[j,T]=p.useState(""),[N,A]=p.useState([]),[P,D]=p.useState(!1),[M,L]=p.useState(""),[U,I]=p.useState(""),[H,K]=p.useState(""),[F,W]=p.useState(!1),[V,X]=p.useState(!1),[ie,Q]=p.useState(!1),[Z,ce]=p.useState(null),[Ee,Y]=p.useState(null),[G,te]=p.useState(null),[ye,Ne]=p.useState(null),[pe,me]=p.useState(null),[se,Se]=p.useState(!1),Le=p.useRef(0),be=p.useRef(0),Ve=p.useRef([]),ve=p.useRef(!1),Re=p.useRef(!1),ne=p.useRef(null),ge=p.useRef(null),Ce=p.useRef({}),ke=p.useRef(!1),Ke=p.useRef(null),it=p.useRef(null),ue=p.useRef(null),xe=p.useRef(null),Te=p.useMemo(()=>[t],[t]),qe=p.useCallback(He=>`${He.region}\0${He.id}`,[]),De=u.find(He=>qe(He)===b)??null,At=!!(De&&H===qe(De));p.useEffect(()=>{r==null||r(!!De)},[r,De]),p.useEffect(()=>{x("overview"),k("")},[b]);const It=p.useMemo(()=>{const He=w.trim().toLocaleLowerCase();return He?u.filter(Me=>[Me.name,Me.description,Me.ownerLabel,Me.providerKnowledgeId].some(We=>We.toLocaleLowerCase().includes(He))):u},[u,w]),lt=p.useMemo(()=>{const He=S.trim().toLocaleLowerCase();return He?N.filter(Me=>[Me.name,Me.id,x8(Me)].some(We=>We.toLocaleLowerCase().includes(He))):N},[S,N]);p.useEffect(()=>{Y(null)},[De==null?void 0:De.id,De==null?void 0:De.region]);const Ot=p.useCallback(async(He=!1)=>{var gt;if(He&&(ke.current||Object.keys(Ce.current).length===0))return;(gt=ne.current)==null||gt.abort();const Me=new AbortController;ne.current=Me;const We=Le.current+1;Le.current=We,ke.current=!0,He?_(!0):E(!0),T(""),He||g([]);try{const st=await s1t({regions:Te,nextTokens:He?Ce.current:void 0,signal:Me.signal});if(Le.current!==We)return;d(ft=>He?[...ft,...st.items.filter(Ht=>!ft.some(cn=>qe(cn)===qe(Ht)))]:st.items),Ce.current=st.nextTokens,h(st.nextTokens);const xt=st.failures.map(({region:ft,error:Ht})=>`${If(ft,e)}: ${el(Ht,l("common.loadFailed"))}`);g(ft=>He?[...new Set([...ft,...xt])]:xt),He||v(ft=>st.items.some(Ht=>qe(Ht)===ft)?ft:"")}catch(st){if(y8(st))return;Le.current===We&&(He?g(xt=>[...new Set([...xt,el(st,l("knowledge.errors.loadMoreBases"))])]):T(el(st,l("knowledge.errors.loadBases"))))}finally{Le.current===We&&(ke.current=!1,E(!1),_(!1))}},[qe,e,Te,l]),Ct=p.useCallback(async(He,Me=!1)=>{var st;if(Me&&ve.current)return;(st=ge.current)==null||st.abort();const We=new AbortController;ge.current=We;const gt=be.current+1;be.current=gt,Me||(Ve.current=[],Re.current=!1,A([]),W(!1),I("")),ve.current=!0,D(!0),Me?I(""):L("");try{const xt=await c1t(He.id,{region:He.region,offset:Me?Ve.current.length:0,signal:We.signal});if(be.current!==gt)return;K(hn=>hn===qe(He)?"":hn);const ft=Ve.current,Ht=Me?[...ft,...xt.items.filter(hn=>!hn.id||!ft.some(Ge=>Ge.id===hn.id))]:xt.items,cn=xt.hasMore&&(!Me||Ht.length>ft.length);Ve.current=Ht,Re.current=cn,A(Ht),W(cn)}catch(xt){if(y8(xt))return;be.current===gt&&(xt instanceof IP&&xt.errorCode===eIe&&(K(qe(He)),ce(Ht=>Ht&&qe(Ht)===qe(He)?null:Ht)),Me?I(el(xt,l("knowledge.errors.loadMoreData"))):L(el(xt,l("knowledge.errors.loadData"))))}finally{be.current===gt&&(ve.current=!1,D(!1))}},[qe,l]);p.useEffect(()=>{var He;(He=ne.current)==null||He.abort(),Le.current+=1,ke.current=!1,Ce.current={},d([]),h({}),g([]),v(""),K(""),T(""),E(!0)},[e]),p.useEffect(()=>{if(n)return Ot(),()=>{var He;(He=ne.current)==null||He.abort(),Le.current+=1,ke.current=!1}},[n,i,Ot]),p.useEffect(()=>{var He,Me;if(!n){(He=ge.current)==null||He.abort(),be.current+=1,ve.current=!1;return}if(!De){(Me=ge.current)==null||Me.abort(),be.current+=1,Ve.current=[],ve.current=!1,Re.current=!1,A([]),W(!1),I("");return}return Ct(De),()=>{var We;(We=ge.current)==null||We.abort(),be.current+=1,ve.current=!1}},[n,i,De==null?void 0:De.id,De==null?void 0:De.region]);const dt=n&&!De&&!w.trim()&&!C&&!R&&!j&&Object.keys(f).length>0;p.useEffect(()=>{const He=it.current,Me=Ke.current;if(!He||!Me||!dt)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ot(!0)},{root:Me,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[dt,Ot]);const yt=()=>{const He=Ke.current;!He||!dt||He.scrollHeight-He.scrollTop-He.clientHeight<=240&&Ot(!0)},Ie=!!(De&&N.length>0&&F&&!P&&!U);p.useEffect(()=>{const He=xe.current,Me=ue.current;if(!De||!He||!Me||!Ie)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ct(De,!0)},{root:ue.current,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[Ie,Ct,De==null?void 0:De.id,De==null?void 0:De.region]);const vt=()=>{const He=ue.current;if(!De||!He||!Re.current||ve.current||U)return;const{scrollHeight:Me,scrollTop:We,clientHeight:gt}=He;Me-We-gt<=240&&Ct(De,!0)},jt=He=>{d(Me=>Me.map(We=>qe(We)===qe(He)?He:We))},Nt=async()=>{if(ye){Se(!0);try{await l1t(ye.id,ye.region),d(He=>He.filter(Me=>qe(Me)!==qe(ye))),K(He=>He===qe(ye)?"":He),b===qe(ye)&&v(""),Ne(null)}catch(He){T(el(He,l("knowledge.errors.deleteBase"))),Ne(null)}finally{Se(!1)}}},ln=async()=>{if(!(!De||!pe)){Se(!0);try{await m1t(De.id,pe.id,De.region);const He=Ve.current.filter(Me=>Me.id!==pe.id);Ve.current=He,A(He),me(null)}catch(He){L(el(He,l("knowledge.errors.deleteDocument"))),me(null)}finally{Se(!1)}}};return a.jsxs("section",{className:`knowledge-library${De?" is-detail":" resource-collection"}`,"aria-label":l("knowledge.library"),children:[De?a.jsx(LC,{className:"knowledge-library__detail",title:De.name,description:De.description||l("common.noDescription"),identitySeed:De.name,backLabel:l("knowledge.backToList"),onBack:()=>v(""),sections:[{key:"overview",label:l("skillCenter.overview"),content:a.jsx("section",{className:"knowledge-overview",children:a.jsxs(Oz,{className:"knowledge-overview__summary",children:[a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.provider")}),a.jsx("dd",{children:De.providerType||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.knowledgeId")}),a.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:De.providerKnowledgeId,children:De.providerKnowledgeId||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.project")}),a.jsx("dd",{children:De.projectName||"default"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.creator")}),a.jsx("dd",{children:X5(De.ownerLabel)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("skillCenter.updatedAt")}),a.jsx("dd",{children:IIt(De.updatedAt,c.resolvedLanguage??c.language)||"-"})]})]})})},{key:"data",label:l("knowledge.data"),content:a.jsx("section",{className:"knowledge-documents",children:a.jsx("div",{className:`knowledge-documents__body${N.length>0?" is-table":""}`,"aria-live":"polite",children:P&&N.length===0?a.jsx(Fa,{}):M&&N.length===0?a.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[a.jsx("p",{children:M}),At&&De.canManage?a.jsx("button",{type:"button",onClick:()=>Ne(De),children:l("knowledge.deleteInvalidAssociation")}):a.jsx("button",{type:"button",onClick:()=>void Ct(De),children:l("common.retry")})]}):N.length===0?a.jsxs("div",{className:"knowledge-library__state",children:[a.jsx(jIt,{}),a.jsx("p",{children:l("knowledge.noData")}),De.canManage&&a.jsx("button",{type:"button",onClick:()=>ce(De),children:l("knowledge.addFirstData")})]}):a.jsx(kz,{rows:lt,rowKey:He=>He.id,rowLabel:He=>He.name||He.id,columns:[{key:"name",header:l("common.name"),className:"is-primary-column",render:He=>a.jsx("span",{title:He.name||He.id,children:He.name||He.id})},{key:"format",header:l("knowledge.format"),className:"is-compact-column",render:He=>x8(He)},{key:"size",header:l("knowledge.size"),className:"is-compact-column",render:He=>rV(He.sizeBytes)}],searchValue:S,onSearchChange:k,searchPlaceholder:l("knowledge.searchData"),searchLabel:l("knowledge.searchLibraryData"),primaryAction:De.canManage?{label:l(At?"knowledge.associationInvalid":"knowledge.addData"),disabled:At,title:At?l("knowledge.providerMissing"):void 0,onClick:()=>ce(De)}:void 0,rowActions:He=>[{label:l("common.preview"),onSelect:()=>Y(He)},...De.canManage?[{label:l("common.edit"),onSelect:()=>te(He)},{label:l("common.delete"),onSelect:()=>me(He),danger:!0}]:[]],scrollRef:ue,onScroll:vt,busy:P,emptyLabel:l("knowledge.noMatchingData"),footer:P?a.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:l("knowledge.loadingMoreData")})]}):U?a.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[a.jsx("span",{children:U}),a.jsx("button",{type:"button",onClick:()=>void Ct(De,!0),children:l("knowledge.retryLoading")})]}):F?a.jsx("div",{ref:xe,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:l("skillCenter.scrollForMore")}):null})})})}],activeSectionKey:y,navigationLabel:l("knowledge.details"),onSectionChange:x,actions:De.canManage?a.jsxs(a.Fragment,{children:[a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Ne(De),children:l("common.delete")}),a.jsx(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>Q(!0),children:l("common.edit")})]}):void 0}):a.jsxs(a.Fragment,{children:[a.jsxs(Gy,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,a.jsxs("div",{className:"resource-toolbar__actions",children:[o,a.jsx(hp,{value:w,onChange:He=>O(He.target.value),placeholder:l("knowledge.searchBases"),"aria-label":l("knowledge.searchBases")})]})]}),a.jsxs(Rg,{ref:Ke,"aria-live":"polite",onScroll:yt,children:[m.length>0&&!C&&a.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[a.jsx("span",{children:l("knowledge.someBasesFailed")}),a.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}),C&&u.length===0?a.jsx(Fa,{}):j?a.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[a.jsx("p",{children:j}),a.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}):It.length===0&&w.trim()?a.jsxs("div",{className:"knowledge-library__state",children:[a.jsx(_It,{}),a.jsx("p",{children:l("knowledge.noMatchingBases")})]}):a.jsxs(Yy,{children:[w.trim()?null:a.jsx(ug,{"aria-label":l("knowledge.createBase"),icon:a.jsx(RIt,{}),onClick:()=>X(!0),children:l("knowledge.createBase")}),It.map(He=>a.jsx(Jy,{className:"knowledge-card",title:He.name,description:He.description||l("common.noDescription"),metadata:[{label:l("knowledge.creator"),value:X5(He.ownerLabel),title:X5(He.ownerLabel)},{label:l("knowledge.project"),value:He.projectName||"default",title:He.projectName||"default"}],action:{label:H===qe(He)?l("knowledge.associationInvalid"):l("knowledge.addData"),icon:"plus",disabled:!He.canManage||H===qe(He),title:He.canManage?H===qe(He)?l("knowledge.providerMissing"):void 0:l("knowledge.noManagePermission"),onClick:()=>ce(He)},detailAction:{label:l("common.viewDetails"),onClick:()=>v(qe(He))}},qe(He)))]}),dt||R?a.jsx("div",{ref:it,className:"my-agent-load-more",role:"status","aria-live":"polite",children:R?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:l("knowledge.loadingMoreBases")})]}):dt?a.jsx("span",{children:l("skillCenter.scrollForMore")}):null}):null]})]}),V&&a.jsx($It,{region:t,onClose:()=>X(!1),onCreated:He=>{d(Me=>[He,...Me]),v(qe(He)),X(!1)}}),De&&ie&&a.jsx(FIt,{item:De,onClose:()=>Q(!1),onUpdated:He=>{jt(He),Q(!1)}}),De&&Ee&&a.jsx(YIt,{base:De,item:Ee,onClose:()=>Y(null)}),Z&&a.jsx(BIt,{base:Z,onClose:()=>ce(null),onAssociationInvalid:He=>{K(qe(Z)),De&&qe(De)===qe(Z)&&L(el(He,l("knowledge.associationInvalid"))),ce(null)},onCreated:()=>{De&&qe(De)===qe(Z)&&Ct(De),ce(null)}}),De&&G&&a.jsx(UIt,{base:De,item:G,onClose:()=>te(null),onUpdated:He=>{const Me=Ve.current.map(We=>We.id===He.id?He:We);Ve.current=Me,A(Me),te(null)}}),ye&&a.jsx(Gu,{title:l("knowledge.deleteBaseTitle"),description:l("knowledge.deleteBaseDescription",{name:ye.name}),confirmLabel:l(se?"common.deleting":"common.delete"),variant:"danger",busy:se,onCancel:()=>Ne(null),onConfirm:()=>void Nt()}),pe&&a.jsx(Gu,{title:l("knowledge.deleteDocumentTitle"),description:l("knowledge.deleteDocumentDescription",{name:pe.name||pe.id}),confirmLabel:l(se?"common.deleting":"common.delete"),variant:"danger",busy:se,onCancel:()=>me(null),onConfirm:()=>void ln()})]})}const JIt="_EmptyMessage_1r5gu_1",ePt="_IconBadge_1r5gu_16",tPt="_Title_1r5gu_54",nPt="_Description_1r5gu_69",iPt="_ActionRow_1r5gu_77",GC={EmptyMessage:JIt,IconBadge:ePt,Title:tPt,Description:nPt,ActionRow:iPt},Pn=({children:e,className:t,fill:n="static"})=>a.jsx("div",{className:Ti(GC.EmptyMessage,t),"data-fill":n,children:e}),rPt=({size:e="md",color:t="secondary",children:n,className:i})=>a.jsx("div",{className:Ti(GC.IconBadge,i),"data-size":e,"data-color":t,children:n}),sPt=({children:e,className:t,color:n="secondary"})=>a.jsx("div",{className:Ti(GC.Title,t),"data-color":n,children:e}),oPt=({children:e,className:t})=>a.jsx("div",{className:Ti(GC.Description,t),children:e}),aPt=({children:e,className:t})=>a.jsx("div",{className:Ti(GC.ActionRow,t),children:e});Pn.Icon=rPt;Pn.Title=sPt;Pn.Description=oPt;Pn.ActionRow=aPt;const lPt={name:"studio_share_space"},cPt={name:"studio_review_space"},qDe={share:lPt,review:cPt},uPt=qDe.share.name,WDe=qDe.review.name,dPt=[uPt,WDe];function KDe(e){return dPt.includes(e.trim().toLowerCase())}function fPt(e){return e.name===WDe}const hPt="/web/skill-management";class sV extends Error{constructor(t,n,i="SKILL_MANAGEMENT_ERROR",r="",s,o=""){super(t),this.status=n,this.code=i,this.statusText=r,this.originalError=s,this.rawResponse=o,this.name="SkillManagementApiError"}}async function Dl(e,t={},n=Ba){return fetch(Zo(`${hPt}${e}`),{...t,headers:Pl(uu(t.headers)),signal:Ua(t.signal,n)})}async function qP(e,t){let n=t,i="SKILL_MANAGEMENT_ERROR",r;const s=await e.text().catch(()=>"");try{const o=JSON.parse(s);typeof o.detail=="string"?n=o.detail:o.detail&&(n=o.detail.message||t,i=o.detail.code||i,r=o.detail.originalError)}catch{s.trim()&&(n=z("common.fallbackWithDetail",{fallback:t,detail:s.trim()}))}return new sV(n,e.status,i,e.statusText,r,s)}async function Ml(e,t){if(!e.ok)throw await qP(e,t);return e.json()}async function pPt(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),Ml(await Dl(`/spaces?${t}`,{signal:e.signal}),z("skills.listSpacesFailed"))}async function mPt(e){if(KDe(e.name))throw new sV(z("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return Ml(await Dl("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),z("skills.createSpaceFailed"))}async function gPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/shared-space/ensure?${t}`,{method:"POST",signal:e.signal}),z("skills.sharedSpaceFailed"))}async function bPt(e){return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/review`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e.region,version:e.version})},xr),z("skills.submitReviewFailed"))}async function yPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/reviews?${t}`,{signal:e.signal}),z("skills.listReviewsFailed"))}async function vPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/reviews/${encodeURIComponent(e.id)}/files?${t}`,{signal:e.signal},xr),z("skills.reviewFilesFailed"))}async function xPt(e){return Ml(await Dl(`/reviews/${encodeURIComponent(e.id)}/decision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e.region,decision:e.decision,reason:e.reason||"",comment:e.comment||""})},xr),z("skills.decideReviewFailed"))}async function wPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/reviews?${t}`,{signal:e.signal}),z("skills.listReviewsFailed"))}async function OPt(e){if(KDe(e.name))throw new sV(z("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),z("skills.updateSpaceFailed"))}async function kPt(e){const t=new URLSearchParams({region:e.region});await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),z("skills.deleteSpaceFailed"))}async function SPt(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},xr),z("skills.uploadFailed"))}async function EPt(e){return Ml(await Dl("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},xr),z("skills.validateFailed"))}async function CPt(e){const t=new URLSearchParams({region:e.region});await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),z("skills.deleteFailed"))}async function GDe(e){const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),z("skills.listFilesFailed"));return Array.isArray(n.files)?n.files:[]}async function TPt(e){var l;const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},xr);n.ok||await Ml(n,z("skills.downloadFailed"));const r=((l=(n.headers.get("content-disposition")||"").match(/filename="([^"]+)"/))==null?void 0:l[1])||`${e.fallbackName}.zip`,s=URL.createObjectURL(await n.blob()),o=document.createElement("a");o.href=s,o.download=r,o.click(),URL.revokeObjectURL(s)}function rc(e){var t;return((t=e==null?void 0:e.displayName)==null?void 0:t.trim())||(e==null?void 0:e.name)||""}async function WP(e){const t=await fetch(Zo(e),{headers:Pl(uu({accept:"application/json"})),signal:Ua(void 0,Ba)});if(!t.ok)throw await qP(t,Kt("helpers.skills.agentKitRequestFailed"));return t.json()}async function XDe(){return((await WP("/web/skill-spaces")).items||[]).filter(t=>!fPt(t))}async function YDe(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function APt(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function _Pt(e,t,n,i,r,s,o){const l=[];n&&l.push(`version=${encodeURIComponent(n)}`),i&&l.push(`region=${encodeURIComponent(i)}`),r&&l.push(`project=${encodeURIComponent(r)}`),s&&l.push(`skill_name=${encodeURIComponent(s)}`),o&&l.push(`skill_space_name=${encodeURIComponent(o)}`);const c=l.length>0?`?${l.join("&")}`:"";return WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function jPt(e,t){const n=Db(t);return{source:"skillspace",id:`ss:${e.id}/${n}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:n,version:t.version}}function Db(e){return e.skillId||e.skillName}function NPt(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}mn.hasResourceBundle("en-US","skills")||mn.addResourceBundle("en-US","skills",Jfe,!0,!0);mn.hasResourceBundle("zh-CN","skills")||mn.addResourceBundle("zh-CN","skills",eve,!0,!0);function Jt(e,t={}){return mn.t(e,{...t,ns:"skills"})}const RPt="/web/skill-workbench";class w8 extends Error{constructor(t,n,i="SKILL_WORKBENCH_ERROR",r=!1,s="",o,l=""){super(t),this.status=n,this.code=i,this.retryable=r,this.statusText=s,this.originalError=o,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function Hu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(Jt("api.invalidFormat",{label:t}));return e}function Pte(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(Jt("api.invalidFormat",{label:t}));return e.trim()}}function IPt(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error(Jt("api.invalidFormat",{label:Jt("api.recoveryStatus")}))}}async function Mf(e,t={},n=Ba){return fetch(Zo(`${RPt}${e}`),{...t,headers:uu(t.headers),signal:Ua(t.signal,n)})}async function oV(e,t){var i;const n=await e.text().catch(()=>"");try{const r=Hu(JSON.parse(n),Jt("api.errorResponse")),s=r.detail&&typeof r.detail=="object"?Hu(r.detail,Jt("api.errorDetails")):r;return new w8(typeof s.message=="string"?s.message:t,e.status,typeof s.code=="string"?s.code:"SKILL_WORKBENCH_ERROR",s.retryable===!0,e.statusText,s.originalError&&typeof s.originalError=="object"?s.originalError:void 0,n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||Jt("api.missingContentType");return new w8(Jt("api.gatewayError",{fallback:t,status:e.status,contentType:r}),e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function fg(e,t){if(!e.ok)throw await oV(e,t);const n=e.headers.get("content-type")??"";if(!n.includes("application/json")){const i=n.split(";",1)[0]||Jt("api.missingContentType");throw new Error(Jt("api.nonJson",{fallback:t,status:e.status,contentType:i}))}return e.json()}function PPt(e){return Array.isArray(e)?e.map(t=>{const n=Hu(t,Jt("api.activity")),i=n.kind,r=n.status;if(typeof n.id!="string"||!["status","thinking","message","tool"].includes(String(i))||!["running","done"].includes(String(r)))throw new Error(Jt("api.invalidActivity"));if(i==="tool"){if(typeof n.name!="string")throw new Error(Jt("api.invalidToolActivity"));return{id:n.id,kind:i,status:r,name:n.name,...n.input!==void 0?{args:n.input}:{},...n.output!==void 0?{response:n.output}:{}}}if(typeof n.text!="string")throw new Error(Jt("api.invalidTextActivity"));return{id:n.id,kind:i,status:r,text:n.text}}):[]}function DPt(e){if(e==null)return;const t=Hu(e,Jt("api.publication"));if(typeof t.revision!="number"||typeof t.skillId!="string"||typeof t.version!="string"||!Array.isArray(t.skillSpaceIds)||!t.skillSpaceIds.every(n=>typeof n=="string")||t.disposition!=="create-new"&&t.disposition!=="update-source"||!_I(t.region)||typeof t.projectName!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.publication")}));return{revision:t.revision,skillId:t.skillId,version:t.version,skillSpaceIds:t.skillSpaceIds,disposition:t.disposition,region:t.region,projectName:t.projectName}}function hE(e){const t=Hu(e,Jt("api.task"));if(typeof t.jobId!="string"||t.operation!=="create"&&t.operation!=="optimize"||typeof t.intent!="string"||typeof t.revision!="number"||typeof t.state!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.task")}));const n=Array.isArray(t.files)?t.files.flatMap(l=>{const c=Hu(l,Jt("api.file"));return typeof c.path=="string"&&typeof c.size=="number"?[{path:c.path,size:c.size}]:[]}):[];if(!["running","ready","failed","cancelled","expired","published"].includes(t.state))throw new Error(Jt("api.unknownTaskState"));const r=Pte(t.toolId,"Tool ID"),s=Pte(t.sessionId,"Session ID"),o=IPt(t.recoveryStatus);return{jobId:t.jobId,operation:t.operation,intent:t.intent,...typeof t.model=="string"?{model:t.model}:{},...typeof t.style=="string"?{style:t.style}:{},...typeof t.requestedName=="string"?{requestedName:t.requestedName}:{},revision:t.revision,...r?{toolId:r}:{},...s?{sessionId:s}:{},...typeof t.sessionTtlSeconds=="number"?{sessionTtlSeconds:t.sessionTtlSeconds}:{},...typeof t.expiresAt=="string"?{expiresAt:t.expiresAt}:{},...typeof t.recoveryAvailable=="boolean"?{recoveryAvailable:t.recoveryAvailable}:{},...o?{recoveryStatus:o}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:PPt(t.activities),files:n,...t.source&&typeof t.source=="object"?{source:t.source}:{},...typeof t.name=="string"?{name:t.name}:{},...typeof t.description=="string"?{description:t.description}:{},...typeof t.skillMd=="string"?{skillMd:t.skillMd}:{},...typeof t.error=="string"?{error:t.error}:{},...t.validation&&typeof t.validation=="object"?{validation:t.validation}:{},...t.publication?{publication:DPt(t.publication)}:{}}}async function KP(e){const t=Hu(await fg(await Mf("/capabilities",{signal:e}),Jt("api.loadCapability")),Jt("api.capability"));return{enabled:t.enabled===!0,reason:typeof t.reason=="string"?t.reason:"",operations:Array.isArray(t.operations)?t.operations.filter(n=>n==="create"||n==="optimize"):[],models:Array.isArray(t.models)?t.models.flatMap(n=>{if(!n||typeof n!="object")return[];const i=n;return typeof i.id=="string"&&typeof i.label=="string"?[{id:i.id,label:i.label}]:[]}):[],styles:t.styles&&typeof t.styles=="object"&&!Array.isArray(t.styles)?Object.fromEntries(Object.entries(t.styles).filter(n=>typeof n[1]=="string")):{},...typeof t.maxUploadBytes=="number"?{maxUploadBytes:t.maxUploadBytes}:{}}}async function MPt(e){if(e.file){const n=new URLSearchParams({operation:"optimize",intent:e.intent});e.jobId&&n.set("job_id",e.jobId),e.model&&n.set("model",e.model),e.style&&n.set("style",e.style),e.name&&n.set("name",e.name);const i=await Mf(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},xr);return hE(await fg(i,Jt("api.startOptimization")))}const t=await Mf("/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e.operation,intent:e.intent,...e.model?{model:e.model}:{},...e.style?{style:e.style}:{},...e.name?{name:e.name}:{},...e.jobId?{jobId:e.jobId}:{},...e.source?{source:{kind:"skill-center",skillId:e.source.skillId,skillName:e.source.name,version:e.source.version,region:e.source.region,projectName:e.source.projectName,skillSpaceId:e.source.skillSpaceId,skillSpaceName:e.source.skillSpaceName}}:{}}),signal:e.signal},xr);return hE(await fg(t,Jt("api.startTask")))}async function LPt(e,t){return hE(await fg(await Mf(`/tasks/${encodeURIComponent(e)}`,{signal:t}),Jt("api.loadTask")))}async function Y5(e,t,n){const i=new URLSearchParams;i.set("expected_revision",String(t));const r=Hu(await fg(await Mf(`/tasks/${encodeURIComponent(e)}/artifact?${i.toString()}`,{signal:n}),Jt("api.loadArtifact")),Jt("api.artifact"));if(r.jobId!==e||r.revision!==t||!Number.isSafeInteger(r.revision)||r.revision<1||typeof r.sha256!="string"||!/^[0-9a-f]{64}$/.test(r.sha256)||typeof r.name!="string"||typeof r.description!="string"||!Array.isArray(r.files))throw new Error(Jt("api.invalidFormat",{label:Jt("api.artifact")}));const s=r.files.map(o=>{const l=Hu(o,Jt("api.artifactFile"));if(typeof l.path!="string"||typeof l.size!="number"||typeof l.content!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.artifactFile")}));return{path:l.path,size:l.size,content:l.content}});return{jobId:r.jobId,revision:r.revision,sha256:r.sha256,name:r.name,description:r.description,files:s}}async function Z5(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},xr);return hE(await fg(t,Jt("api.refine")))}async function $Pt(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return hE(await fg(t,Jt("api.stop")))}async function FPt(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/publish-stream`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({disposition:e.disposition,expectedRevision:e.expectedRevision,expectedArtifactSha256:e.expectedArtifactSha256,skillSpaceIds:e.skillSpaceIds??[],projectName:e.projectName,region:e.region}),signal:e.signal},0);if(!t.ok)throw await oV(t,Jt("api.publish"));if(!(t.headers.get("content-type")??"").includes("application/x-ndjson"))throw new Error(Jt("api.nonNdjson"));if(!t.body)throw new Error(Jt("api.missingStream"));const i=new Set(["preparing","uploading","registering","activating","publishing"]);let r=null,s="";const o=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=Hu(JSON.parse(u),Jt("api.publishProgress"));if(d.type==="progress"){if(typeof d.phase!="string"||!i.has(d.phase)||typeof d.message!="string")throw new Error(Jt("api.invalidPublishProgress"));(h=e.onProgress)==null||h.call(e,{phase:d.phase,message:d.message});return}if(d.type==="error"){const m=Hu(d.error,Jt("api.publishError"));throw new w8(typeof m.message=="string"?m.message:Jt("api.publish"),500,typeof m.code=="string"?m.code:"SKILL_PUBLISH_FAILED",m.retryable===!0,"",m.originalError&&typeof m.originalError=="object"?m.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error(Jt("api.unknownPublishEvent"));const f=Hu(d.result,Jt("api.publishResult"));if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(m=>typeof m=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!_I(f.region)||typeof f.projectName!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.publishResult")}));r={skillId:f.skillId,version:f.version,skillSpaceIds:f.skillSpaceIds,disposition:f.disposition,region:f.region,projectName:f.projectName}};for(;;){const{value:u,done:d}=await l.read();s+=o.decode(u,{stream:!d});const f=s.split(` -`);if(s=f.pop()??"",f.forEach(c),d)break}if(c(s),!r)throw new Error(Jt("api.streamEnded"));return r}async function BPt(e){await fg(await Mf(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),Jt("api.deleteTask"))}async function UPt(e,t,n){var c;const i=new URLSearchParams;i.set("expected_revision",String(t)),i.set("expected_sha256",n);const r=await Mf(`/tasks/${encodeURIComponent(e)}/download?${i.toString()}`,{},xr);if(!r.ok)throw await oV(r,Jt("api.download"));const o=((c=(r.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:c[1])??"skill.zip",l=URL.createObjectURL(await r.blob());try{const u=document.createElement("a");u.href=l,u.download=o,u.click()}finally{URL.revokeObjectURL(l)}}const ZDe=p.createContext(void 0);function r0(e){const t=p.useContext(ZDe);if(t===void 0&&!e)throw new Error(du(47));return t}const QPt={...aAe,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class zPt extends BI{constructor(n,i,r){const s=new qU;super(VPt(n,s,i,r),HPt(s),QPt);rn(this,"setOpen",(n,i)=>{var f,h;const r=i.reason===Bc,s=i.reason===Kx&&i.event.detail===0,o=!n&&(i.reason===OTe||i.reason==null),l=ktt(i),c=this.select("activeTriggerId");if(!n&&i.reason===wTe&&i.trigger==null&&c!=null&&(i.trigger=this.context.triggerElements.getById(c)??this.select("activeTriggerElement")??void 0),(h=(f=this.context).onOpenChange)==null||h.call(f,n,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,i);const u=()=>{const m={open:n,openChangeReason:i.reason};JTe(m,n,i.trigger,l()),this.update(m)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(KJe,()=>{this.set("stickIfOpen",!1)}),ri.flushSync(u)):u();let d;s?d="click":o?d="dismiss":i.reason===LS&&(d="focus"),this.set("instantType",d)})}}function VPt(e,t,n,i=!1){const r={...rAe(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r.floatingRootContext=sAe(t,n,i),r}function HPt(e){return{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:p.createRef(),beforeContentFocusGuardRef:p.createRef(),stickIfOpenTimeout:new lu,triggerElements:e}}function Dte({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:s,modal:o=!1,handle:l,triggerId:c,defaultTriggerId:u=null}=e,d=WPt(l,{modal:o,open:i,openProp:n,activeTriggerId:u,triggerIdProp:c});d.useControlledProp("openProp",n),d.useControlledProp("triggerIdProp",c);const f=d.useState("open"),h=d.useState("mounted"),m=d.useState("payload");d.useContextCallback("onOpenChange",r),d.useContextCallback("onOpenChangeComplete",s),iAe(d,f),eAe(d);const{forceUnmount:g}=tAe(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:o}),p.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),p.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,Gs(kTe))}),[g,d]);const b=f||h;return a.jsxs(ZDe.Provider,{value:d,children:[l&&a.jsx(ZTe,{handle:l,store:d}),b&&a.jsx(KPt,{store:d,modal:o}),typeof t=="function"?t({payload:m}):t]})}function qPt(e){return r0(!0)?a.jsx(Dte,{props:e}):a.jsx(_et,{children:a.jsx(Dte,{props:e})})}function WPt(e,t){const n=YTe((i,r)=>new zPt(t,i,r));return p.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function KPt({store:e,modal:t}){const n=e.useState("floatingRootContext"),i=PTe(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=i.reference,s=i.floating;return nAe(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const GPt=300;function hg(e){return gC(e,"base-ui")}function XPt(e,t){const n=p.useRef(null);function i(s){ri.flushSync(()=>{e.setOpen(!1,Gs(LS,s.nativeEvent,s.currentTarget))});const o=SJe(n.current);o==null||o.focus()}function r(s){var l;const o=e.select("positionerElement");if(o&&ex(s,o))(l=e.context.beforeContentFocusGuardRef.current)==null||l.focus();else{ri.flushSync(()=>{e.setOpen(!1,Gs(LS,s.nativeEvent,s.currentTarget))});let c=kJe(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&zn(o,c);){const u=c;if(c=MU(c),c===u)break}c==null||c.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:i,handleFocusTargetFocus:r}}function YPt(e){const t=p.useRef(""),n=p.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:p.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function ZPt(e,t){const n=Wn((s,o)=>{(typeof e=="function"?e():e)||t(o||(HI?"touch":""))}),{onClick:i,onPointerDown:r}=YPt(n);return p.useMemo(()=>({onClick:i,onPointerDown:r}),[i,r])}const JPt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:o=!1,nativeButton:l=!0,handle:c,payload:u,openOnHover:d=!1,delay:f=GPt,closeDelay:h=0,id:m,...g}=t,b=r0(!0),y=Ttt(c)??b;if(!y)throw new Error(du(74));const x=hg(m),w=y.useState("isTriggerActive",x),O=y.useState("floatingRootContext"),S=y.useState("isOpenedByTrigger",x),k=y.useState("triggerPopupId",x),C=p.useRef(null),{registerTrigger:E,isMountedByThisTrigger:R}=Stt(x,C,y,{payload:u,disabled:o,openOnHover:d,closeDelay:h}),_=y.useState("openChangeReason"),j=y.useState("stickIfOpen"),T=y.useState("openMethod"),N=y.useState("focusManagerModal"),A=Rtt(O,{enabled:!o&&d&&(T!=="touch"||_!==Kx),mouseOnly:!0,move:!1,handleClose:Dtt(),restMs:f,delay:{close:h},triggerElementRef:C,isActiveTrigger:w,isClosing:()=>y.select("transitionStatus")==="ending"}),P=Ret(O,{stickIfOpen:j}),D=ZPt(()=>y.select("open"),ie=>{y.set("openMethod",ie)}),M=y.useState("triggerProps",R),{getButtonProps:L,buttonRef:U}=QU({disabled:o,native:l}),I={open(ie){return ie&&_===Kx?Xtt.open(ie):Gtt.open(ie)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:K,handleFocusTargetFocus:F}=XPt(y,C),V=Do("button",t,{state:{disabled:o,open:S},ref:[U,n,E,C],props:[P.reference,A,M,D,{[mTe]:"",id:x,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":k},g,L],stateAttributesMapping:I}),X=a.jsx(p.Fragment,{children:V},x);return R&&!N?a.jsxs(p.Fragment,{children:[a.jsx(hy,{ref:H,onFocus:K}),X,a.jsx(hy,{ref:y.context.triggerFocusTargetRef,onFocus:F})]}):X}),JDe=p.createContext(void 0);function eDt(){const e=p.useContext(JDe);if(e===void 0)throw new Error(du(45));return e}const tDt=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t;return r0().useState("mounted")||i?a.jsx(JDe.Provider,{value:i,children:a.jsx(TTe,{ref:n,...r})}):null}),eMe=p.createContext(void 0);function nDt(){const e=p.useContext(eMe);if(!e)throw new Error(du(46));return e}const tMe=p.forwardRef(function(t,n){const{cutout:i,...r}=t;let s;if(i){const o=i.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return a.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let Mte={},Lte={},$te="";function GP(e,t){return hC(e)?e:t}function Fte(e,t,n){return/hidden|clip/.test(e.getComputedStyle(GP(t,n)).overflowY)}function iDt(e){if(typeof document>"u")return!1;const t=lr(e);return Fs(t).innerWidth-t.documentElement.clientWidth>0}function rDt(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=lr(e),i=n.documentElement,r=n.body,s=GP(i,r),o=s.style.overflowY,l=i.style.scrollbarGutter;i.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=o,i.style.scrollbarGutter=l,c===u}function sDt(e){const t=lr(e),n=t.documentElement,i=t.body,r=GP(n,i),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function oDt(e){var m;const t=lr(e),n=t.documentElement,i=t.body,r=Fs(n);let s=0,o=0,l=!1;const c=Yl.create();if(Bw&&(((m=r.visualViewport)==null?void 0:m.scale)??1)!==1)return()=>{};function u(){const g=r.getComputedStyle(n),b=r.getComputedStyle(i),x=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,o=n.scrollLeft,Mte={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},$te=n.style.scrollBehavior,Lte={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const w=n.scrollHeight>n.clientHeight,O=n.scrollWidth>n.clientWidth,S=g.overflowY==="scroll"||b.overflowY==="scroll",k=g.overflowX==="scroll"||b.overflowX==="scroll",C=Math.max(0,r.innerWidth-i.clientWidth),E=Math.max(0,r.innerHeight-i.clientHeight),R=parseFloat(b.marginTop)+parseFloat(b.marginBottom),_=parseFloat(b.marginLeft)+parseFloat(b.marginRight),j=GP(n,i);if(l=rDt(e),l){n.style.scrollbarGutter=x,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(w||S)&&(n.style.overflowY="scroll"),(O||k)&&(n.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:R||E?`calc(100dvh - ${R+E}px)`:"100dvh",width:_||C?`calc(100vw - ${_+C}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),i.scrollTop=s,i.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Mte),Object.assign(i.style,Lte),l||(n.scrollTop=s,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=$te)}function f(){d(),c.request(u)}u();const h=mi(r,"resize",f);return()=>{c.cancel(),d(),typeof r.removeEventListener=="function"&&h()}}class aDt{constructor(){rn(this,"lockCount",0);rn(this,"restore",null);rn(this,"timeoutLock",lu.create());rn(this,"timeoutUnlock",lu.create());rn(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});rn(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const n=lr(t),i=n.documentElement,r=n.body,s=Fs(i);if(Fte(s,i,r)){const l=new s.MutationObserver(()=>{Fte(s,i,r)||(l.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};l.observe(i,c),l.observe(r,c),this.restore=()=>l.disconnect();return}const o=HI||!iDt(t);this.restore=o?sDt(t):oDt(t)}}const lDt=new aDt;function nMe(e=!0,t=null){Un(()=>{if(e)return lDt.acquire(t)},[e,t])}const cDt=20;function uDt(e,t,n,i){const[r,s]=p.useState(!1);Un(()=>{if(!e||!t||n==null){s(!1);return}const o=lr(n).documentElement.clientWidth,l=n.offsetWidth;s(o>0&&l>0&&l>=o-cDt)},[e,t,n]),nMe(e&&(!t||r),i)}const dDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,anchor:o,positionMethod:l,side:c,align:u,sideOffset:d,alignOffset:f,collisionBoundary:h="clipping-ancestors",collisionPadding:m,arrowPadding:g,sticky:b,disableAnchorTracking:v=!1,collisionAvoidance:y=eet,...x}=t,w=r0(),O=eDt(),S=Tet(),k=w.useState("floatingRootContext"),C=w.useState("mounted"),E=w.useState("open"),R=w.useState("openChangeReason"),_=w.useState("activeTriggerElement"),j=w.useState("modal"),T=w.useState("openMethod"),N=w.useState("positionerElement"),A=w.useState("instantType"),P=w.useState("transitionStatus"),D=w.useState("adaptiveOrigin"),M=p.useRef(null),L=UU(N),U=Qtt({anchor:o,floatingRootContext:k,positionMethod:l,mounted:C,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:g,collisionBoundary:h,collisionPadding:m,sticky:b,disableAnchorTracking:v,keepMounted:O,nodeId:S,collisionAvoidance:y,adaptiveOrigin:D}),I=k.useState("domReferenceElement");Un(()=>{const V=I,X=M.current;if(V&&(M.current=V),X&&V&&V!==X){w.set("instantType",void 0);const ie=new AbortController;return L(()=>{w.set("instantType","trigger-change")},ie.signal),()=>{ie.abort()}}},[I,L,w]);const H=j===!0&&R!==Bc;uDt(E&&H,T==="touch",N,_);const K=w.useStateSetter("positionerElement"),F={open:E,side:U.side,align:U.align,anchorHidden:U.anchorHidden,instant:A},W=Ytt(t,F,{styles:U.positionerStyles,transitionStatus:P,props:x,refs:[n,K],hidden:!C,inert:!E});return a.jsxs(eMe.Provider,{value:U,children:[C&&H&&a.jsx(tMe,{inert:BU(!E),cutout:_}),a.jsx(Aet,{id:S,children:W})]})}),fDt="ArrowUp",hDt="ArrowDown",pDt="ArrowLeft",mDt="ArrowRight",gDt="Home",bDt="End",iMe=new Set([fDt,hDt,pDt,mDt,gDt,bDt]),yDt=p.createContext(void 0);function vDt(e){return p.useContext(yDt)}const xDt=p.createContext(void 0);function wDt(){const[e,t]=p.useState(0),n=Wn(()=>(t(r=>r+1),()=>{t(r=>Math.max(0,r-1))}));return{context:p.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const ODt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,initialFocus:o,finalFocus:l,...c}=t,u=r0(),d=nDt(),f=vDt()!=null,{context:h,hasClosePart:m}=wDt(),g=u.useState("open"),b=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),x=u.useState("popupProps"),w=u.useState("titleElementId"),O=u.useState("descriptionElementId"),S=u.useState("modal"),k=u.useState("mounted"),C=u.useState("openChangeReason"),E=u.useState("activeTriggerElement"),R=u.useState("floatingRootContext"),_=R.useState("floatingId"),j=u.useState("disabled"),T=u.useState("openOnHover"),N=u.useState("closeDelay");mC({open:g,ref:u.context.popupRef,onComplete(){var U,I;g&&((I=(U=u.context).onOpenChangeComplete)==null||I.call(U,!0))}}),jtt(R,{enabled:T&&!j,closeDelay:N});const A=o===void 0?XTe(u.context.popupRef):o,P=S!==!1&&m;u.useSyncedValue("focusManagerModal",P);const D=u.useStateSetter("popupElement"),M={open:g,side:d.side,align:d.align,instant:v,transitionStatus:y},L=Do("div",t,{state:M,ref:[n,u.context.popupRef,D],props:[x,{id:_,role:"dialog",...GTe,"aria-labelledby":w,"aria-describedby":O,onKeyDown(U){f&&iMe.has(U.key)&&U.stopPropagation()}},fAe(y),c],stateAttributesMapping:dAe});return a.jsx(ITe,{context:R,openInteractionType:b,modal:P,disabled:!k||C===Bc,initialFocus:A,returnFocus:l,restoreFocus:"popup",previousFocusableElement:Ls(E)?E:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:a.jsx(xDt.Provider,{value:h,children:L})})}),kDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,l=r0(),c=hg(o.id);return l.useSyncedValueWithCleanup("titleElementId",c),Do("h2",t,{ref:n,props:[{id:c},o]})}),SDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,l=r0(),c=hg(o.id);return l.useSyncedValueWithCleanup("descriptionElementId",c),Do("p",t,{ref:n,props:[{id:c},o]})});function Bte(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),a.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function EDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),a.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),a.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),a.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function aV(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{className:"video-generate-icon__body",d:"M3.25 9h17.5v7.35a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V9Z"}),a.jsxs("g",{className:"video-generate-icon__clapper",children:[a.jsx("path",{d:"M3.25 9V7.65a2.4 2.4 0 0 1 2.4-2.4h12.7a2.4 2.4 0 0 1 2.4 2.4V9H3.25Z"}),a.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),a.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function CDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),a.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),a.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function TDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),a.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),a.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function ADt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),a.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),a.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),a.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function _Dt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),a.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),a.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function jDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),a.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),a.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),a.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function NDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),a.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),a.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),a.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function Ute(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"9",cy:"8",r:"3"}),a.jsx("path",{d:"M3.75 18.75c.45-3.05 2.2-4.65 5.25-4.65s4.8 1.6 5.25 4.65"}),a.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function RDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),a.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),a.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function IDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),a.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function Qte(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),a.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),a.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function r1(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function PDt({value:e}){const{t,i18n:n}=Ae("adk"),[i,r]=p.useState(!1),s=f=>f==null?t("developmentRuns.notReported"):f.toLocaleString(n.resolvedLanguage||n.language),o=PCe,l=e.usage,c=(l==null?void 0:l.inputTokens)!=null&&l.cachedInputTokens!=null&&l.cachedInputTokens<=l.inputTokens?l.inputTokens-l.cachedInputTokens:void 0,u=l!=null&&l.inputTokens&&l.cachedInputTokens!=null&&c!=null?`${(l.cachedInputTokens/l.inputTokens*100).toFixed(1)}%`:void 0,d=[["inputTokens",l==null?void 0:l.inputTokens],["cachedInputTokens",l==null?void 0:l.cachedInputTokens],["uncachedInputTokens",c],["cacheWriteInputTokens",l==null?void 0:l.cacheWriteInputTokens],["outputTokens",l==null?void 0:l.outputTokens],["reasoningOutputTokens",l==null?void 0:l.reasoningOutputTokens]];return a.jsxs("div",{className:"development-turn-summary","data-turn-id":e.turnId,children:[a.jsx("span",{children:t(`developmentRuns.turnStatus.${e.status}`)}),a.jsx("span",{children:t("developmentRuns.toolCalls",{count:e.toolCalls})}),a.jsx("span",{children:t("developmentRuns.turnDuration",{duration:o(e.durationMs)})}),a.jsx("span",{title:t("developmentRuns.toolDurationHelp"),children:t(e.toolDurationComplete?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:o(e.toolDurationMs)})}),a.jsxs(qPt,{open:i,onOpenChange:r,children:[a.jsxs(JPt,{className:"development-token-trigger",openOnHover:!0,delay:150,closeDelay:150,onFocus:f=>{f.currentTarget.matches(":focus-visible")&&r(!0)},children:[a.jsx("span",{children:"Tokens"}),a.jsx("span",{className:"development-token-value",children:s(l==null?void 0:l.totalTokens)}),e.usageIncomplete&&a.jsxs("span",{children:["· ",t("developmentRuns.partial")]}),a.jsx(r1,{className:"development-token-chevron"})]}),a.jsx(tDt,{children:a.jsx(dDt,{side:"top",align:"end",sideOffset:8,className:"development-token-positioner",children:a.jsxs(ODt,{className:"development-token-popup",initialFocus:!1,finalFocus:!1,children:[a.jsx(kDt,{className:"development-token-title",children:t("developmentRuns.tokenDetails")}),a.jsxs("dl",{children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.model")}),a.jsx("dd",{children:e.model||t("developmentRuns.notReported")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.totalTokens")}),a.jsx("dd",{children:s(l==null?void 0:l.totalTokens)})]}),d.map(([f,h])=>a.jsxs("div",{children:[a.jsx("dt",{children:t(`developmentRuns.${f}`)}),a.jsx("dd",{children:s(h)})]},f)),a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.cacheHitRate")}),a.jsx("dd",{children:u||t("developmentRuns.notReported")})]})]}),a.jsxs(SDt,{className:"development-token-note",children:[t("developmentRuns.tokenHelp"),e.usageIncomplete?` ${t("developmentRuns.partialHelp")}`:""]})]})})})]})]})}function lV(e){return a.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M0 5.6016C7.82288e-05 0.621244 6.02226 -1.87314 9.54395 1.64847L40.1289 32.2334L68.5732 3.7891C69.5834 2.77903 70.9533 2.21099 72.3818 2.21097H82.7031C82.7917 2.20658 82.8806 2.20414 82.9697 2.20414H104.775C109.574 2.20427 111.977 8.00691 108.584 11.4004L64.916 55.0664C64.3075 55.8528 63.9436 56.7647 63.8242 57.6993C63.7142 56.4884 63.1964 55.3069 62.2695 54.3799L45.4082 37.5186H45.4072L40.124 32.2354L17.832 54.5284C16.7671 55.5933 16.2416 56.993 16.2549 58.3887C16.2417 59.7843 16.7672 61.1842 17.832 62.2491L39.9287 84.3467L9.54395 114.733C6.0223 118.255 0.000223474 115.761 0 110.78V5.6016ZM63.8018 58.8702C63.8962 59.9086 64.2936 60.9229 64.9961 61.7735L108.591 105.368C111.984 108.762 109.58 114.564 104.781 114.564H94.4336C94.3543 114.568 94.274 114.569 94.1934 114.569H72.3877C70.9592 114.569 69.5892 114.002 68.5791 112.992L39.9336 84.3467L58.4531 65.8282L58.4453 65.8203L62.2695 61.9981C63.1476 61.12 63.6567 60.0136 63.8018 58.8702Z",fill:"currentColor"})})}function XP({kind:e,...t}){return e==="thinking"?a.jsx(lV,{...t}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:e==="tool"?a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),a.jsx("path",{d:"m7 9 3 3-3 3m6 0h4"})]}):e==="plan"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m4 7 1.5 1.5L8 6m-4 7 1.5 1.5L8 12M11 7h9m-9 6h9m-9 6h9"}),a.jsx("circle",{cx:"6",cy:"19",r:"1"})]}):a.jsx(a.Fragment,{children:a.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9zM14 3v6h6M8 13h8m-4-3v6M8 18h8"})})})}function DDt({blocks:e,active:t,status:n,render:i}){const{t:r}=Ae("adk"),[s,o]=p.useState(!1),l=[...e].reverse().find(h=>"done"in h&&!h.done),c=e.filter(h=>h.kind==="tool"),u=c.filter(h=>h.durationMs!=null),d=u.reduce((h,m)=>h+(m.durationMs||0),0);let f=r("developmentRuns.processSummary",{count:e.length});return t&&(f=n||((l==null?void 0:l.kind)==="thinking"?r("developmentRuns.thinking"):(l==null?void 0:l.kind)==="tool"?DCe(l):(l==null?void 0:l.kind)==="plan"?r("developmentRuns.plan"):(l==null?void 0:l.kind)==="diff"?r("developmentRuns.diff"):r("developmentRuns.processing"))),a.jsxs("section",{className:"development-process",children:[a.jsxs("button",{type:"button",className:"development-process__toggle","aria-expanded":s,onClick:()=>o(!s),children:[a.jsx(r1,{className:`tool-chevron${s?" is-open":""}`}),a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:(l==null?void 0:l.kind)==="thinking"||(l==null?void 0:l.kind)==="plan"||(l==null?void 0:l.kind)==="diff"?l.kind:"tool"})}),t?a.jsx(yn,{className:"development-process__title","aria-live":"polite",children:f}):a.jsx("span",{className:"development-process__title",children:f}),!t&&c.length>0&&a.jsxs("span",{className:"development-process__duration",children:[r("developmentRuns.toolCalls",{count:c.length}),u.length>0?` · ${r(u.length===c.length?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:PCe(d)})}`:""]})]}),a.jsx("div",{className:"development-process__items",hidden:!s,children:i(e)})]})}function MDt({blocks:e,active:t,status:n="",render:i}){const{t:r}=Ae("adk"),s=bZe(e),o=s[s.length-1],l=[...e].reverse().find(u=>u.kind==="progress"),c=n||((l==null?void 0:l.kind)==="progress"?l.text:"");return a.jsxs(a.Fragment,{children:[s.map(u=>u.process?a.jsx(DDt,{blocks:u.blocks,active:t&&u===o,status:c,render:i},u.id):a.jsx("div",{"data-assistant-phase":u.blocks[0].phase,children:i(u.blocks)},u.id)),t&&!(o!=null&&o.process)&&a.jsxs("div",{className:"development-process__status",role:"status",children:[a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:"thinking"})}),a.jsx(yn,{children:c||r("developmentRuns.processing")})]})]})}const LDt={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function $Dt(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(const r of n){if(i==null||typeof i!="object")return;i=i[r]}return i}function FDt(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function BDt(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function cV(e,t){if(FDt(e))return $Dt(t,e.path);if(BDt(e)){const n=LDt[e.call],i={};for(const[r,s]of Object.entries(e.args??{}))i[r]=cV(s,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function UDt(e,t){const n=cV(e,t);return n==null?"":typeof n=="string"?n:String(n)}const rMe=new Map;function s0(e,t){rMe.set(e,t)}function QDt(e){return rMe.get(e)}function zDt(e,t,n){const i=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(let s=0;scV(i,e.dataModel),resolveString:i=>UDt(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const r=e.components[i];if(!r)return null;const s=QDt(r.component)??VDt;return a.jsx(s,{node:r,ctx:n},i)}};return a.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function oMe(e){const t=p.useRef(null),n=p.useRef(!0),i=28,r=p.useCallback(()=>{const s=t.current;s&&(n.current=s.scrollHeight-s.scrollTop-s.clientHeight{const s=t.current;s&&n.current&&(s.scrollTop=s.scrollHeight)},[e]),{ref:t,onScroll:r}}function YP({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){const{t:r}=Ae("conversation");return e.skills.length===0&&!e.targetAgent?null:a.jsxs("div",{className:"invocation-chips","aria-label":r("invocation.ariaLabel"),children:[e.skills.map(s=>a.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[a.jsx(BS,{"aria-hidden":!0}),a.jsxs("span",{children:[t,s.name]}),n?a.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":r("invocation.removeSkill",{name:s.name}),children:a.jsx(xa,{})}):null]},s.name)),e.targetAgent?a.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[a.jsx(SAe,{"aria-hidden":!0}),a.jsx("span",{children:e.targetAgent.name}),i?a.jsx("button",{type:"button",onClick:i,"aria-label":r("invocation.removeAgent",{name:e.targetAgent.name}),children:a.jsx(xa,{})}):null]}):null]})}function uV(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function aMe(e){var n,i,r,s;const t=uV(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((i=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:i.toUpperCase())??"VIDEO":t==="image"?((s=(r=e.mimeType)==null?void 0:r.split("/")[1])==null?void 0:s.toUpperCase())??"IMAGE":"TXT"}function lMe(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function cMe(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?mEe(t,e.uri):""}function qDt({kind:e}){return e==="image"?a.jsx(tQ,{}):e==="video"?a.jsx(CAe,{}):e==="pdf"?a.jsx(eit,{}):a.jsx(JU,{})}function ZP({appName:e,items:t,compact:n=!1,onRemove:i}){const{t:r}=Ae("conversation"),[s,o]=p.useState(null);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(l=>{const c=uV(l.mimeType),u=cMe(l,e),d=l.status==="uploading"||l.status==="error"||!u,f=a.jsxs("button",{type:"button",className:"media-card-main",disabled:d,onClick:c==="image"?void 0:()=>o(l),"aria-label":r("media.preview",{name:l.name??r("media.attachment")}),children:[c==="image"&&u?a.jsx("img",{className:"media-card-image",src:u,alt:l.name??r("media.image"),loading:"lazy"}):c==="video"&&u?a.jsxs("div",{className:"media-card-video-container",children:[a.jsx("video",{className:"media-card-video",src:u,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),a.jsx("span",{className:"media-card-video-play",children:a.jsx(fit,{})})]}):a.jsx("span",{className:"media-card-icon",children:a.jsx(qDt,{kind:c})}),a.jsxs("span",{className:"media-card-copy",children:[a.jsx("span",{className:"media-card-name",children:l.name??r("media.attachment")}),a.jsxs("span",{className:"media-card-meta",children:[a.jsx("span",{className:"media-card-type",children:aMe(l)}),l.status==="uploading"?a.jsxs(a.Fragment,{children:[a.jsx(Ei,{className:"media-card-spinner"})," ",r("media.uploading")]}):l.status==="error"?l.error??r("media.uploadFailed"):lMe(l.sizeBytes)]})]}),!n&&l.status!=="uploading"&&l.status!=="error"?a.jsx(nx,{className:"media-card-open"}):null]});return a.jsxs(dr.div,{className:`media-card media-card--${c}${l.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[c==="image"&&!d?a.jsx(BSe,{src:u,children:f}):f,i?a.jsx("button",{type:"button",className:"media-card-remove","aria-label":r("media.remove",{name:l.name??r("media.attachment")}),onClick:()=>i(l.id),children:a.jsx(xa,{})}):null]},l.id)})}),a.jsx(Ed,{children:s?a.jsx(WDt,{appName:e,item:s,onClose:()=>o(null)}):null})]})}function WDt({appName:e,item:t,onClose:n}){const{t:i}=Ae("conversation"),r=p.useMemo(()=>cMe(t,e),[e,t]),s=uV(t.mimeType),[o,l]=p.useState(""),[c,u]=p.useState(s==="text"||s==="markdown"),[d,f]=p.useState("");return p.useEffect(()=>{const h=m=>{m.key==="Escape"&&n()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n]),p.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const h=new AbortController;return u(!0),f(""),fetch(r,{signal:h.signal}).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(l).catch(m=>{h.signal.aborted||f(m instanceof Error?m.message:String(m))}).finally(()=>{h.signal.aborted||u(!1)}),()=>h.abort()},[s,r]),a.jsx(dr.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":i("media.previewDialog",{name:t.name??i("media.attachment")}),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:h=>{h.target===h.currentTarget&&n()},children:a.jsxs(dr.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[a.jsxs("header",{className:"media-viewer-header",children:[a.jsxs("div",{children:[a.jsx("strong",{children:t.name??i("media.attachment")}),a.jsxs("span",{children:[aMe(t),t.sizeBytes?` · ${lMe(t.sizeBytes)}`:""]})]}),a.jsxs("nav",{children:[a.jsx("a",{href:r,download:t.name,"aria-label":i("media.download"),children:a.jsx(eP,{})}),a.jsx("button",{type:"button",onClick:n,"aria-label":i("media.close"),children:a.jsx(xa,{})})]})]}),a.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?a.jsx("img",{src:r,alt:t.name??i("media.image")}):null,s==="video"?a.jsx("div",{className:"media-viewer-video-wrapper",children:a.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?a.jsx("iframe",{src:r,title:t.name??"PDF"}):null,c?a.jsxs("div",{className:"media-viewer-loading",children:[a.jsx(Ei,{})," ",i("media.reading")]}):null,!c&&d?a.jsx("div",{className:"media-viewer-loading",children:i("media.loadFailed",{error:d})}):null,!c&&s==="markdown"?a.jsx("div",{className:"media-document",children:a.jsx(Yu,{text:o})}):null,!c&&s==="text"?a.jsx("pre",{className:"media-document media-document--plain",children:o}):null]})]})})}function KDt({definition:e,label:t,done:n,open:i,onToggle:r}){const{t:s}=Ae("conversation"),o=e.icon,l=n?e.doneLabel:e.runningLabel,c=t??s(`blocks.tools.${e.name}.${n?"done":"running"}`,{defaultValue:l});return a.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":i,children:[a.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:a.jsx(o,{})}),n?a.jsx("span",{className:"builtin-tool-label",children:c}):a.jsx(yn,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:c}),a.jsx(r1,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}function nu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function In(e){return typeof e=="string"?e:""}function zte(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Nu(e){return Array.isArray(e)?e:[]}function O8(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=nu(t)??{};return nu(n.result)??n}function JP(e){if(typeof e=="string")try{return JP(JSON.parse(e))}catch{return e}const t=nu(e);if(!t)return"";const n=nu(t.result);return In(t.error)||In(t.message)||In(n==null?void 0:n.error)||In(n==null?void 0:n.message)}function GDt(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=nu(e.metadata),n=In(t==null?void 0:t.source_type).toLowerCase(),i=In(e.source).toLowerCase();return n==="skillhub"||i.startsWith("skill_hub:")?"skill_hub":"skill_space"}const uMe={tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknownSource:"Unknown source",unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"};function XDt(e,t){return e==="veadk_builtin_tools"?t.tool:e==="agentkit_knowledge"?t.knowledge:e.startsWith("skill_hub:")?`Skill Hub ${e.slice(10)}`:e.startsWith("skill_space:")?`${t.skillCenter} ${e.slice(12)}`:e||t.unknownSource}function YDt(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function ZDt(e,t=uMe){const n=O8(e),i=nu(n.capabilities)??{},r=Nu(n.resources).flatMap(o=>{const l=nu(o);if(!l)return[];const c=l.kind==="tool"?"tool":l.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:In(l.ref),kind:c,category:GDt(l),name:In(l.name)||In(l.ref)||t.unnamedResource,description:In(l.description),source:In(l.source),version:In(l.version)}]}),s=Nu(n.sources).flatMap(o=>{const l=nu(o);if(!l)return[];const c=In(l.source),u=In(l.status),d=u==="error"?"error":u==="skipped"?"skipped":"ok";return[{source:c,category:YDt(c),label:XDt(c,t),status:d,count:zte(l.count),message:In(l.message),searchKeywords:Nu(l.search_keywords).map(In).filter(Boolean)}]});return{collectionId:In(n.collection_id),capabilities:{googleAdkVersion:In(i.google_adk_version),agentTypes:Nu(i.agent_types).map(In).filter(Boolean),maxOrchestrationDepth:zte(i.max_orchestration_depth)},resources:r,sources:s,counts:{all:r.length,skill_hub:r.filter(o=>o.category==="skill_hub").length,skill_space:r.filter(o=>o.category==="skill_space").length,knowledge_base:r.filter(o=>o.category==="knowledge_base").length,tool:r.filter(o=>o.category==="tool").length}}}function JDt(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function dMe(e,t,n=uMe){const i=O8(e),r=O8(t),s=new Map(Nu(r.results).flatMap(d=>{const f=nu(d),h=In(f==null?void 0:f.name);return f&&h?[[h,f]]:[]})),o=Nu(i.agents).flatMap(d=>{const f=nu(d),h=In(f==null?void 0:f.name);return f&&h?[f]:[]}),l=new Set(o.map(d=>In(d.name))),c=[...s.entries()].filter(([d])=>!l.has(d)).map(([d])=>({name:d})),u=[...o,...c].map(d=>{const f=In(d.name),h=Nu(d.nodes).flatMap(C=>{const E=nu(C);return E?[E]:[]}),m=In(d.root_node),g=h.find(C=>In(C.id)===m),b=h.filter(C=>In(C.id)!==m).map(C=>({id:In(C.id)||n.unnamedAgent,type:In(C.type)||"llm",description:In(C.description)})),v=s.get(f),y=In(v==null?void 0:v.status),x=y==="failed"?"failed":y==="completed"?"completed":"running",w=Vte(v==null?void 0:v.resources),O=w.length>0?w:Vte(h.flatMap(C=>Nu(C.resources))),S=Hte(v==null?void 0:v.python_tools),k=S.length>0?S:Hte(h.flatMap(C=>Nu(C.python_tools)));return{name:f,description:In(v==null?void 0:v.description)||In(g==null?void 0:g.description)||In(d.task),task:In(d.task),rootType:In(v==null?void 0:v.root_type)||In(g==null?void 0:g.type)||"llm",nodeCount:h.length,subAgentCount:b.length,resourceCount:O.length,pythonToolCount:k.length,skills:O.filter(C=>C.kind==="skill"),knowledgeBases:O.filter(C=>C.kind==="knowledge_base"),builtinTools:O.filter(C=>C.kind==="tool"),pythonTools:k,subAgents:b,status:x,output:In(v==null?void 0:v.output),error:In(v==null?void 0:v.error)}});return{collectionId:In(r.collection_id)||In(i.collection_id),agents:u,completedCount:u.filter(d=>d.status==="completed").length,failedCount:u.filter(d=>d.status==="failed").length,runningCount:u.filter(d=>d.status==="running").length}}function eMt(e,t){return!!JP(t)||dMe(e,t).failedCount>0}function Vte(e){const t=new Set;return Nu(e).flatMap(n=>{const i=nu(n),r=In(i?i.ref:n);if(!r||t.has(r))return[];t.add(r);const s=In(i==null?void 0:i.kind),o=s==="tool"||r.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||r.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=r.split(":");return[{ref:r,kind:o,name:In(i==null?void 0:i.name)||l[l.length-1]||r,description:In(i==null?void 0:i.description),version:In(i==null?void 0:i.version),source:In(i==null?void 0:i.source)}]})}function Hte(e){const t=new Set;return Nu(e).flatMap(n=>{const i=nu(n),r=In(i==null?void 0:i.name),s=In(i==null?void 0:i.code),o=`${r}\0${s}`;return!i||!r||t.has(o)?[]:(t.add(o),[{name:r,description:In(i.description),code:s,entrypoint:In(i.entrypoint)||r,dependencies:Nu(i.dependencies).map(In).filter(Boolean)}])})}function tMt({branch:e}){return a.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?a.jsx(Yu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?a.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?a.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function nMt({args:e,response:t,status:n,onBranchSelect:i}){const{t:r}=Ae("conversation"),s=p.useMemo(()=>RAe(e,t,n),[e,t,n]),[o,l]=p.useState(0);return a.jsxs("section",{className:"branch-compare","aria-label":r("blocks.branchCompare.ariaLabel"),children:[a.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":r("blocks.branchCompare.selectDirection"),children:s.branches.map((c,u)=>a.jsx("button",{className:`branch-compare__tab${o===u?" is-active":""}`,type:"button",role:"tab","aria-selected":o===u,"aria-controls":`branch-compare-panel-${u}`,onClick:()=>l(u),children:a.jsx(Io,{color:"info",size:"sm",variant:"soft",children:c.label})},`${c.label}:${u}`))}),a.jsx("div",{className:"branch-compare__branches",children:s.branches.map((c,u)=>a.jsxs("article",{className:`branch-compare__branch${o===u?" is-active":""}`,id:`branch-compare-panel-${u}`,role:"tabpanel",children:[a.jsx("header",{className:"branch-compare__head",children:a.jsx(Io,{color:"info",size:"sm",variant:"soft",children:c.label})}),a.jsx(tMt,{branch:c}),a.jsx("footer",{className:"branch-compare__footer",children:a.jsx(Dt,{type:"button",color:"info",variant:"ghost",size:"sm",pill:!1,disabled:c.status!=="completed",onClick:()=>i==null?void 0:i(c),children:r("blocks.branchCompare.continue")})})]},`${c.label}:${u}`))})]})}function fMe({controlled:e,default:t,name:n,state:i="value"}){const{current:r}=p.useRef(e!==void 0),[s,o]=p.useState(t),l=r?e:s,c=p.useCallback(u=>{r||o(u)},[]);return[l,c]}const hMe=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function iMt(){return p.useContext(hMe)}function rMt(e){const{children:t,elementsRef:n,labelsRef:i,onMapChange:r}=e,s=Wn(r),[,o]=p.useState(!1),l=Ku(oMt).current,c=Ku(sMt).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=Wn(()=>{d.current||(d.current=!0,o(S=>!S))}),g=Wn((S,k)=>{c.set(S,k),m()}),b=Wn(S=>{c.delete(S),m()}),v=Wn(S=>{const k=new Map;return n.current.length=0,i&&(i.current.length=0),S.forEach(C=>{var E,R;k.set(C.element,{...C.registration.metadata??{},index:C.index}),n.current[C.index]=C.element,i&&(i.current[C.index]=C.registration.label!==void 0?C.registration.label:((R=(E=C.registration.textRef)==null?void 0:E.current)==null?void 0:R.textContent)??C.element.textContent)}),u.current=n.current.length,k});function y(S){var E;if((E=h.current)==null||E.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const k=new MutationObserver(R=>{if(!cMt(R))return;let _=null;for(const j of S)if(j.isConnected){if(_&&pMe(_,j)>0){k.disconnect(),m();return}_=j}});h.current=k;const C=new Set;for(let R=1;Rk.observe(R,{childList:!0}))}const x=Wn(()=>{const[S,k]=aMt(c),C=v(S);y(k),f.current=S,d.current=!1,l.forEach(E=>E(C)),s(C)});Un(()=>(d.current||v(f.current),()=>{n.current=[],i&&(i.current=[])}),[n,i,v]),Un(()=>{d.current&&x()}),Un(()=>()=>{var S;(S=h.current)==null||S.disconnect(),d.current=!0},[]);const w=Wn(S=>(l.add(S),()=>{l.delete(S)})),O=p.useMemo(()=>({register:g,unregister:b,subscribeMapChange:w,nextIndexRef:u}),[g,b,w,u]);return a.jsx(hMe.Provider,{value:O,children:t})}function sMt(){return new Map}function oMt(){return new Set}function aMt(e){const t=new Set,n=[],i=[];e.forEach((s,o)=>{if(!o.isConnected)return;const l=s.index,c={index:l??-1,element:o,registration:s};l===null?i.push(c):l>=0&&(t.add(l),n.push(c))});let r=0;return i.sort((s,o)=>pMe(s.element,o.element)),i.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,o)=>s.index-o.index),[n,i.map(s=>s.element)]}function lMt(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function cMt(e){for(const t of e)for(let n=0;nnull},bMe=p.forwardRef(function(t,n){const{render:i,className:r,disabled:s=!1,hiddenUntilFound:o,keepMounted:l,loopFocus:c,onValueChange:u,multiple:d=!1,orientation:f="vertical",value:h,defaultValue:m,style:g,...b}=t,v=p.useMemo(()=>{if(h===void 0)return m??[]},[h,m]),y=p.useRef([]),[x,w]=fMe({controlled:h,default:v,name:"Accordion",state:"value"}),O=Wn((E,R,_)=>{if(d)if(R){const j=x.slice();if(j.push(E),u==null||u(j,_),_.isCanceled)return;w(j)}else{const j=x.filter(T=>T!==E);if(u==null||u(j,_),_.isCanceled)return;w(j)}else{const j=x[0]===E?[]:[E];if(u==null||u(j,_),_.isCanceled)return;w(j)}}),S=p.useMemo(()=>({value:x,disabled:s,orientation:f}),[x,s,f]),k=p.useMemo(()=>({disabled:s,handleValueChange:O,hiddenUntilFound:o??!1,keepMounted:l??!1,state:S,value:x}),[s,O,o,l,S,x]),C=Do("div",t,{state:S,ref:n,props:b,stateAttributesMapping:uMt});return a.jsx(mMe.Provider,{value:k,children:a.jsx(rMt,{elementsRef:y,children:C})})});function dMt(e){const{open:t,defaultOpen:n,onOpenChange:i,disabled:r}=e,[s,o]=fMe({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=KTe(s,!0,!0),d=hg(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=Wn(b=>{const v=!s,y=Gs(Kx,b.nativeEvent);i(v,y),!y.isCanceled&&o(v)});return p.useMemo(()=>({defaultPanelId:d,disabled:r,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:o,setPanelIdState:h,transitionStatus:u}),[d,r,g,l,s,m,c,o,h,u])}const yMe=p.createContext(void 0);function vMe(){const e=p.useContext(yMe);if(e===void 0)throw new Error(du(15));return e}function fMt(e={}){const{guess:t,label:n,metadata:i,textRef:r,index:s}=e,{register:o,unregister:l,subscribeMapChange:c,nextIndexRef:u}=iMt(),d=p.useRef(-1),[f,h]=p.useState(s==null&&t?()=>{if(d.current===-1){const v=u.current;u.current+=1,d.current=v}return d.current}:-1),m=s??f,g=p.useRef(null),b=p.useCallback(v=>{const y=g.current;y&&l(y),g.current=v,v&&o(v,{metadata:i??null,index:s??null,label:n,textRef:r})},[s,o,l,i,n,r]);return Un(()=>{if(s==null)return c(v=>{var x;const y=g.current?(x=v.get(g.current))==null?void 0:x.index:null;y!=null&&h(y)})},[s,c]),{ref:b,index:m}}const xMe=p.createContext(void 0);function dV(){const e=p.useContext(xMe);if(e===void 0)throw new Error(du(9));return e}let fV=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=pN.startingStyle]="startingStyle",e[e.endingStyle=pN.endingStyle]="endingStyle",e}({}),hMt=function(e){return e.panelOpen="data-panel-open",e}({});const pMt={[fV.open]:""},mMt={[fV.closed]:""},gMt={open(e){return e?{[hMt.panelOpen]:""}:null}},bMt={open(e){return e?pMt:mMt}};let yMt=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const hV={...bMt,index:e=>({[yMt.index]:String(e)}),...KI,value:()=>null},wMe=p.forwardRef(function(t,n){const{className:i,disabled:r=!1,onOpenChange:s,render:o,value:l,style:c,...u}=t,{ref:d,index:f}=fMt(),h=Wx(n,d),{disabled:m,handleValueChange:g,state:b,value:v}=gMe(),y=hg(),x=l??y,w=r||m,O=v.indexOf(x)!==-1,S=Wn((D,M)=>{s==null||s(D,M),!M.isCanceled&&g(x,D,M)}),k=dMt({open:O,onOpenChange:S,disabled:w}),C=p.useMemo(()=>({open:k.open,disabled:k.disabled,transitionStatus:k.transitionStatus}),[k.open,k.disabled,k.transitionStatus]),E=p.useMemo(()=>({...k,onOpenChange:S,state:C}),[k,C,S]),R=p.useMemo(()=>({...b,hidden:!O&&!k.mounted,index:f,disabled:w,open:O}),[k.mounted,w,f,O,b]),_=hg(),[j,T]=p.useState(),N=j===null?void 0:j??_,A=p.useMemo(()=>({defaultTriggerId:_,open:O,state:R,setTriggerId:T,triggerId:N}),[_,O,R,T,N]),P=Do("div",t,{state:R,ref:h,props:u,stateAttributesMapping:hV});return a.jsx(yMe.Provider,{value:E,children:a.jsx(xMe.Provider,{value:A,children:P})})}),OMe=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,{state:l}=dV();return Do("h3",t,{state:l,ref:n,props:o,stateAttributesMapping:hV})}),kMe=p.forwardRef(function(t,n){const{disabled:i,className:r,id:s,render:o,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=vMe(),g=i||m,{getButtonProps:b,buttonRef:v}=QU({disabled:g,focusableWhenDisabled:!0,native:l}),{defaultTriggerId:y,state:x,setTriggerId:w}=dV(),O=s||void 0,S=O??y;return Un(()=>(w(E=>O??(E===null?void 0:E)),()=>{w(E=>E===O?null:E)}),[O,w]),Do("button",t,{state:x,ref:[n,v],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:gMt})}),dO={height:void 0,width:void 0};function vMt(e){const{externalRef:t,hiddenUntilFound:n,id:i,keepMounted:r,mounted:s,onOpenChange:o,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(dO),b=p.useRef(dO),v=p.useRef(!1),y=p.useRef(l),x=p.useRef(!1),[w,O]=p.useState(!1),S=p.useRef(null),k=Wx(t,f),C=Ol(l),E=UU(f),R=!l&&!s,_=w?"idle":d,j=l&&(y.current||x.current),T=!l&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?b.current:m,N=n&&R&&h.current!=="css-animation",A=Wn((U,I=!0)=>{I&&(b.current=U),g(U)}),P=Wn(()=>{var U;(U=S.current)==null||U.call(S),S.current=null}),D=Wn(U=>{P(),S.current=()=>{S.current=null,U()}}),M=Wn(()=>{l&&s&&h.current==="css-animation"&&(x.current=!0)});Un(()=>{!w||d==="starting"||O(!1)},[w,d]),p.useEffect(()=>()=>{M(),P()},[M,P]),Un(()=>{const U=f.current;if(!U)return;!l&&S.current&&P();const I=xMt(U,j);if(h.current=I,l&&d==="idle"&&y.current&&I==="css-animation"){b.current=z0(U);return}if(l&&d==="starting"){const F=v.current;if(v.current=!1,I==="none"){A(z0(U)),O(!0);return}if(I==="css-transition"){const X=wMt(U);if(A(z0(U)),!F)return X;const ie=i2(U,"transition-duration","0s");return D(ie),O(!0),X}A(z0(U));const W=i2(U,"animation-name","none");if(!F){W();return}const V=i2(U,"animation-duration","0s");W(),D(V),O(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(y.current=!1,x.current=!1,I==="none"){A(dO,!1),c(!1);return}A(z0(U));return}if(d!=="ending")return;if(I==="none"){c(!1);return}const H=z0(U);if(!(H.height>0||H.width>0)){c(!1);return}A(H),I==="css-animation"&&i2(U,"animation-name","none")()},[s,l,P,A,c,D,j,d]),mC({enabled:l&&s&&_==="idle",open:!0,ref:f,onComplete(){l&&A(dO,!1)}}),p.useEffect(()=>{if(l||!s||_!=="ending"||!f.current)return;const I=new AbortController;let H=-1;function K(){C.current||(c(!1),A(dO,!1))}return H=Yl.request(()=>{E(K,I.signal)}),()=>{Yl.cancel(H),I.abort()}},[C,s,l,_,E,A,c]),Un(()=>{const U=f.current;!U||!n||!R||U.setAttribute("hidden","until-found")},[R,n]),p.useEffect(function(){const I=f.current;if(!I)return;function H(K){const F=Gs(vTe,K);o(!0,F),!F.isCanceled&&(v.current=!0,u(!0))}return mi(I,"beforematch",H)},[o,u]);const L=r||n||s||l;return{height:T.height,props:{...N?{[fV.startingStyle]:""}:void 0,hidden:R,id:i},ref:k,shouldPreventOpenAnimation:j,shouldRender:L,transitionStatus:_,width:T.width}}function z0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function xMt(e,t){const n=Fs(e).getComputedStyle(e),i=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&qte(n.animationDuration),r=qte(n.transitionDuration);return i&&r||r?"css-transition":i?"css-animation":"none"}function qte(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function i2(e,t,n){const i=e.style.getPropertyValue(t),r=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(i===""){e.style.removeProperty(t);return}e.style.setProperty(t,i,r)}}function wMt(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(r=>{e.style.setProperty(r,"initial","important")});function n(){Object.entries(t).forEach(([r,s])=>{if(s===""){e.style.removeProperty(r);return}e.style.setProperty(r,s)})}const i=Yl.request(n);return()=>{Yl.cancel(i),n()}}let Wte=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const SMe=p.forwardRef(function(t,n){const{className:i,hiddenUntilFound:r,keepMounted:s,id:o,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=gMe(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,setPanelIdState:x,transitionStatus:w}=vMe(),O=r??d,S=s??f,k=o||void 0,C=o??h;Un(()=>(x(I=>k??(I===null?void 0:I)),()=>{x(I=>I===k?null:I)}),[k,x]);const{height:E,props:R,ref:_,shouldPreventOpenAnimation:j,shouldRender:T,transitionStatus:N,width:A}=vMt({externalRef:n,hiddenUntilFound:O,id:C,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,transitionStatus:w}),{state:P,triggerId:D}=dV(),M={...P,transitionStatus:N},L=lTe(c,M),U=Do("div",{...t,style:void 0},{state:M,ref:_,props:[R,{"aria-labelledby":D,role:"region",style:{[Wte.accordionPanelHeight]:E===void 0?"auto":`${E}px`,[Wte.accordionPanelWidth]:A===void 0?"auto":`${A}px`}},u,L?{style:L}:void 0,j?{style:{animationName:"none"}}:void 0],stateAttributesMapping:hV});return T?U:null}),OMt=(e,t)=>{const n=e.currentTarget,i={x:e.clientX,y:e.clientY},r=kMt(i,n.getBoundingClientRect()),s=SMt(i,r),o=EMt(t.getBoundingClientRect());return TMt([...s,...o])};function kMt(e,t){const n=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,i,r,s)){case s:return"left";case r:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function SMt(e,t,n=5){const i=[];switch(t){case"top":i.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":i.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":i.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":i.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return i}function EMt(e){const{top:t,right:n,bottom:i,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:i},{x:r,y:i}]}function CMt(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}function TMt(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),AMt(t)}function AMt(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let i=e.length-1;i>=0;i--){const r=e[i];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const _Mt="_Transition_1wdpp_1",jMt="_Popover_1wdpp_3",EMe={Transition:_Mt,Popover:jMt},CMe=p.createContext(null),eD=()=>{const e=p.use(CMe);if(!e)throw new Error("Popover components must be wrapped in ");return e},Vm=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:i=150,children:r})=>{const[s,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null),f=p.useRef(void 0),h=p.useRef(!1),m=p.useRef(!1),g=e??s,[b,v]=p.useState(!1);rQ(()=>v(!1),b?500:null);const y=lg(t),x=lg(C=>{var E,R;clearTimeout(f.current),g!==C&&(C||(c(!1),n&&h.current&&((E=u.current)==null||E.focus()),h.current=!1),(R=y.current)==null||R.call(y,C),o(C),n&&v(C))}),w=p.useCallback(C=>{x.current(C)},[x]),O=p.useCallback(()=>{f.current=setTimeout(()=>w(!0),i)},[w,i]),S=p.useCallback(()=>{clearTimeout(f.current)},[]);p.useEffect(()=>()=>{clearTimeout(f.current)},[]);const k=p.useMemo(()=>({open:g,setOpen:w,shake:l,setShake:c,showOnHover:n,temporarilyPreventClickToClose:b,onTriggerEnter:O,onTriggerLeave:S,isPointerInTransitRef:m,triggerRef:u,contentRef:d,hoverOpenFocusedWithTab:h}),[g,w,l,c,n,b,h,m,O,S]);return a.jsx(CMe,{value:k,children:a.jsx(v_e,{open:g,onOpenChange:w,modal:!1,children:r})})},NMt=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:i,showOnHover:r,temporarilyPreventClickToClose:s,onTriggerEnter:o,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=eD(),f=p.useRef(!1),h=b=>{!(b.currentTarget.nodeName.toLocaleLowerCase()==="a")&&s&&(b.preventDefault(),b.stopPropagation())},m=b=>{b.pointerType!=="touch"&&!f.current&&!c.current&&(o(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return a.jsx(x_e,{asChild:!0,ref:u,onPointerDown:b=>{h(b),t==null||t(b)},onClick:b=>{h(b),n==null||n(b)},onPointerMove:r?m:void 0,onPointerLeave:r?g:void 0,onFocus:r?()=>i(!0):void 0,onBlur:r?()=>{setTimeout(()=>{var b;(b=d.current)!=null&&b.contains(document.activeElement)||i(!1)},50)}:void 0,children:e})},TMe=({children:e,avoidCollisions:t,width:n,minWidth:i,maxWidth:r,side:s,sideOffset:o=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=eD(),b=v=>{const y=g.current;if(y&&v.target===y&&v.key==="Tab"&&v.shiftKey){v.preventDefault(),v.stopPropagation();const x=HAe(y),w=x[x.length-1];w==null||w.focus()}};return p.useEffect(()=>{const v=g.current;!v||!f||v!=null&&v.contains(document.activeElement)||h||v.focus({preventScroll:!0})},[g,h,f]),a.jsx(O_e,{forceMount:!0,ref:g,className:Ti(EMe.Popover,d),style:zy({"popover-width":n,"popover-min-width":i,"popover-max-width":r}),onCloseAutoFocus:h?Kh:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:o,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Kh,onEscapeKeyDown:Kh,onKeyDown:b,children:e})},RMt=e=>{const{setOpen:t,triggerRef:n,contentRef:i,isPointerInTransitRef:r,hoverOpenFocusedWithTab:s}=eD(),[o,l]=p.useState(null),c=p.useCallback(()=>{l(null),r.current=!1},[r]),u=p.useCallback((d,f)=>{const h=OMt(d,f);l(h),r.current=!0},[r]);return p.useEffect(()=>()=>c(),[c]),p.useEffect(()=>{const d=n.current,f=i.current;if(!d||!f)return;const h=g=>u(g,f),m=g=>u(g,d);return d.addEventListener("pointerleave",h),f.addEventListener("pointerleave",m),()=>{d.removeEventListener("pointerleave",h),f.removeEventListener("pointerleave",m)}},[i,n,u,c]),p.useEffect(()=>{if(!o)return;const d=f=>{const h=n.current,m=i.current,g=f.target,b={x:f.clientX,y:f.clientY},v=(h==null?void 0:h.contains(g))||(m==null?void 0:m.contains(g)),y=!CMt(b,o),x=g.hasAttribute("aria-haspopup");v?c():(y||x)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[o,t,c,n,i]),p.useEffect(()=>{const d=f=>{if(i.current&&f.key==="Tab"&&!f.shiftKey){const[h]=HAe(i.current);h&&(f.preventDefault(),h.focus(),s.current=!0,document.removeEventListener("keydown",d))}};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[i,s]),a.jsx(TMe,{...e})},IMt=e=>{const{open:t,showOnHover:n,setOpen:i}=eD();return SC(t,()=>{i(!1)}),a.jsx(w_e,{forceMount:!0,children:a.jsx(Ww,{enterDuration:600,exitDuration:300,className:EMe.Transition,disableAnimations:!0,children:t&&(n?a.jsx(RMt,{...e},"popover-hover"):a.jsx(TMe,{...e},"popover"))})})};Vm.Trigger=NMt;Vm.Content=IMt;const PMt=["skill_hub","skill_space","knowledge_base","tool"];function AMe(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m4 6 4 4 4-4"})})}function _Me({label:e}){return a.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>a.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{})]},t))})}function DMt(e,t){return e.kind==="tool"?t("blocks.createAgents.builtinTool"):e.kind==="knowledge_base"?t("blocks.createAgents.knowledgeBase"):e.source.startsWith("skill_hub:")?"Skill Hub":e.source.startsWith("skill_space:")?t("blocks.createAgents.skillCenter"):"Skill"}function J5({label:e,resources:t}){const{t:n}=Ae("conversation");return t.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:e}),a.jsx("div",{className:"create-agent-card__popover-list",children:t.map(i=>a.jsxs("div",{className:"create-agent-card__popover-item",children:[a.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[a.jsx("strong",{children:i.name}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:DMt(i,n)})]}),i.description?a.jsx("p",{children:i.description}):null]},i.ref))})]})}function MMt({tools:e}){const{t}=Ae("conversation");return e.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:t("blocks.createAgents.selfAuthoredTools")}),a.jsx(bMe,{children:e.map((n,i)=>a.jsxs(wMe,{className:"create-agent-card__python-tool",value:`${n.name}:${i}`,children:[a.jsx(OMe,{className:"create-agent-card__python-tool-header",children:a.jsxs(kMe,{className:"create-agent-card__python-tool-trigger",children:[a.jsxs("span",{children:[a.jsx("strong",{children:n.name}),n.description?a.jsx("small",{children:n.description}):null]}),a.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:t("blocks.createAgents.selfAuthoredTools")}),a.jsx(AMe,{className:"create-agent-card__python-tool-chevron"})]})]})}),a.jsxs(SMe,{className:"create-agent-card__python-tool-panel",children:[n.dependencies.length>0?a.jsx("div",{className:"create-agent-card__python-tool-dependencies",children:t("blocks.createAgents.dependencies",{items:n.dependencies.join(", ")})}):null,a.jsx("pre",{tabIndex:0,"aria-label":t("blocks.createAgents.fullCode",{name:n.name}),children:a.jsx("code",{children:n.code})})]})]},`${n.name}:${i}`))})]})}function LMt({agents:e}){const{t}=Ae("conversation");return e.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:t("blocks.createAgents.subAgents")}),a.jsx("div",{className:"create-agent-card__popover-list",children:e.map(n=>a.jsxs("div",{className:"create-agent-card__popover-item",children:[a.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[a.jsx("strong",{children:n.id}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:t(`blocks.createAgents.agentTypes.${n.type}`,{defaultValue:n.type})})]}),n.description?a.jsx("p",{children:n.description}):null]},n.id))})]})}function r2({label:e,count:t,icon:n,children:i}){const{t:r}=Ae("conversation"),s=a.jsxs("button",{className:"create-agent-card__resource-metric",type:"button",disabled:t===0,"aria-label":r("blocks.createAgents.itemCount",{label:e,count:t}),children:[n,a.jsx("span",{children:t})]});return t===0?s:a.jsxs(Vm,{showOnHover:!0,hoverOpenDelay:120,children:[a.jsx(Vm.Trigger,{children:s}),a.jsx(Vm.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:i})]})}function $Mt({response:e,status:t}){const{t:n}=Ae("conversation"),i=p.useMemo(()=>({tool:n("blocks.createAgents.sourceLabels.tool"),knowledge:n("blocks.createAgents.sourceLabels.knowledge"),skillCenter:n("blocks.createAgents.sourceLabels.skillCenter"),unknownSource:n("blocks.createAgents.sourceLabels.unknown"),unnamedResource:n("blocks.createAgents.unnamedResource"),unnamedAgent:n("blocks.createAgents.unnamedAgent")}),[n]),r=p.useMemo(()=>ZDt(e,i),[i,e]),s=p.useMemo(()=>PMt.map(c=>{const u=JDt(r,c);return{value:c,label:n(`blocks.createAgents.categories.${c}`),...u,searchKeywords:[...new Set(u.sources.flatMap(d=>d.searchKeywords))]}}),[r,n]),o=t==="failed",l=o?JP(e):"";return a.jsx("section",{className:"create-agent-tool-card","aria-label":n("blocks.createAgents.collectionAria"),children:t==="running"?a.jsx(_Me,{label:n("blocks.createAgents.retrieving")}):o?a.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[a.jsx("span",{className:"create-agent-card__message-title",children:n("blocks.createAgents.retrievalFailed")}),a.jsx("span",{children:l||n("blocks.createAgents.checkConfig")})]}):a.jsx(bMe,{className:"create-agent-card__accordion",children:s.map(c=>a.jsxs(wMe,{className:"create-agent-card__accordion-item",value:c.value,children:[a.jsx(OMe,{className:"create-agent-card__accordion-header",children:a.jsxs(kMe,{className:"create-agent-card__accordion-trigger",children:[a.jsx("span",{children:c.label}),a.jsxs("span",{className:"create-agent-card__accordion-meta",children:[a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:c.sources.length===0?c.value==="skill_hub"?n("blocks.createAgents.notSearched"):n("blocks.createAgents.notConfigured"):c.resources.length}),a.jsx(AMe,{className:"create-agent-card__accordion-chevron"})]})]})}),a.jsx(SMe,{className:"create-agent-card__accordion-content",children:a.jsxs("div",{className:"create-agent-card__accordion-scroll",role:"region","aria-label":n("blocks.createAgents.resourceList",{label:c.label}),tabIndex:0,children:[c.value==="skill_hub"&&c.searchKeywords.length>0?a.jsxs("div",{className:"create-agent-card__search-keywords",children:[a.jsx("span",{children:n("blocks.createAgents.searchKeywords")}),a.jsx("span",{children:c.searchKeywords.join("、")})]}):null,c.resources.length>0?a.jsx("div",{className:"create-agent-card__resource-list",children:c.resources.map(u=>a.jsx("div",{className:"create-agent-card__resource",children:a.jsxs("div",{className:"create-agent-card__resource-main",children:[a.jsxs("div",{className:"create-agent-card__resource-title",children:[a.jsx("span",{className:"create-agent-card__resource-name",children:u.name}),u.version?a.jsx(Io,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:u.version}):null]}),u.description?a.jsx("p",{children:u.description}):null]})},u.ref))}):a.jsxs("div",{className:"create-agent-card__empty-category",children:[a.jsx("p",{children:c.sources.length===0?c.value==="skill_hub"?n("blocks.createAgents.skillHubSkipped"):n("blocks.createAgents.sourceSkipped",{label:c.label}):n("blocks.createAgents.noResources")}),c.sources.filter(u=>u.message).map(u=>a.jsx("p",{className:"create-agent-card__raw-source-error",children:u.message},u.source))]})]})})]},c.value))},r.collectionId||"collected-resources")})}function FMt({args:e,response:t,status:n}){const{t:i}=Ae("conversation"),r=p.useMemo(()=>({tool:i("blocks.createAgents.sourceLabels.tool"),knowledge:i("blocks.createAgents.sourceLabels.knowledge"),skillCenter:i("blocks.createAgents.sourceLabels.skillCenter"),unknownSource:i("blocks.createAgents.sourceLabels.unknown"),unnamedResource:i("blocks.createAgents.unnamedResource"),unnamedAgent:i("blocks.createAgents.unnamedAgent")}),[i]),s=p.useMemo(()=>dMe(e,t,r),[e,r,t]),o=n==="failed"?JP(t):"";return a.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":i("blocks.createAgents.resultAria"),children:[o?a.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[a.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.creationFailed")}),a.jsx("span",{children:o})]}):null,s.agents.length>0?a.jsx("div",{className:"create-agent-card__agent-grid",children:s.agents.map(l=>{const c=n==="failed"?"failed":l.status,u=l.error||c==="failed"&&o,d=l.builtinTools.length+l.pythonTools.length;return a.jsxs(Sz,{className:`create-agent-card__agent-card${u?" is-error":""}`,children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:l.name}),title:l.name,titleText:l.name,status:a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:i(`blocks.createAgents.agentTypes.${l.rootType}`,{defaultValue:l.rootType})})}),l.description?a.jsx(Cz,{children:l.description}):null,u?a.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:u}):null,a.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":i("blocks.createAgents.agentResources",{name:l.name}),children:[a.jsx(r2,{label:i("blocks.createAgents.skill"),count:l.skills.length,icon:a.jsx(j_,{"aria-hidden":"true"}),children:a.jsx(J5,{label:i("blocks.createAgents.skill"),resources:l.skills})}),a.jsx(r2,{label:i("blocks.createAgents.knowledgeBase"),count:l.knowledgeBases.length,icon:a.jsx(tje,{"aria-hidden":"true"}),children:a.jsx(J5,{label:i("blocks.createAgents.knowledgeBase"),resources:l.knowledgeBases})}),a.jsxs(r2,{label:i("blocks.createAgents.toolsLabel"),count:d,icon:a.jsx(Pnt,{"aria-hidden":"true"}),children:[a.jsx(J5,{label:i("blocks.createAgents.builtinTool"),resources:l.builtinTools}),a.jsx(MMt,{tools:l.pythonTools})]}),a.jsx(r2,{label:i("blocks.createAgents.subAgents"),count:l.subAgentCount,icon:a.jsx(Mnt,{"aria-hidden":"true"}),children:a.jsx(LMt,{agents:l.subAgents})})]})]},l.name)})}):n==="running"?a.jsx(_Me,{label:i("blocks.createAgents.creating")}):a.jsxs("div",{className:"create-agent-card__message",children:[a.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.noAgents")}),a.jsx("span",{children:i("blocks.createAgents.noAgentResult")})]})]})}const BMt={web_search:{name:"web_search",runningLabel:"Searching the web",doneLabel:"Web search complete",tone:"search",icon:Bte},link_reader:{name:"link_reader",runningLabel:"Reading webpage",doneLabel:"Webpage read complete",tone:"search",icon:Bte},run_code:{name:"run_code",runningLabel:"Running code in the AgentKit sandbox",doneLabel:"Code execution completed in the AgentKit sandbox",tone:"sandbox",icon:jDt},list_envs:{name:"list_envs",runningLabel:"Checking available environments",doneLabel:"Available environments loaded",tone:"resources",icon:RDt},get_env_manifest:{name:"get_env_manifest",runningLabel:"Loading the environment manifest",doneLabel:"Environment manifest loaded",tone:"knowledge",icon:IDt},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"Running a command in the environment",doneLabel:"Command completed in the environment",tone:"sandbox",icon:Qte},delegate_to_codex_sandbox:{name:"delegate_to_codex_sandbox",runningLabel:"Codex Sandbox is running",doneLabel:"Codex Sandbox completed",failedLabel:"Codex Sandbox failed",tone:"sandbox",icon:Qte},image_generate:{name:"image_generate",runningLabel:"Generating image",doneLabel:"Image generated",tone:"image",icon:EDt},video_generate:{name:"video_generate",runningLabel:"Generating video",doneLabel:"Video generated",tone:"video",icon:aV},ppt_generate:{name:"ppt_generate",runningLabel:"Generating presentation",doneLabel:"Presentation generated",tone:"presentation",icon:CDt},load_memory:{name:"load_memory",runningLabel:"Searching long-term memory",doneLabel:"Memory search complete",tone:"memory",icon:TDt},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"Searching the knowledge base",doneLabel:"Knowledge base search complete",tone:"knowledge",icon:ADt},load_skill:{name:"load_skill",runningLabel:"Loading skill",doneLabel:"Skill loaded",tone:"skill",icon:_Dt},collect_resources:{name:"collect_resources",runningLabel:"Collecting available resources",doneLabel:"Resource collection complete",failedLabel:"Resource collection failed",tone:"resources",icon:NDt,detailRenderer:$Mt},create_agents:{name:"create_agents",runningLabel:"Creating and running agents",doneLabel:"Agent creation complete",failedLabel:"Agent creation failed",tone:"agent",icon:Ute,detailRenderer:FMt},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:Ute,detailRenderer:nMt,hideHeader:!0}};function UMt(e){return BMt[e]}function QMt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),a.jsx("path",{d:"M14 3v5h5"}),a.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function zMt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M12 3 19 6v5c0 4.6-2.8 7.8-7 10-4.2-2.2-7-5.4-7-10V6l7-3Z"}),a.jsx("path",{d:"m9 12 2 2 4-4"})]})}function VMt(e,t){const n=new Map(e.map(o=>[o.path,o.content])),i=new Map(t.map(o=>[o.path,o.content])),r=new Set([...n.keys(),...i.keys()]),s=[];for(const o of[...r].sort((l,c)=>l.localeCompare(c))){const l=n.get(o),c=i.get(o);l!==c&&s.push({path:o,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function Mg(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function jMe(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function e3(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function HMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function qMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m9 5 7 7-7 7"})})}function tD(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function WMt(e){return a.jsxs("svg",{...Mg(e),children:[a.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),a.jsx("path",{d:"M12 2.75v2M12 19.25v2M2.75 12h2M19.25 12h2M5.45 5.45l1.4 1.4M17.15 17.15l1.4 1.4M18.55 5.45l-1.4 1.4M6.85 17.15l-1.4 1.4"})]})}function KMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function NMe(e){return a.jsxs("svg",{...Mg(e),children:[a.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),a.jsx("path",{d:"M19.25 4.5H15.5"})]})}const GMt=p.lazy(()=>Vu(()=>Promise.resolve().then(()=>a6e),void 0)),XMt=p.lazy(()=>Vu(()=>import("../chunks/CodeDiffEditor-CO8KgfCW.js"),[])),RMe="veadk-code-workspace-theme";function YMt(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let r=t;i.forEach((s,o)=>{let l=r.children.get(s);l||(l={name:s,children:new Map},r.children.set(s,l)),o===i.length-1&&(l.path=n.path),r=l})}return t}function ZMt(e,t=!1){return[...e.children.values()].sort((n,i)=>{const r=n.children.size>0&&n.path===void 0,s=i.children.size>0&&i.path===void 0;return r!==s?t?r?1:-1:r?-1:1:n.name.localeCompare(i.name)})}function JMt(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(RMe)==="dark"?"dark":"light"}catch{return"light"}}function eLt(e){return e===""?0:e.split(` -`).length}function dw({project:e,open:t,onClose:n,onChange:i,readOnly:r=!1,comparison:s}){var N;const{t:o}=Ae("workspaceTools"),l=p.useId(),c=p.useRef(null),u=p.useRef(null),d=p.useRef(n),[f,h]=p.useState(JMt),m=p.useMemo(()=>s?VMt(s.baseProject.files,e.files):[],[s,e.files]),g=p.useMemo(()=>s?m.map(A=>({path:A.path,content:A.status==="deleted"?A.before:A.after})):e.files,[m,s,e.files]),b=p.useMemo(()=>new Map(m.map(A=>[A.path,A.status])),[m]),[v,y]=p.useState(((N=g[0])==null?void 0:N.path)??null),[x,w]=p.useState(new Set),O=p.useMemo(()=>YMt(g),[g]),S=g.find(A=>A.path===v)??null,k=m.find(A=>A.path===v)??null;if(d.current=n,p.useEffect(()=>{try{window.localStorage.setItem(RMe,f)}catch{}},[f]),p.useEffect(()=>{var M;if(!t)return;const A=document.body.style.overflow,P=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(M=u.current)==null||M.focus();const D=L=>{if(L.key==="Escape"){L.preventDefault(),d.current();return}if(L.key!=="Tab"||!c.current)return;const U=[...c.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(K=>K.offsetParent!==null);if(U.length===0)return;const I=U[0],H=U[U.length-1];L.shiftKey&&document.activeElement===I?(L.preventDefault(),H.focus()):!L.shiftKey&&document.activeElement===H&&(L.preventDefault(),I.focus())};return window.addEventListener("keydown",D),()=>{document.body.style.overflow=A,window.removeEventListener("keydown",D),P!=null&&P.isConnected&&P.focus()}},[t]),p.useEffect(()=>{S||g.length===0||y(g[0].path)},[g,S]),!t)return null;function C(A){w(P=>{const D=new Set(P);return D.has(A)?D.delete(A):D.add(A),D})}function E(A){return A?a.jsx("span",{className:`code-browser-change is-${A}`,children:o(`codeBrowser.change.${A}`)}):null}function R(A,P,D){return ZMt(A,P===0).map(M=>{const L=D?`${D}/${M.name}`:M.name;if(!(M.children.size>0&&M.path===void 0)&&M.path){const H=b.get(M.path);return a.jsxs("button",{type:"button",className:`code-browser-file${v===M.path?" is-active":""}`,style:{paddingLeft:`${12+P*16}px`},onClick:()=>y(M.path??null),title:M.path,"aria-pressed":v===M.path,children:[a.jsx(e3,{}),a.jsx("span",{children:M.name}),E(H)]},L)}const I=x.has(L);return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+P*16}px`},onClick:()=>C(L),"aria-expanded":!I,children:[a.jsx(qMt,{className:I?"":"is-open"}),a.jsx(HMt,{}),a.jsx("span",{children:M.name})]}),!I&&R(M,P+1,L)]},L)})}function _(A){!S||s||i({...e,files:e.files.map(P=>P.path===S.path?{...P,content:A}:P)})}const j=f==="light"?"dark":"light",T=o(s?"codeBrowser.noChanges":"codeBrowser.chooseFile");return ri.createPortal(a.jsx("div",{className:"code-browser-backdrop",onMouseDown:A=>{A.target===A.currentTarget&&n()},children:a.jsxs("section",{ref:c,className:`code-browser-dialog is-${f}`,role:"dialog","aria-modal":"true","aria-labelledby":l,children:[a.jsxs("header",{className:"code-browser-head",children:[a.jsxs("div",{className:"code-browser-title-wrap",children:[a.jsx("span",{className:"code-browser-title-icon",children:a.jsx(jMe,{})}),a.jsxs("div",{children:[a.jsx("h2",{id:l,children:o(s?"codeBrowser.compareTitle":"codeBrowser.workspaceTitle")}),a.jsx("p",{title:e.name,children:e.name||o("codeBrowser.projectFallback")})]})]}),a.jsxs("div",{className:"code-browser-head-actions",children:[a.jsx("button",{type:"button",className:"code-browser-icon-button",onClick:()=>h(j),"aria-label":o("codeBrowser.switchTheme"),title:o("codeBrowser.switchThemeTitle",{theme:o(`codeBrowser.themes.${j}`)}),children:f==="light"?a.jsx(KMt,{}):a.jsx(WMt,{})}),a.jsx("button",{ref:u,type:"button",className:"code-browser-icon-button",onClick:n,"aria-label":o("codeBrowser.closeWorkspace"),title:o("codeBrowser.close"),children:a.jsx(tD,{})})]})]}),a.jsxs("div",{className:"code-browser-workspace",children:[a.jsxs("aside",{className:"code-browser-sidebar","aria-label":o(s?"codeBrowser.changedFiles":"codeBrowser.projectFiles"),children:[a.jsxs("div",{className:"code-browser-sidebar-head",children:[a.jsx("span",{children:o(s?"codeBrowser.changes":"codeBrowser.files")}),a.jsx("span",{children:g.length})]}),a.jsx("div",{className:"code-browser-tree",children:g.length>0?R(O,0,""):a.jsx("div",{className:"code-browser-empty",children:T})})]}),a.jsxs("main",{className:"code-browser-main",children:[a.jsx("div",{className:"code-browser-tabs",role:"tablist","aria-label":o("codeBrowser.openFiles"),children:S?a.jsxs("div",{className:"code-browser-tab",role:"tab","aria-selected":"true",children:[a.jsx(e3,{}),a.jsx("span",{children:S.path.split("/").pop()}),E(k==null?void 0:k.status)]}):null}),a.jsxs("div",{className:"code-browser-path",children:[a.jsx(e3,{}),a.jsx("span",{children:(S==null?void 0:S.path)??o("codeBrowser.noFileSelected")})]}),s?a.jsxs("div",{className:"code-browser-diff-labels","aria-label":o("codeBrowser.comparisonDirection"),children:[a.jsx("span",{children:s.baseLabel??o("codeBrowser.before")}),a.jsx("span",{children:s.targetLabel??o("codeBrowser.after")})]}):null,a.jsx("div",{className:"code-browser-editor",children:S?a.jsx(p.Suspense,{fallback:a.jsx("div",{className:"code-browser-empty",children:o("codeBrowser.loadingEditor")}),children:k?a.jsx(XMt,{before:k.before,after:k.after,path:k.path,theme:f}):a.jsx(GMt,{value:S.content,path:S.path,onChange:_,readOnly:r,theme:f})}):a.jsx("div",{className:"code-browser-empty",children:T})}),a.jsxs("footer",{className:"code-browser-statusbar",children:[a.jsx("span",{children:s?o("codeBrowser.changedFileCount",{count:m.length}):o("codeBrowser.fileCount",{count:e.files.length})}),a.jsx("span",{children:S?o("codeBrowser.lineCount",{count:eLt(S.content)}):"UTF-8"})]})]})]})]})}),document.body)}function tLt({project:e,onChange:t,className:n="",label:i}){const{t:r}=Ae("workspaceTools"),[s,o]=p.useState(!1),l=i??r("codeBrowser.viewSource");return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>o(!0),"aria-label":r("codeBrowser.viewSourceAria"),title:l,children:[a.jsx(jMe,{}),a.jsx("span",{children:l})]}),a.jsx(dw,{project:e,open:s,onClose:()=>o(!1),onChange:t})]})}const IMe="send_a2ui_json_to_client",nLt=28,iLt=3e3;function rLt(e,t,n){let i=t;for(let r=0;r65535?2:1}return i}function sLt(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function PMe(e,t,n,i){const[r,s]=p.useState(()=>t?"":e),o=p.useRef(r),l=p.useRef(e),c=p.useRef(null),u=p.useRef(0),d=p.useRef(n);return l.current=e,d.current=n,p.useEffect(()=>{const f=o.current,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||h||!e.startsWith(f)){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=null,f!==e&&(o.current=e,s(e));return}if(f===e||c.current!==null)return;const m=g=>{const b=l.current,v=o.current;if(!b.startsWith(v)){o.current=b,s(b),c.current=null;return}if(g-u.current{var f;(f=d.current)==null||f.call(d)},[r]),p.useEffect(()=>{r===e&&(i==null||i())},[r,i,e]),p.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),r}function oLt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function aLt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"m4.5 7 1.8 1.8L9.5 5.5"}),a.jsx("path",{d:"M12 7h7.5"}),a.jsx("path",{d:"m4.5 13 1.8 1.8 3.2-3.3"}),a.jsx("path",{d:"M12 13h7.5"}),a.jsx("path",{d:"M5 19h4"}),a.jsx("path",{d:"M12 19h7.5"})]})}function lLt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 5v7.25A3.75 3.75 0 0 0 8.75 16H19"}),a.jsx("path",{d:"m15.5 12.5 3.5 3.5-3.5 3.5"})]})}function cLt({activity:e}){const{t}=Ae("conversation"),n=[["Agent Session",e.agentSessionId],["Sandbox Session",e.sandboxSessionId],["Codex Thread",e.threadId]].filter(i=>!!i[1]);return n.length?a.jsx("dl",{className:"codex-sandbox-run__identity","aria-label":t("blocks.sandboxIdentity"),children:n.map(([i,r])=>a.jsxs("div",{children:[a.jsx("dt",{children:i}),a.jsx("dd",{title:r,children:r})]},i))}):null}function uLt(e,t,n){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const i=t.skill_name;if(!(typeof i!="string"||!i.trim()))return n("blocks.useSkill",{name:i.trim()})}function DMe({text:e,done:t,answerStarted:n=!1,streaming:i=!1,onStreamFrame:r}){const{t:s}=Ae("conversation"),[o,l]=p.useState(!(t||n)),c=p.useRef(!1);p.useEffect(()=>{c.current||l(!(t||n))},[n,t]);const u=()=>{c.current=!0,l(g=>!g)},d=e.replace(/\r\n?/g,` +`+v+"]"}return r.pop(),s=v,x}};const nIt={parse:GRt,stringify:tIt};var DDe=nIt;const iIt=2e5,rIt=new Set(["__proto__","constructor","prototype"]),sIt=/^(?:https?:|data:|blob:|file:|javascript:|image:\/\/)/i;function JO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ZN(e,t=0){if(t>30)throw new Error("ECharts option nesting is too deep");if(typeof e=="number"&&!Number.isFinite(e))throw new Error("ECharts option contains a non-finite number");if(typeof e=="string"&&sIt.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)ZN(n,t+1);return}if(JO(e))for(const[n,i]of Object.entries(e)){if(rIt.has(n))throw new Error("ECharts option contains an unsafe key");ZN(i,t+1)}}function oIt(e){var i;const t=e.trim(),n=t.match(/^(?:(?:const|let|var)\s+)?option\s*=\s*([\s\S]*?)\s*;?$/);return((i=n==null?void 0:n[1])==null?void 0:i.trim())||t}function aIt(e,t){let n=1,i="",r=!1,s=!1,o=!1;for(let l=t+1;li+2)throw new Error("Invalid ECharts gradient argument count");const r=n.slice(0,i).map(lIt),s=n[i],o=n[i+1]??!1;if(!Array.isArray(s)||typeof o!="boolean")throw new Error("Invalid ECharts gradient data");return e==="linear"?{type:e,x:r[0],y:r[1],x2:r[2],y2:r[3],colorStops:s,global:o}:{type:e,x:r[0],y:r[1],r:r[2],colorStops:s,global:o}}function uIt(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let i="",r=!1,s=!1,o=!1;for(let l=t;liIt)throw new Error("ECharts option is too large");const n=dIt(oIt(e));let i;try{i=DDe.parse(n)}catch(o){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):o}if(!JO(i))throw new Error("ECharts option must be a data object");ZN(i);const r={...i};r.aria={...JO(r.aria)?r.aria:{},enabled:!0};const s=r.tooltip;return JO(s)?r.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(r.tooltip=s.map(o=>JO(o)?{...o,renderMode:"richText"}:o)),t&&(r.animation=!1),r}let G5;function hIt(){return G5??(G5=Vu(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw G5=void 0,e})),G5}function pIt({source:e}){const{t}=Ae("conversation"),n=p.useRef(null),[i,r]=p.useState(!1),[s,o]=p.useState("");return p.useEffect(()=>{let l=!1,c,u,d;r(!1);try{d=fIt(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),o("")}catch{o("invalid");return}return hIt().then(f=>{const h=n.current;l||!h||(c=f.init(h,void 0,{renderer:"svg"}),c.setOption(d,{notMerge:!0}),typeof ResizeObserver<"u"&&(u=new ResizeObserver(()=>c==null?void 0:c.resize()),u.observe(h)),r(!0))}).catch(()=>{c==null||c.dispose(),c=void 0,l||o("render")}),()=>{l=!0,u==null||u.disconnect(),c==null||c.dispose()}},[e]),a.jsxs("div",{className:`echarts-diagram${s?" echarts-diagram--error":""}`,role:"img","aria-label":t("visualization.echartsAria"),"aria-busy":!i&&!s,children:[a.jsx("div",{ref:n,className:"echarts-diagram__canvas",hidden:!!s}),!i&&!s?a.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:a.jsx(yn,{duration:2.2,spread:15,children:t("visualization.rendering")})}):null,s?a.jsx("p",{className:"echarts-diagram__error",role:"alert",children:t(s==="invalid"?"visualization.invalidEcharts":"visualization.renderFailed")}):null]})}const mIt=p.memo(pIt);let Nte,Rte=Promise.resolve(),gIt=0;function bIt(){return Nte??(Nte=Vu(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-IM_oNPTV.js").then(t=>t.ay);return{default:e}},__vite__mapDeps([0,1])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),Nte}function yIt(e){const t=Rte.then(async()=>{const n=await bIt(),i=`mermaid-diagram-${gIt+=1}`;return n.render(i,e)});return Rte=t.then(()=>{},()=>{}),t}function vIt({source:e}){const{t}=Ae("conversation"),n=p.useRef(null),[i,r]=p.useState(null),[s,o]=p.useState(!1);return p.useEffect(()=>{let l=!1;return r(null),o(!1),yIt(e).then(c=>{l||r(c)}).catch(()=>{l||o(!0)}),()=>{l=!0}},[e]),p.useEffect(()=>{!(i!=null&&i.bindFunctions)||!n.current||i.bindFunctions(n.current)},[i]),s?a.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:a.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:t("visualization.mermaidFailed")})}):i?a.jsx("div",{ref:n,className:"mermaid-diagram",role:"img","aria-label":t("visualization.mermaidAria"),dangerouslySetInnerHTML:{__html:i.svg}}):a.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:a.jsx(yn,{duration:2.2,spread:15,children:t("visualization.rendering")})})}const xIt=p.memo(vIt),wIt="_SegmentedControl_1sl7d_1",OIt="_SegmentedControlOption_1sl7d_140",kIt="_SegmentedControlThumb_1sl7d_219",g8={SegmentedControl:wIt,SegmentedControlOption:OIt,SegmentedControlThumb:kIt},ju=({value:e,onChange:t,children:n,block:i,pill:r=!0,size:s="md",gutterSize:o,className:l,onClick:c,...u})=>{const d=p.useRef(null),f=p.useRef(null),h=p.useCallback(g=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let w=Math.floor(y.clientWidth);const O=y.offsetLeft;if(x-(w+O)<2&&(w=w-1),v.style.width=`${Math.floor(w)}px`,v.style.transform=`translateX(${O}px)`,b.scrollWidth>x){const S=x*.15,k=b.scrollLeft,C=y.offsetLeft,E=C+w;(Ck+x-S)&&g&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);QAe({ref:d,onResize:()=>{const g=f.current;if(!g)return;const b=g.style.transition;g.style.transition="",h(!1),g.style.transition=b}}),p.useLayoutEffect(()=>{const g=d.current,b=f.current;!g||!b||(h(!!b.style.transition),b.style.transition||xN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,o,r]);const m=g=>{g&&t&&t(g)};return a.jsxs(Plt,{ref:d,className:Ti(g8.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:m,onClick:c,"data-block":i?"":void 0,"data-pill":r?"":void 0,"data-size":s,"data-gutter-size":o,...u,children:[a.jsx("div",{className:g8.SegmentedControlThumb,ref:f}),n]})},SIt=({children:e,...t})=>a.jsx(Flt,{className:g8.SegmentedControlOption,...t,onPointerEnter:sQ,children:a.jsx("span",{className:"relative",children:e})});ju.Option=SIt;function EIt({children:e,label:t,language:n,source:i,streaming:r=!1}){const{t:s}=Ae("conversation"),[o,l]=p.useState("preview"),c=r?"code":o;return a.jsxs("section",{className:"visualization-card","aria-label":s("visualization.cardAria",{label:t}),children:[a.jsx("div",{className:"visualization-card__toolbar",children:a.jsxs(ju,{className:"visualization-card__tabs",value:c,size:"sm",gutterSize:"sm",pill:!1,"aria-label":s("visualization.viewAria",{label:t}),onChange:u=>{r||l(u)},children:[a.jsx(ju.Option,{value:"preview",disabled:r,children:s("visualization.preview")}),a.jsx(ju.Option,{value:"code",children:s("visualization.code")})]})}),a.jsx("div",{className:"visualization-card__body",children:c==="code"?a.jsx("pre",{className:"visualization-card__code",children:a.jsx("code",{className:`language-${n}`,children:i})}):e})]})}const CIt=p.memo(EIt);function TIt(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const MDe=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function b8(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(b8).join(""):p.isValidElement(e)?b8(e.props.children):""}function AIt(e){var i;const t=p.Children.toArray(e)[0];if(!p.isValidElement(t))return;const n=(i=t.props.className)==null?void 0:i.split(/\s+/).find(r=>r.startsWith("language-"));return TIt(n==null?void 0:n.slice(9))}function LDe(e){if(!e)return!1;try{const t=e.toLowerCase();return MDe.some(n=>t.includes(n))}catch{return!1}}function _It(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.href;if(!t)return!1;if(LDe(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const r=n.map(s=>(s==null?void 0:s.value)||"").join("").toLowerCase();return MDe.some(s=>r.includes(s))}return!1}function jIt({text:e,className:t,allowRawHtml:n=!0,streaming:i=!1}){const{t:r}=Ae("conversation"),[s,o]=p.useState(null),l=(d,f)=>{if(d.src)return d.src;if(f){const h=g=>{var b;if(!g)return null;if(g.type==="source"&&((b=g.properties)!=null&&b.src))return g.properties.src;if(g.children)for(const v of g.children){const y=h(v);if(y)return y}return null},m=h({children:f});if(m)return m}return""},c=d=>{try{const h=new URL(d).pathname.split("/");return h[h.length-1]||"video.mp4"}catch{return"video.mp4"}},u=d=>d?Array.isArray(d)?d.map(f=>(f==null?void 0:f.value)||"").join("")||"video":(d==null?void 0:d.value)||"video":"video";return a.jsxs("div",{className:t?`md ${t}`:"md",children:[a.jsx(KEt,{remarkPlugins:[aAt],rehypePlugins:n?[zRt,dte]:[dte],components:{pre:({node:d,children:f,...h})=>{const m=AIt(f);if(m==="mermaid"||m==="echarts"){const g=b8(f).replace(/\n$/,"");return a.jsx(CIt,{label:m==="mermaid"?"Mermaid":"ECharts",language:m,source:g,streaming:i,children:m==="mermaid"?a.jsx(xIt,{source:g}):a.jsx(mIt,{source:g})})}return a.jsx("pre",{...h,children:f})},a:({node:d,...f})=>{const h=f.href;if(h&&(LDe(h)||_It(d))){const m=h,g=u(d==null?void 0:d.children);return a.jsxs("div",{className:"video-container",children:[a.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.playVideo",{name:g}),onClick:()=>o({src:m,title:g}),children:[a.jsx("video",{src:m,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),a.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]}),a.jsx("div",{className:"video-caption",children:a.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:g})})]})}return a.jsx("a",{...f,target:"_blank",rel:"noopener noreferrer"})},img:({node:d,src:f,alt:h,...m})=>{const g=a.jsx("img",{...m,src:f,alt:h??"",loading:"lazy"});return f?a.jsx(BSe,{src:f,children:a.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":r("markdown.enlargeImage",{name:h||r("markdown.image")}),children:[g,a.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]})}):g},video:({node:d,src:f,children:h,...m})=>{const g=l({src:f},h);return g?a.jsx("div",{className:"video-container",children:a.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":r("markdown.enlargeVideo"),onClick:()=>o({src:g}),children:[a.jsx("video",{src:g,...m,playsInline:!0,className:"video-thumbnail",children:h}),a.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:a.jsx(nx,{})})]})}):a.jsx("video",{src:f,controls:!0,playsInline:!0,className:"video-inline",...m,children:h})}},children:e}),s&&a.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":r("markdown.videoPreview"),onClick:()=>o(null),children:a.jsxs("div",{className:"video-viewer",onClick:d=>d.stopPropagation(),children:[a.jsxs("div",{className:"video-viewer-header",children:[a.jsx("div",{className:"video-viewer-title",children:s.title||c(s.src)}),a.jsxs("nav",{className:"video-viewer-nav",children:[a.jsx("a",{href:s.src,download:s.title||c(s.src),"aria-label":r("markdown.downloadVideo"),title:r("markdown.downloadVideo"),className:"video-viewer-download",children:a.jsx(eP,{})}),a.jsx("button",{type:"button",className:"video-viewer-close","aria-label":r("markdown.close"),onClick:()=>o(null),children:a.jsx(xa,{})})]})]}),a.jsx("div",{className:"video-viewer-body",children:a.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Yu=p.memo(jIt);function X5(e){return(e==null?void 0:e.trim())||Ig("resourceMetadata.unknownSource")}function $De(e){return(e==null?void 0:e.trim())||Ig("resourceMetadata.unknownCreator")}function NIt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5 5.5A2.5 2.5 0 0 1 7.5 3H19v16H7.5A2.5 2.5 0 0 0 5 21.5v-16Z"}),a.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),a.jsx("path",{d:"M9 7h6M9 10h4"})]})}function RIt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),a.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function IIt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function PIt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 5v14M5 12h14"})})}function KC({title:e,children:t,onClose:n,busy:i=!1,className:r=""}){const{t:s}=Ae("ui"),o=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(i),d=p.useRef(n);return p.useEffect(()=>{u.current=i,d.current=n},[i,n]),p.useEffect(()=>{var g;const f=document.activeElement instanceof HTMLElement?document.activeElement:null,h=document.body.style.overflow;document.body.style.overflow="hidden",(g=l.current)==null||g.focus();const m=b=>{if(b.key==="Escape"&&!u.current){d.current();return}if(b.key!=="Tab")return;const v=c.current;if(!v)return;const y=Array.from(v.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], audio[controls], video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(O=>O.getClientRects().length>0);if(y.length===0){b.preventDefault();return}const x=y[0],w=y[y.length-1];b.shiftKey&&(document.activeElement===x||!v.contains(document.activeElement))?(b.preventDefault(),w.focus()):!b.shiftKey&&(document.activeElement===w||!v.contains(document.activeElement))&&(b.preventDefault(),x.focus())};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),document.body.style.overflow=h,f!=null&&f.isConnected&&f.focus()}},[]),ri.createPortal(a.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&!i&&n()},children:a.jsxs("section",{ref:c,className:`knowledge-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":o,"aria-busy":i||void 0,children:[a.jsxs("header",{className:"knowledge-dialog__header",children:[a.jsx("h2",{id:o,children:e}),a.jsx("button",{ref:l,type:"button",onClick:n,disabled:i,"aria-label":s("common.close"),children:a.jsx(IIt,{})})]}),t]})}),document.body)}function fE({message:e}){return e?a.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function y8(e){return e instanceof DOMException&&e.name==="AbortError"}function DIt(e,t){if(!e)return"";const n=Date.parse(e);return Number.isFinite(n)?new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(n):e}const FDe=[".jpg",".jpeg",".png"].join(","),MIt=new Set(FDe.split(",")),BDe=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),LIt=new Set(BDe.split(",")),$It=200*1024*1024;function v8(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function FIt(e,t,n){return e.size>$It?n("knowledge.errors.fileTooLarge"):t==="image"?MIt.has(v8(e.name))?"":n("knowledge.errors.invalidImageType"):LIt.has(v8(e.name))?"":n("knowledge.errors.invalidDocumentType")}function rV(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function x8(e){var r;const t=e.type.trim().replace(/^\./,"");if(t)return t.toUpperCase();const n=e.name.trim(),i=n.includes(".")?(r=n.split(".").pop())==null?void 0:r.trim():"";return i?i.toUpperCase():"-"}function BIt({region:e,onClose:t,onCreated:n}){const{t:i}=Ae("ui"),[r,s]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(""),g=r.trim(),b=!!(g&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(g)),v=async y=>{if(y.preventDefault(),u(!0),!g||b)return;f(!0),m("");const x={name:g,description:o.trim()||void 0,region:e};try{n(await l1t(x))}catch(w){m(el(w,i("knowledge.errors.createBase")))}finally{f(!1)}};return a.jsx(KC,{title:i("knowledge.createBase"),onClose:t,busy:d,children:a.jsxs("form",{onSubmit:y=>void v(y),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:i("common.name")}),a.jsx("input",{autoFocus:!0,value:r,maxLength:48,"aria-invalid":c&&b||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>u(!0),onChange:y=>s(y.target.value)})]}),a.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${c&&b?" is-error":""}`,role:c&&b?"alert":void 0,children:i(c&&b?"knowledge.invalidName":"knowledge.nameHelp")}),a.jsxs("label",{children:[a.jsx("span",{children:i("knowledge.optionalDescription")}),a.jsx("textarea",{value:o,maxLength:80,onChange:y=>l(y.target.value)})]}),a.jsx(fE,{message:h})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:d,children:i("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:d||!g||b,children:i(d?"common.creating":"common.create")})]})]})})}function UIt({item:e,onClose:t,onUpdated:n}){const{t:i}=Ae("ui"),[r,s]=p.useState(e.description),[o,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault(),l(!0),u("");try{n(await c1t(e.id,e.region,{description:r.trim()}))}catch(h){u(el(h,i("knowledge.errors.updateBase")))}finally{l(!1)}};return a.jsx(KC,{title:i("knowledge.editBase"),onClose:t,busy:o,children:a.jsxs("form",{onSubmit:f=>void d(f),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:i("common.name")}),a.jsx("input",{value:e.name,disabled:!0})]}),a.jsxs("label",{children:[a.jsx("span",{children:i("common.description")}),a.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:f=>s(f.target.value)})]}),a.jsx("p",{className:"knowledge-dialog__note",children:i("knowledge.descriptionOnly")}),a.jsx(fE,{message:c})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:o,children:i("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:o,children:i(o?"common.saving":"common.save")})]})]})})}function UDe(e,t){if(!e.trim())return{};const n=JSON.parse(e);if(!n||Array.isArray(n)||typeof n!="object")throw new Error(t);return n}function QIt({base:e,onClose:t,onCreated:n,onAssociationInvalid:i}){const{t:r}=Ae("ui"),[s,o]=p.useState("document"),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(""),[m,g]=p.useState(null),[b,v]=p.useState(!1),[y,x]=p.useState("{}"),[w,O]=p.useState(""),[S,k]=p.useState(""),[C,E]=p.useState(null),R=p.useRef(null),_=p.useRef(null),j=p.useRef(null),T=p.useRef(0),N=!!w;p.useEffect(()=>{var L;C&&!N&&((L=j.current)==null||L.focus())},[N,C]);const A=L=>{N||L===s||(o(L),g(null),h(""),c(""),d(""),k(""),E(null),v(!1),T.current=0,R.current&&(R.current.value=""))},P=L=>{if(!L||s==="web")return;const U=FIt(L,s,r);if(U){g(null),c(""),d(""),k(U);return}g(L),k(""),c(L.name.replace(/\.[^.]+$/,"")),d(v8(L.name).slice(1))},D=async L=>{if(L.preventDefault(),s==="web"?!f.trim():!m)return;let U;try{U=UDe(y,r("knowledge.errors.metadataObject"))}catch(I){k(el(I,r("knowledge.errors.metadataFormat")));return}O(s==="web"?C?"save":"preview":"upload"),k("");try{if(s==="web")if(C){const I={sourceType:"url",metadata:C.metadata,url:C.preview.url,sourceTitle:C.preview.name,sourceMarkdown:C.preview.sourceMarkdown};await h1t(e.id,e.region,I),n()}else{const I=await p1t(e.id,e.region,{url:f.trim()});if(!I.sourceMarkdown.trim())throw new Error(r("knowledge.errors.noWebPreview"));E({preview:I,metadata:U})}else m&&(await m1t(e.id,e.region,{file:m,name:l.trim()||void 0,documentType:u.trim()||void 0,metadata:U}),n())}catch(I){I instanceof IP&&I.errorCode===eIe?i(I):k(el(I,r(s==="web"?C?"knowledge.errors.addWeb":"knowledge.errors.previewWeb":"knowledge.errors.uploadFile")))}finally{O("")}},M=()=>{N||(E(null),k(""),requestAnimationFrame(()=>{var L;return(L=_.current)==null?void 0:L.focus()}))};return a.jsx(KC,{title:r(C?"knowledge.previewWeb":"knowledge.addData"),onClose:t,busy:N,className:C?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:a.jsx("form",{onSubmit:L=>void D(L),children:C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[a.jsxs("div",{className:"knowledge-preview__meta",children:[a.jsx("strong",{title:C.preview.name,children:C.preview.name}),a.jsx("a",{href:C.preview.url,target:"_blank",rel:"noopener noreferrer",children:r("knowledge.openOriginalWeb")})]}),a.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:a.jsx("div",{className:"knowledge-preview__markdown-shell",children:a.jsx(Yu,{text:C.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),S?a.jsx("div",{className:"knowledge-web-preview__error",children:a.jsx(fE,{message:S})}):null]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",className:"is-back",onClick:M,disabled:N,children:r("knowledge.backToEdit")}),a.jsx("button",{type:"button",onClick:t,disabled:N,children:r("common.cancel")}),a.jsx("button",{ref:j,type:"submit",className:"is-primary",disabled:N,children:r(w==="save"?"common.adding":"knowledge.confirmAdd")})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsx("div",{className:"knowledge-source-tabs",role:"tablist","aria-label":r("knowledge.source"),children:[["image",r("knowledge.image")],["document",r("knowledge.documentFile")],["web",r("knowledge.webPage")]].map(([L,U])=>a.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${L}-tab`,"aria-controls":`knowledge-source-${L}-panel`,"aria-selected":s===L,tabIndex:s===L?0:-1,className:s===L?"is-active":"",disabled:N,onClick:()=>A(L),onKeyDown:I=>{const H=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(I.key))return;I.preventDefault();const K=H.indexOf(L),F=I.key==="Home"?H[0]:I.key==="End"?H[H.length-1]:H[(K+(I.key==="ArrowRight"?1:-1)+H.length)%H.length];A(F),requestAnimationFrame(()=>{var W;return(W=document.getElementById(`knowledge-source-${F}-tab`))==null?void 0:W.focus()})},children:U},L))}),a.jsx("div",{id:`knowledge-source-${s}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${s}-tab`,children:s==="web"?a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.webUrl")}),a.jsx("input",{ref:_,autoFocus:!0,type:"url",value:f,disabled:N,onChange:L=>{h(L.target.value),k("")},placeholder:"https://example.com/article"})]}),a.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:w==="preview"?a.jsx(yn,{children:r("knowledge.generatingWebPreview")}):null})]}):a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:R,className:"knowledge-upload-input",type:"file","aria-label":r("knowledge.selectFile"),accept:s==="image"?FDe:BDe,disabled:N,onChange:L=>{var U;P(((U=L.currentTarget.files)==null?void 0:U[0])??null),L.currentTarget.value=""}}),a.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${m?" is-ready":""}`,disabled:N,onClick:()=>{var L;return(L=R.current)==null?void 0:L.click()},onDragEnter:L=>{L.preventDefault(),!N&&(T.current+=1,v(!0))},onDragOver:L=>{L.preventDefault(),N||(L.dataTransfer.dropEffect="copy")},onDragLeave:L=>{L.preventDefault(),T.current=Math.max(0,T.current-1),T.current===0&&v(!1)},onDrop:L=>{var U;L.preventDefault(),T.current=0,v(!1),N||P(((U=L.dataTransfer.files)==null?void 0:U[0])??null)},children:[a.jsx("strong",{children:m?m.name:r("knowledge.selectOrDropFile")}),a.jsx("span",{children:m?r("knowledge.selectedFile",{size:rV(m.size)}):r(s==="image"?"knowledge.imageFileHelp":"knowledge.documentFileHelp")})]}),a.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:N?a.jsx(yn,{children:r("knowledge.uploadingFile")}):null})]})}),s!=="web"?a.jsxs("div",{className:"knowledge-dialog__fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.optionalName")}),a.jsx("input",{value:l,disabled:N,maxLength:256,onChange:L=>c(L.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.optionalType")}),a.jsx("input",{value:u,disabled:N,maxLength:64,onChange:L=>d(L.target.value),placeholder:"pdf, docx, png"})]})]}):null,a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.metadataJson")}),a.jsx("textarea",{className:"is-code",value:y,disabled:N,onChange:L=>x(L.target.value),spellCheck:!1})]}),a.jsx(fE,{message:S})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:t,disabled:N,children:r("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:N||(s==="web"?!f.trim():!m),children:r(N?s==="web"?"common.generating":"common.uploading":s==="web"?"knowledge.generatePreview":"knowledge.uploadFile")})]})]})})})}function zIt({base:e,item:t,onClose:n,onUpdated:i}){const{t:r}=Ae("ui"),[s,o]=p.useState(()=>JSON.stringify(t.metadata??{},null,2)),[l,c]=p.useState(!1),[u,d]=p.useState(""),f=async h=>{h.preventDefault();let m;try{m=UDe(s,r("knowledge.errors.metadataObject"))}catch(g){d(el(g,r("knowledge.errors.metadataFormat")));return}c(!0),d("");try{i(await g1t(e.id,t.id,e.region,{metadata:m}))}catch(g){d(el(g,r("knowledge.errors.updateDocument")))}finally{c(!1)}};return a.jsx(KC,{title:r("knowledge.editMetadata"),onClose:n,busy:l,children:a.jsxs("form",{onSubmit:h=>void f(h),children:[a.jsxs("div",{className:"knowledge-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.knowledge")}),a.jsx("input",{value:t.name||t.id,disabled:!0})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("knowledge.metadataJson")}),a.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:s,onChange:h=>o(h.target.value),spellCheck:!1})]}),a.jsx(fE,{message:u})]}),a.jsxs("footer",{className:"knowledge-dialog__actions",children:[a.jsx("button",{type:"button",onClick:n,disabled:l,children:r("common.cancel")}),a.jsx("button",{type:"submit",className:"is-primary",disabled:l,children:r(l?"common.saving":"common.save")})]})]})})}const QDe=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),zDe=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),VDe=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),VIt=new Set(["pdf"]),HIt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),qIt=new Set(["creating","indexing","pending","processing","queued","submitted"]),WIt=new Set(["error","failed","unavailable"]);function Ite(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function n2(e){if(e==null||e==="")return"-";if(["string","number","boolean"].includes(typeof e))return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function KIt(e,t){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(Ite);if(r.some(s=>Object.keys(s).length>0)){const s=[...new Set(r.flatMap(o=>Object.keys(o)))];return{columns:s,rows:r.map(o=>s.map(l=>n2(o[l])))}}return{columns:[t("knowledge.value")],rows:e.map(s=>[n2(s)])}}const n=Ite(e),i=Object.entries(n);if(i.length===0)return null;if(i.every(([,r])=>Array.isArray(r))){const r=i.map(([o])=>o),s=Math.max(...i.map(([,o])=>o.length));return{columns:r,rows:Array.from({length:s},(o,l)=>i.map(([,c])=>n2(c[l])))}}return{columns:[t("knowledge.field"),t("knowledge.value")],rows:i.map(([r,s])=>[r,n2(s)])}}function HDe(e){const t=e.trim();if(!t||t.startsWith("//"))return"";if(t.startsWith("/"))return t;try{const n=new URL(t);return["http:","https:"].includes(n.protocol)?n.href:""}catch{return""}}function GIt(e){const t=HDe(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function XIt(e){var r;const t=e.attachmentType.trim().toLocaleLowerCase();if(t==="image"||t==="doc-image"||t.startsWith("image/"))return"image";if(t==="audio"||t.startsWith("audio/"))return"audio";if(t==="video"||t.startsWith("video/"))return"video";if(t==="pdf"||t==="application/pdf")return"pdf";const n=e.attachmentUrl.split(/[?#]/,1)[0],i=n.includes(".")?((r=n.split(".").pop())==null?void 0:r.toLocaleLowerCase())??"":"";return QDe.has(i)?"image":zDe.has(i)?"audio":VDe.has(i)?"video":VIt.has(i)?"pdf":t||i?"file":"none"}function YIt(e,t){const n=e.status.trim().toLocaleLowerCase();if(qIt.has(n))return{title:t("knowledge.preview.processingTitle"),detail:t("knowledge.preview.processingDetail")};if(WIt.has(n))return{title:t("knowledge.preview.failedTitle"),detail:t("knowledge.preview.failedDetail")};const i=x8(e).toLocaleLowerCase();return i==="pdf"||HIt.has(i)?{title:t("knowledge.preview.noParsedTitle"),detail:t("knowledge.preview.noParsedDetail")}:QDe.has(i)||zDe.has(i)||VDe.has(i)?{title:t("knowledge.preview.noMediaTitle"),detail:t("knowledge.preview.noMediaDetail")}:{title:t("knowledge.preview.noDataTitle"),detail:t("knowledge.preview.noDataDetail")}}function ZIt({chunk:e}){const{t}=Ae("ui"),[n,i]=p.useState(!1),r=HDe(e.attachmentUrl),s=XIt(e);return!r||s==="none"?null:n?a.jsx("div",{className:"knowledge-preview__attachment-error",children:t("knowledge.preview.attachmentError")}):s==="image"?a.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||t("knowledge.preview.imageAlt"),loading:"lazy",onError:()=>i(!0)}):s==="audio"?a.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.audioUnsupported")}):s==="video"?a.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>i(!0),children:t("knowledge.preview.videoUnsupported")}):s==="pdf"?a.jsxs("div",{className:"knowledge-preview__pdf",children:[a.jsx("iframe",{src:r,title:e.title?t("knowledge.preview.namedPdf",{name:e.title}):t("knowledge.preview.pdf"),sandbox:"",referrerPolicy:"no-referrer",onError:()=>i(!0)}),a.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openPdf")})]}):a.jsxs("div",{className:"knowledge-preview__file-fallback",children:[a.jsx("p",{children:t("knowledge.preview.fileUnsupported")}),a.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:t("knowledge.preview.openOriginalFile")})]})}function JIt({base:e,item:t,onClose:n}){const{t:i}=Ae("ui"),[r,s]=p.useState([]),[o,l]=p.useState(t),[c,u]=p.useState(""),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(!1),[v,y]=p.useState(""),x=p.useRef(0),w=p.useRef(null),O=p.useCallback(async(E=0)=>{var j;(j=w.current)==null||j.abort();const R=new AbortController;w.current=R;const _=x.current+1;x.current=_,E>0?m(!0):f(!0),y(""),E===0&&(s([]),b(!1));try{const T=await f1t(e.id,t.id,{region:e.region,offset:E,signal:R.signal});if(x.current!==_)return;l(T.document.id?T.document:t),u(T.sourceMarkdown||T.document.sourceMarkdown),s(N=>E>0?[...N,...T.chunks]:T.chunks),b(T.hasMore)}catch(T){!y8(T)&&x.current===_&&y(el(T,i("knowledge.errors.loadPreview")))}finally{x.current===_&&(f(!1),m(!1))}},[e.id,e.region,t,i]);p.useEffect(()=>(O(),()=>{var E;(E=w.current)==null||E.abort(),x.current+=1}),[O]);const S=GIt(o.url||t.url),k=YIt(o,i),C=o.metadata._veadk_content_format==="markdown";return a.jsx(KC,{title:o.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:a.jsxs("div",{className:"knowledge-preview",children:[o.sizeBytes>0||S?a.jsxs("div",{className:"knowledge-preview__meta",children:[o.sizeBytes>0?a.jsx("span",{children:rV(o.sizeBytes)}):null,S?a.jsx("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:i("knowledge.openOriginalWeb")}):null]}):null,a.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:c?a.jsx("div",{className:"knowledge-preview__markdown-shell",children:a.jsx(Yu,{text:c,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):d?a.jsx("div",{className:"knowledge-preview__state",role:"status",children:a.jsx(yn,{as:"span",duration:2.4,children:i("knowledge.preview.loading")})}):v&&r.length===0?a.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[a.jsx("p",{children:v}),a.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.retry")})]}):r.length===0?a.jsxs("div",{className:"knowledge-preview__state",children:[a.jsx("p",{children:k.title}),a.jsx("span",{children:S?i("knowledge.preview.openOriginalHint"):k.detail}),a.jsx("button",{type:"button",onClick:()=>void O(),children:i("common.reload")})]}):a.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((E,R)=>{const _=KIt(E.tableFields,i),j=E.id||`${R}:${E.title}`;return a.jsxs("article",{className:"knowledge-preview__chunk",children:[a.jsx("header",{children:a.jsx("h3",{children:E.title||i("knowledge.preview.chunk",{index:R+1})})}),E.content?C?a.jsx(Yu,{text:E.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):a.jsx("p",{className:"knowledge-preview__content",children:E.content}):null,_?a.jsx("div",{className:"knowledge-preview__table-wrap",children:a.jsxs("table",{children:[a.jsx("thead",{children:a.jsx("tr",{children:_.columns.map((T,N)=>a.jsx("th",{scope:"col",children:T},`${T}:${N}`))})}),a.jsx("tbody",{children:_.rows.map((T,N)=>a.jsx("tr",{children:T.map((A,P)=>a.jsx("td",{children:A},P))},N))})]})}):null,a.jsx(ZIt,{chunk:E})]},j)}),v?a.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:v}):null,g?a.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:h,onClick:()=>void O(r.length),children:h?a.jsx(yn,{as:"span",duration:2.4,children:i("knowledge.preview.loadingMore")}):i("knowledge.preview.loadMore")}):null]})})]})})}function ePt({cloudProvider:e,region:t,active:n=!0,activationRevision:i=0,onDetailChange:r,toolbarLeading:s,toolbarFilters:o}){const{t:l,i18n:c}=Ae("ui"),[u,d]=p.useState([]),[f,h]=p.useState({}),[m,g]=p.useState([]),[b,v]=p.useState(""),[y,x]=p.useState("overview"),[w,O]=p.useState(""),[S,k]=p.useState(""),[C,E]=p.useState(!0),[R,_]=p.useState(!1),[j,T]=p.useState(""),[N,A]=p.useState([]),[P,D]=p.useState(!1),[M,L]=p.useState(""),[U,I]=p.useState(""),[H,K]=p.useState(""),[F,W]=p.useState(!1),[V,X]=p.useState(!1),[ie,Q]=p.useState(!1),[Z,ce]=p.useState(null),[Ee,Y]=p.useState(null),[G,te]=p.useState(null),[ye,Ne]=p.useState(null),[pe,me]=p.useState(null),[se,Se]=p.useState(!1),Le=p.useRef(0),be=p.useRef(0),Ve=p.useRef([]),ve=p.useRef(!1),Re=p.useRef(!1),ne=p.useRef(null),ge=p.useRef(null),Ce=p.useRef({}),ke=p.useRef(!1),Ke=p.useRef(null),it=p.useRef(null),ue=p.useRef(null),xe=p.useRef(null),Te=p.useMemo(()=>[t],[t]),qe=p.useCallback(He=>`${He.region}\0${He.id}`,[]),De=u.find(He=>qe(He)===b)??null,At=!!(De&&H===qe(De));p.useEffect(()=>{r==null||r(!!De)},[r,De]),p.useEffect(()=>{x("overview"),k("")},[b]);const It=p.useMemo(()=>{const He=w.trim().toLocaleLowerCase();return He?u.filter(Me=>[Me.name,Me.description,Me.ownerLabel,Me.providerKnowledgeId].some(We=>We.toLocaleLowerCase().includes(He))):u},[u,w]),lt=p.useMemo(()=>{const He=S.trim().toLocaleLowerCase();return He?N.filter(Me=>[Me.name,Me.id,x8(Me)].some(We=>We.toLocaleLowerCase().includes(He))):N},[S,N]);p.useEffect(()=>{Y(null)},[De==null?void 0:De.id,De==null?void 0:De.region]);const Ot=p.useCallback(async(He=!1)=>{var gt;if(He&&(ke.current||Object.keys(Ce.current).length===0))return;(gt=ne.current)==null||gt.abort();const Me=new AbortController;ne.current=Me;const We=Le.current+1;Le.current=We,ke.current=!0,He?_(!0):E(!0),T(""),He||g([]);try{const st=await a1t({regions:Te,nextTokens:He?Ce.current:void 0,signal:Me.signal});if(Le.current!==We)return;d(ft=>He?[...ft,...st.items.filter(Ht=>!ft.some(cn=>qe(cn)===qe(Ht)))]:st.items),Ce.current=st.nextTokens,h(st.nextTokens);const xt=st.failures.map(({region:ft,error:Ht})=>`${If(ft,e)}: ${el(Ht,l("common.loadFailed"))}`);g(ft=>He?[...new Set([...ft,...xt])]:xt),He||v(ft=>st.items.some(Ht=>qe(Ht)===ft)?ft:"")}catch(st){if(y8(st))return;Le.current===We&&(He?g(xt=>[...new Set([...xt,el(st,l("knowledge.errors.loadMoreBases"))])]):T(el(st,l("knowledge.errors.loadBases"))))}finally{Le.current===We&&(ke.current=!1,E(!1),_(!1))}},[qe,e,Te,l]),Ct=p.useCallback(async(He,Me=!1)=>{var st;if(Me&&ve.current)return;(st=ge.current)==null||st.abort();const We=new AbortController;ge.current=We;const gt=be.current+1;be.current=gt,Me||(Ve.current=[],Re.current=!1,A([]),W(!1),I("")),ve.current=!0,D(!0),Me?I(""):L("");try{const xt=await d1t(He.id,{region:He.region,offset:Me?Ve.current.length:0,signal:We.signal});if(be.current!==gt)return;K(hn=>hn===qe(He)?"":hn);const ft=Ve.current,Ht=Me?[...ft,...xt.items.filter(hn=>!hn.id||!ft.some(Ge=>Ge.id===hn.id))]:xt.items,cn=xt.hasMore&&(!Me||Ht.length>ft.length);Ve.current=Ht,Re.current=cn,A(Ht),W(cn)}catch(xt){if(y8(xt))return;be.current===gt&&(xt instanceof IP&&xt.errorCode===eIe&&(K(qe(He)),ce(Ht=>Ht&&qe(Ht)===qe(He)?null:Ht)),Me?I(el(xt,l("knowledge.errors.loadMoreData"))):L(el(xt,l("knowledge.errors.loadData"))))}finally{be.current===gt&&(ve.current=!1,D(!1))}},[qe,l]);p.useEffect(()=>{var He;(He=ne.current)==null||He.abort(),Le.current+=1,ke.current=!1,Ce.current={},d([]),h({}),g([]),v(""),K(""),T(""),E(!0)},[e]),p.useEffect(()=>{if(n)return Ot(),()=>{var He;(He=ne.current)==null||He.abort(),Le.current+=1,ke.current=!1}},[n,i,Ot]),p.useEffect(()=>{var He,Me;if(!n){(He=ge.current)==null||He.abort(),be.current+=1,ve.current=!1;return}if(!De){(Me=ge.current)==null||Me.abort(),be.current+=1,Ve.current=[],ve.current=!1,Re.current=!1,A([]),W(!1),I("");return}return Ct(De),()=>{var We;(We=ge.current)==null||We.abort(),be.current+=1,ve.current=!1}},[n,i,De==null?void 0:De.id,De==null?void 0:De.region]);const dt=n&&!De&&!w.trim()&&!C&&!R&&!j&&Object.keys(f).length>0;p.useEffect(()=>{const He=it.current,Me=Ke.current;if(!He||!Me||!dt)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ot(!0)},{root:Me,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[dt,Ot]);const yt=()=>{const He=Ke.current;!He||!dt||He.scrollHeight-He.scrollTop-He.clientHeight<=240&&Ot(!0)},Ie=!!(De&&N.length>0&&F&&!P&&!U);p.useEffect(()=>{const He=xe.current,Me=ue.current;if(!De||!He||!Me||!Ie)return;const We=new IntersectionObserver(([gt])=>{gt.isIntersecting&&Ct(De,!0)},{root:ue.current,rootMargin:"240px 0px",threshold:.01});return We.observe(He),()=>We.disconnect()},[Ie,Ct,De==null?void 0:De.id,De==null?void 0:De.region]);const vt=()=>{const He=ue.current;if(!De||!He||!Re.current||ve.current||U)return;const{scrollHeight:Me,scrollTop:We,clientHeight:gt}=He;Me-We-gt<=240&&Ct(De,!0)},jt=He=>{d(Me=>Me.map(We=>qe(We)===qe(He)?He:We))},Nt=async()=>{if(ye){Se(!0);try{await u1t(ye.id,ye.region),d(He=>He.filter(Me=>qe(Me)!==qe(ye))),K(He=>He===qe(ye)?"":He),b===qe(ye)&&v(""),Ne(null)}catch(He){T(el(He,l("knowledge.errors.deleteBase"))),Ne(null)}finally{Se(!1)}}},ln=async()=>{if(!(!De||!pe)){Se(!0);try{await b1t(De.id,pe.id,De.region);const He=Ve.current.filter(Me=>Me.id!==pe.id);Ve.current=He,A(He),me(null)}catch(He){L(el(He,l("knowledge.errors.deleteDocument"))),me(null)}finally{Se(!1)}}};return a.jsxs("section",{className:`knowledge-library${De?" is-detail":" resource-collection"}`,"aria-label":l("knowledge.library"),children:[De?a.jsx(LC,{className:"knowledge-library__detail",title:De.name,description:De.description||l("common.noDescription"),identitySeed:De.name,backLabel:l("knowledge.backToList"),onBack:()=>v(""),sections:[{key:"overview",label:l("skillCenter.overview"),content:a.jsx("section",{className:"knowledge-overview",children:a.jsxs(Oz,{className:"knowledge-overview__summary",children:[a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.provider")}),a.jsx("dd",{children:De.providerType||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.knowledgeId")}),a.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:De.providerKnowledgeId,children:De.providerKnowledgeId||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.project")}),a.jsx("dd",{children:De.projectName||"default"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("knowledge.creator")}),a.jsx("dd",{children:X5(De.ownerLabel)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:l("skillCenter.updatedAt")}),a.jsx("dd",{children:DIt(De.updatedAt,c.resolvedLanguage??c.language)||"-"})]})]})})},{key:"data",label:l("knowledge.data"),content:a.jsx("section",{className:"knowledge-documents",children:a.jsx("div",{className:`knowledge-documents__body${N.length>0?" is-table":""}`,"aria-live":"polite",children:P&&N.length===0?a.jsx(Fa,{}):M&&N.length===0?a.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[a.jsx("p",{children:M}),At&&De.canManage?a.jsx("button",{type:"button",onClick:()=>Ne(De),children:l("knowledge.deleteInvalidAssociation")}):a.jsx("button",{type:"button",onClick:()=>void Ct(De),children:l("common.retry")})]}):N.length===0?a.jsxs("div",{className:"knowledge-library__state",children:[a.jsx(RIt,{}),a.jsx("p",{children:l("knowledge.noData")}),De.canManage&&a.jsx("button",{type:"button",onClick:()=>ce(De),children:l("knowledge.addFirstData")})]}):a.jsx(kz,{rows:lt,rowKey:He=>He.id,rowLabel:He=>He.name||He.id,columns:[{key:"name",header:l("common.name"),className:"is-primary-column",render:He=>a.jsx("span",{title:He.name||He.id,children:He.name||He.id})},{key:"format",header:l("knowledge.format"),className:"is-compact-column",render:He=>x8(He)},{key:"size",header:l("knowledge.size"),className:"is-compact-column",render:He=>rV(He.sizeBytes)}],searchValue:S,onSearchChange:k,searchPlaceholder:l("knowledge.searchData"),searchLabel:l("knowledge.searchLibraryData"),primaryAction:De.canManage?{label:l(At?"knowledge.associationInvalid":"knowledge.addData"),disabled:At,title:At?l("knowledge.providerMissing"):void 0,onClick:()=>ce(De)}:void 0,rowActions:He=>[{label:l("common.preview"),onSelect:()=>Y(He)},...De.canManage?[{label:l("common.edit"),onSelect:()=>te(He)},{label:l("common.delete"),onSelect:()=>me(He),danger:!0}]:[]],scrollRef:ue,onScroll:vt,busy:P,emptyLabel:l("knowledge.noMatchingData"),footer:P?a.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:l("knowledge.loadingMoreData")})]}):U?a.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[a.jsx("span",{children:U}),a.jsx("button",{type:"button",onClick:()=>void Ct(De,!0),children:l("knowledge.retryLoading")})]}):F?a.jsx("div",{ref:xe,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:l("skillCenter.scrollForMore")}):null})})})}],activeSectionKey:y,navigationLabel:l("knowledge.details"),onSectionChange:x,actions:De.canManage?a.jsxs(a.Fragment,{children:[a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Ne(De),children:l("common.delete")}),a.jsx(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>Q(!0),children:l("common.edit")})]}):void 0}):a.jsxs(a.Fragment,{children:[a.jsxs(Gy,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,a.jsxs("div",{className:"resource-toolbar__actions",children:[o,a.jsx(hp,{value:w,onChange:He=>O(He.target.value),placeholder:l("knowledge.searchBases"),"aria-label":l("knowledge.searchBases")})]})]}),a.jsxs(Rg,{ref:Ke,"aria-live":"polite",onScroll:yt,children:[m.length>0&&!C&&a.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[a.jsx("span",{children:l("knowledge.someBasesFailed")}),a.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}),C&&u.length===0?a.jsx(Fa,{}):j?a.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[a.jsx("p",{children:j}),a.jsx("button",{type:"button",onClick:()=>void Ot(),children:l("common.retry")})]}):It.length===0&&w.trim()?a.jsxs("div",{className:"knowledge-library__state",children:[a.jsx(NIt,{}),a.jsx("p",{children:l("knowledge.noMatchingBases")})]}):a.jsxs(Yy,{children:[w.trim()?null:a.jsx(ug,{"aria-label":l("knowledge.createBase"),icon:a.jsx(PIt,{}),onClick:()=>X(!0),children:l("knowledge.createBase")}),It.map(He=>a.jsx(Jy,{className:"knowledge-card",title:He.name,description:He.description||l("common.noDescription"),metadata:[{label:l("knowledge.creator"),value:X5(He.ownerLabel),title:X5(He.ownerLabel)},{label:l("knowledge.project"),value:He.projectName||"default",title:He.projectName||"default"}],action:{label:H===qe(He)?l("knowledge.associationInvalid"):l("knowledge.addData"),icon:"plus",disabled:!He.canManage||H===qe(He),title:He.canManage?H===qe(He)?l("knowledge.providerMissing"):void 0:l("knowledge.noManagePermission"),onClick:()=>ce(He)},detailAction:{label:l("common.viewDetails"),onClick:()=>v(qe(He))}},qe(He)))]}),dt||R?a.jsx("div",{ref:it,className:"my-agent-load-more",role:"status","aria-live":"polite",children:R?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:l("knowledge.loadingMoreBases")})]}):dt?a.jsx("span",{children:l("skillCenter.scrollForMore")}):null}):null]})]}),V&&a.jsx(BIt,{region:t,onClose:()=>X(!1),onCreated:He=>{d(Me=>[He,...Me]),v(qe(He)),X(!1)}}),De&&ie&&a.jsx(UIt,{item:De,onClose:()=>Q(!1),onUpdated:He=>{jt(He),Q(!1)}}),De&&Ee&&a.jsx(JIt,{base:De,item:Ee,onClose:()=>Y(null)}),Z&&a.jsx(QIt,{base:Z,onClose:()=>ce(null),onAssociationInvalid:He=>{K(qe(Z)),De&&qe(De)===qe(Z)&&L(el(He,l("knowledge.associationInvalid"))),ce(null)},onCreated:()=>{De&&qe(De)===qe(Z)&&Ct(De),ce(null)}}),De&&G&&a.jsx(zIt,{base:De,item:G,onClose:()=>te(null),onUpdated:He=>{const Me=Ve.current.map(We=>We.id===He.id?He:We);Ve.current=Me,A(Me),te(null)}}),ye&&a.jsx(Gu,{title:l("knowledge.deleteBaseTitle"),description:l("knowledge.deleteBaseDescription",{name:ye.name}),confirmLabel:l(se?"common.deleting":"common.delete"),variant:"danger",busy:se,onCancel:()=>Ne(null),onConfirm:()=>void Nt()}),pe&&a.jsx(Gu,{title:l("knowledge.deleteDocumentTitle"),description:l("knowledge.deleteDocumentDescription",{name:pe.name||pe.id}),confirmLabel:l(se?"common.deleting":"common.delete"),variant:"danger",busy:se,onCancel:()=>me(null),onConfirm:()=>void ln()})]})}const tPt="_EmptyMessage_1r5gu_1",nPt="_IconBadge_1r5gu_16",iPt="_Title_1r5gu_54",rPt="_Description_1r5gu_69",sPt="_ActionRow_1r5gu_77",GC={EmptyMessage:tPt,IconBadge:nPt,Title:iPt,Description:rPt,ActionRow:sPt},Pn=({children:e,className:t,fill:n="static"})=>a.jsx("div",{className:Ti(GC.EmptyMessage,t),"data-fill":n,children:e}),oPt=({size:e="md",color:t="secondary",children:n,className:i})=>a.jsx("div",{className:Ti(GC.IconBadge,i),"data-size":e,"data-color":t,children:n}),aPt=({children:e,className:t,color:n="secondary"})=>a.jsx("div",{className:Ti(GC.Title,t),"data-color":n,children:e}),lPt=({children:e,className:t})=>a.jsx("div",{className:Ti(GC.Description,t),children:e}),cPt=({children:e,className:t})=>a.jsx("div",{className:Ti(GC.ActionRow,t),children:e});Pn.Icon=oPt;Pn.Title=aPt;Pn.Description=lPt;Pn.ActionRow=cPt;const uPt={name:"studio_share_space"},dPt={name:"studio_review_space"},qDe={share:uPt,review:dPt},fPt=qDe.share.name,WDe=qDe.review.name,hPt=[fPt,WDe];function KDe(e){return hPt.includes(e.trim().toLowerCase())}function pPt(e){return e.name===WDe}const mPt="/web/skill-management";class sV extends Error{constructor(t,n,i="SKILL_MANAGEMENT_ERROR",r="",s,o=""){super(t),this.status=n,this.code=i,this.statusText=r,this.originalError=s,this.rawResponse=o,this.name="SkillManagementApiError"}}async function Dl(e,t={},n=Ba){return fetch(Zo(`${mPt}${e}`),{...t,headers:Pl(uu(t.headers)),signal:Ua(t.signal,n)})}async function qP(e,t){let n=t,i="SKILL_MANAGEMENT_ERROR",r;const s=await e.text().catch(()=>"");try{const o=JSON.parse(s);typeof o.detail=="string"?n=o.detail:o.detail&&(n=o.detail.message||t,i=o.detail.code||i,r=o.detail.originalError)}catch{s.trim()&&(n=z("common.fallbackWithDetail",{fallback:t,detail:s.trim()}))}return new sV(n,e.status,i,e.statusText,r,s)}async function Ml(e,t){if(!e.ok)throw await qP(e,t);return e.json()}async function gPt(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),Ml(await Dl(`/spaces?${t}`,{signal:e.signal}),z("skills.listSpacesFailed"))}async function bPt(e){if(KDe(e.name))throw new sV(z("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return Ml(await Dl("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),z("skills.createSpaceFailed"))}async function yPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/shared-space/ensure?${t}`,{method:"POST",signal:e.signal}),z("skills.sharedSpaceFailed"))}async function vPt(e){return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/review`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e.region,version:e.version})},xr),z("skills.submitReviewFailed"))}async function xPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/reviews?${t}`,{signal:e.signal}),z("skills.listReviewsFailed"))}async function wPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/reviews/${encodeURIComponent(e.id)}/files?${t}`,{signal:e.signal},xr),z("skills.reviewFilesFailed"))}async function OPt(e){return Ml(await Dl(`/reviews/${encodeURIComponent(e.id)}/decision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:e.region,decision:e.decision,reason:e.reason||"",comment:e.comment||""})},xr),z("skills.decideReviewFailed"))}async function kPt(e){const t=new URLSearchParams({region:e.region});return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/reviews?${t}`,{signal:e.signal}),z("skills.listReviewsFailed"))}async function SPt(e){if(KDe(e.name))throw new sV(z("skills.reservedSpaceName"),409,"SKILL_SPACE_RESERVED_IDENTITY");return Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),z("skills.updateSpaceFailed"))}async function EPt(e){const t=new URLSearchParams({region:e.region});await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),z("skills.deleteSpaceFailed"))}async function CPt(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},xr),z("skills.uploadFailed"))}async function TPt(e){return Ml(await Dl("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},xr),z("skills.validateFailed"))}async function APt(e){const t=new URLSearchParams({region:e.region});await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),z("skills.deleteFailed"))}async function GDe(e){const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Ml(await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),z("skills.listFilesFailed"));return Array.isArray(n.files)?n.files:[]}async function _Pt(e){var l;const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Dl(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},xr);n.ok||await Ml(n,z("skills.downloadFailed"));const r=((l=(n.headers.get("content-disposition")||"").match(/filename="([^"]+)"/))==null?void 0:l[1])||`${e.fallbackName}.zip`,s=URL.createObjectURL(await n.blob()),o=document.createElement("a");o.href=s,o.download=r,o.click(),URL.revokeObjectURL(s)}function rc(e){var t;return((t=e==null?void 0:e.displayName)==null?void 0:t.trim())||(e==null?void 0:e.name)||""}async function WP(e){const t=await fetch(Zo(e),{headers:Pl(uu({accept:"application/json"})),signal:Ua(void 0,Ba)});if(!t.ok)throw await qP(t,Kt("helpers.skills.agentKitRequestFailed"));return t.json()}async function XDe(){return((await WP("/web/skill-spaces")).items||[]).filter(t=>!pPt(t))}async function YDe(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function jPt(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function NPt(e,t,n,i,r,s,o){const l=[];n&&l.push(`version=${encodeURIComponent(n)}`),i&&l.push(`region=${encodeURIComponent(i)}`),r&&l.push(`project=${encodeURIComponent(r)}`),s&&l.push(`skill_name=${encodeURIComponent(s)}`),o&&l.push(`skill_space_name=${encodeURIComponent(o)}`);const c=l.length>0?`?${l.join("&")}`:"";return WP(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function RPt(e,t){const n=Db(t);return{source:"skillspace",id:`ss:${e.id}/${n}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:n,version:t.version}}function Db(e){return e.skillId||e.skillName}function IPt(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}mn.hasResourceBundle("en-US","skills")||mn.addResourceBundle("en-US","skills",Jfe,!0,!0);mn.hasResourceBundle("zh-CN","skills")||mn.addResourceBundle("zh-CN","skills",eve,!0,!0);function Jt(e,t={}){return mn.t(e,{...t,ns:"skills"})}const PPt="/web/skill-workbench";class w8 extends Error{constructor(t,n,i="SKILL_WORKBENCH_ERROR",r=!1,s="",o,l=""){super(t),this.status=n,this.code=i,this.retryable=r,this.statusText=s,this.originalError=o,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function Hu(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(Jt("api.invalidFormat",{label:t}));return e}function Pte(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(Jt("api.invalidFormat",{label:t}));return e.trim()}}function DPt(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error(Jt("api.invalidFormat",{label:Jt("api.recoveryStatus")}))}}async function Mf(e,t={},n=Ba){return fetch(Zo(`${PPt}${e}`),{...t,headers:uu(t.headers),signal:Ua(t.signal,n)})}async function oV(e,t){var i;const n=await e.text().catch(()=>"");try{const r=Hu(JSON.parse(n),Jt("api.errorResponse")),s=r.detail&&typeof r.detail=="object"?Hu(r.detail,Jt("api.errorDetails")):r;return new w8(typeof s.message=="string"?s.message:t,e.status,typeof s.code=="string"?s.code:"SKILL_WORKBENCH_ERROR",s.retryable===!0,e.statusText,s.originalError&&typeof s.originalError=="object"?s.originalError:void 0,n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||Jt("api.missingContentType");return new w8(Jt("api.gatewayError",{fallback:t,status:e.status,contentType:r}),e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function fg(e,t){if(!e.ok)throw await oV(e,t);const n=e.headers.get("content-type")??"";if(!n.includes("application/json")){const i=n.split(";",1)[0]||Jt("api.missingContentType");throw new Error(Jt("api.nonJson",{fallback:t,status:e.status,contentType:i}))}return e.json()}function MPt(e){return Array.isArray(e)?e.map(t=>{const n=Hu(t,Jt("api.activity")),i=n.kind,r=n.status;if(typeof n.id!="string"||!["status","thinking","message","tool"].includes(String(i))||!["running","done"].includes(String(r)))throw new Error(Jt("api.invalidActivity"));if(i==="tool"){if(typeof n.name!="string")throw new Error(Jt("api.invalidToolActivity"));return{id:n.id,kind:i,status:r,name:n.name,...n.input!==void 0?{args:n.input}:{},...n.output!==void 0?{response:n.output}:{}}}if(typeof n.text!="string")throw new Error(Jt("api.invalidTextActivity"));return{id:n.id,kind:i,status:r,text:n.text}}):[]}function LPt(e){if(e==null)return;const t=Hu(e,Jt("api.publication"));if(typeof t.revision!="number"||typeof t.skillId!="string"||typeof t.version!="string"||!Array.isArray(t.skillSpaceIds)||!t.skillSpaceIds.every(n=>typeof n=="string")||t.disposition!=="create-new"&&t.disposition!=="update-source"||!_I(t.region)||typeof t.projectName!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.publication")}));return{revision:t.revision,skillId:t.skillId,version:t.version,skillSpaceIds:t.skillSpaceIds,disposition:t.disposition,region:t.region,projectName:t.projectName}}function hE(e){const t=Hu(e,Jt("api.task"));if(typeof t.jobId!="string"||t.operation!=="create"&&t.operation!=="optimize"||typeof t.intent!="string"||typeof t.revision!="number"||typeof t.state!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.task")}));const n=Array.isArray(t.files)?t.files.flatMap(l=>{const c=Hu(l,Jt("api.file"));return typeof c.path=="string"&&typeof c.size=="number"?[{path:c.path,size:c.size}]:[]}):[];if(!["running","ready","failed","cancelled","expired","published"].includes(t.state))throw new Error(Jt("api.unknownTaskState"));const r=Pte(t.toolId,"Tool ID"),s=Pte(t.sessionId,"Session ID"),o=DPt(t.recoveryStatus);return{jobId:t.jobId,operation:t.operation,intent:t.intent,...typeof t.model=="string"?{model:t.model}:{},...typeof t.style=="string"?{style:t.style}:{},...typeof t.requestedName=="string"?{requestedName:t.requestedName}:{},revision:t.revision,...r?{toolId:r}:{},...s?{sessionId:s}:{},...typeof t.sessionTtlSeconds=="number"?{sessionTtlSeconds:t.sessionTtlSeconds}:{},...typeof t.expiresAt=="string"?{expiresAt:t.expiresAt}:{},...typeof t.recoveryAvailable=="boolean"?{recoveryAvailable:t.recoveryAvailable}:{},...o?{recoveryStatus:o}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:MPt(t.activities),files:n,...t.source&&typeof t.source=="object"?{source:t.source}:{},...typeof t.name=="string"?{name:t.name}:{},...typeof t.description=="string"?{description:t.description}:{},...typeof t.skillMd=="string"?{skillMd:t.skillMd}:{},...typeof t.error=="string"?{error:t.error}:{},...t.validation&&typeof t.validation=="object"?{validation:t.validation}:{},...t.publication?{publication:LPt(t.publication)}:{}}}async function KP(e){const t=Hu(await fg(await Mf("/capabilities",{signal:e}),Jt("api.loadCapability")),Jt("api.capability"));return{enabled:t.enabled===!0,reason:typeof t.reason=="string"?t.reason:"",operations:Array.isArray(t.operations)?t.operations.filter(n=>n==="create"||n==="optimize"):[],models:Array.isArray(t.models)?t.models.flatMap(n=>{if(!n||typeof n!="object")return[];const i=n;return typeof i.id=="string"&&typeof i.label=="string"?[{id:i.id,label:i.label}]:[]}):[],styles:t.styles&&typeof t.styles=="object"&&!Array.isArray(t.styles)?Object.fromEntries(Object.entries(t.styles).filter(n=>typeof n[1]=="string")):{},...typeof t.maxUploadBytes=="number"?{maxUploadBytes:t.maxUploadBytes}:{}}}async function $Pt(e){if(e.file){const n=new URLSearchParams({operation:"optimize",intent:e.intent});e.jobId&&n.set("job_id",e.jobId),e.model&&n.set("model",e.model),e.style&&n.set("style",e.style),e.name&&n.set("name",e.name);const i=await Mf(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},xr);return hE(await fg(i,Jt("api.startOptimization")))}const t=await Mf("/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e.operation,intent:e.intent,...e.model?{model:e.model}:{},...e.style?{style:e.style}:{},...e.name?{name:e.name}:{},...e.jobId?{jobId:e.jobId}:{},...e.source?{source:{kind:"skill-center",skillId:e.source.skillId,skillName:e.source.name,version:e.source.version,region:e.source.region,projectName:e.source.projectName,skillSpaceId:e.source.skillSpaceId,skillSpaceName:e.source.skillSpaceName}}:{}}),signal:e.signal},xr);return hE(await fg(t,Jt("api.startTask")))}async function FPt(e,t){return hE(await fg(await Mf(`/tasks/${encodeURIComponent(e)}`,{signal:t}),Jt("api.loadTask")))}async function Y5(e,t,n){const i=new URLSearchParams;i.set("expected_revision",String(t));const r=Hu(await fg(await Mf(`/tasks/${encodeURIComponent(e)}/artifact?${i.toString()}`,{signal:n}),Jt("api.loadArtifact")),Jt("api.artifact"));if(r.jobId!==e||r.revision!==t||!Number.isSafeInteger(r.revision)||r.revision<1||typeof r.sha256!="string"||!/^[0-9a-f]{64}$/.test(r.sha256)||typeof r.name!="string"||typeof r.description!="string"||!Array.isArray(r.files))throw new Error(Jt("api.invalidFormat",{label:Jt("api.artifact")}));const s=r.files.map(o=>{const l=Hu(o,Jt("api.artifactFile"));if(typeof l.path!="string"||typeof l.size!="number"||typeof l.content!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.artifactFile")}));return{path:l.path,size:l.size,content:l.content}});return{jobId:r.jobId,revision:r.revision,sha256:r.sha256,name:r.name,description:r.description,files:s}}async function Z5(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},xr);return hE(await fg(t,Jt("api.refine")))}async function BPt(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return hE(await fg(t,Jt("api.stop")))}async function UPt(e){const t=await Mf(`/tasks/${encodeURIComponent(e.jobId)}/publish-stream`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({disposition:e.disposition,expectedRevision:e.expectedRevision,expectedArtifactSha256:e.expectedArtifactSha256,skillSpaceIds:e.skillSpaceIds??[],projectName:e.projectName,region:e.region}),signal:e.signal},0);if(!t.ok)throw await oV(t,Jt("api.publish"));if(!(t.headers.get("content-type")??"").includes("application/x-ndjson"))throw new Error(Jt("api.nonNdjson"));if(!t.body)throw new Error(Jt("api.missingStream"));const i=new Set(["preparing","uploading","registering","activating","publishing"]);let r=null,s="";const o=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=Hu(JSON.parse(u),Jt("api.publishProgress"));if(d.type==="progress"){if(typeof d.phase!="string"||!i.has(d.phase)||typeof d.message!="string")throw new Error(Jt("api.invalidPublishProgress"));(h=e.onProgress)==null||h.call(e,{phase:d.phase,message:d.message});return}if(d.type==="error"){const m=Hu(d.error,Jt("api.publishError"));throw new w8(typeof m.message=="string"?m.message:Jt("api.publish"),500,typeof m.code=="string"?m.code:"SKILL_PUBLISH_FAILED",m.retryable===!0,"",m.originalError&&typeof m.originalError=="object"?m.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error(Jt("api.unknownPublishEvent"));const f=Hu(d.result,Jt("api.publishResult"));if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(m=>typeof m=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!_I(f.region)||typeof f.projectName!="string")throw new Error(Jt("api.invalidFormat",{label:Jt("api.publishResult")}));r={skillId:f.skillId,version:f.version,skillSpaceIds:f.skillSpaceIds,disposition:f.disposition,region:f.region,projectName:f.projectName}};for(;;){const{value:u,done:d}=await l.read();s+=o.decode(u,{stream:!d});const f=s.split(` +`);if(s=f.pop()??"",f.forEach(c),d)break}if(c(s),!r)throw new Error(Jt("api.streamEnded"));return r}async function QPt(e){await fg(await Mf(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),Jt("api.deleteTask"))}async function zPt(e,t,n){var c;const i=new URLSearchParams;i.set("expected_revision",String(t)),i.set("expected_sha256",n);const r=await Mf(`/tasks/${encodeURIComponent(e)}/download?${i.toString()}`,{},xr);if(!r.ok)throw await oV(r,Jt("api.download"));const o=((c=(r.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:c[1])??"skill.zip",l=URL.createObjectURL(await r.blob());try{const u=document.createElement("a");u.href=l,u.download=o,u.click()}finally{URL.revokeObjectURL(l)}}const ZDe=p.createContext(void 0);function r0(e){const t=p.useContext(ZDe);if(t===void 0&&!e)throw new Error(du(47));return t}const VPt={...aAe,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class HPt extends BI{constructor(n,i,r){const s=new qU;super(qPt(n,s,i,r),WPt(s),VPt);rn(this,"setOpen",(n,i)=>{var f,h;const r=i.reason===Bc,s=i.reason===Kx&&i.event.detail===0,o=!n&&(i.reason===OTe||i.reason==null),l=Ett(i),c=this.select("activeTriggerId");if(!n&&i.reason===wTe&&i.trigger==null&&c!=null&&(i.trigger=this.context.triggerElements.getById(c)??this.select("activeTriggerElement")??void 0),(h=(f=this.context).onOpenChange)==null||h.call(f,n,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,i);const u=()=>{const m={open:n,openChangeReason:i.reason};JTe(m,n,i.trigger,l()),this.update(m)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(XJe,()=>{this.set("stickIfOpen",!1)}),ri.flushSync(u)):u();let d;s?d="click":o?d="dismiss":i.reason===LS&&(d="focus"),this.set("instantType",d)})}}function qPt(e,t,n,i=!1){const r={...rAe(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r.floatingRootContext=sAe(t,n,i),r}function WPt(e){return{popupRef:p.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:p.createRef(),beforeContentFocusGuardRef:p.createRef(),stickIfOpenTimeout:new lu,triggerElements:e}}function Dte({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:s,modal:o=!1,handle:l,triggerId:c,defaultTriggerId:u=null}=e,d=GPt(l,{modal:o,open:i,openProp:n,activeTriggerId:u,triggerIdProp:c});d.useControlledProp("openProp",n),d.useControlledProp("triggerIdProp",c);const f=d.useState("open"),h=d.useState("mounted"),m=d.useState("payload");d.useContextCallback("onOpenChange",r),d.useContextCallback("onOpenChangeComplete",s),iAe(d,f),eAe(d);const{forceUnmount:g}=tAe(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:o}),p.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),p.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,Gs(kTe))}),[g,d]);const b=f||h;return a.jsxs(ZDe.Provider,{value:d,children:[l&&a.jsx(ZTe,{handle:l,store:d}),b&&a.jsx(XPt,{store:d,modal:o}),typeof t=="function"?t({payload:m}):t]})}function KPt(e){return r0(!0)?a.jsx(Dte,{props:e}):a.jsx(Net,{children:a.jsx(Dte,{props:e})})}function GPt(e,t){const n=YTe((i,r)=>new HPt(t,i,r));return p.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function XPt({store:e,modal:t}){const n=e.useState("floatingRootContext"),i=PTe(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=i.reference,s=i.floating;return nAe(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const YPt=300;function hg(e){return gC(e,"base-ui")}function ZPt(e,t){const n=p.useRef(null);function i(s){ri.flushSync(()=>{e.setOpen(!1,Gs(LS,s.nativeEvent,s.currentTarget))});const o=CJe(n.current);o==null||o.focus()}function r(s){var l;const o=e.select("positionerElement");if(o&&ex(s,o))(l=e.context.beforeContentFocusGuardRef.current)==null||l.focus();else{ri.flushSync(()=>{e.setOpen(!1,Gs(LS,s.nativeEvent,s.currentTarget))});let c=EJe(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&zn(o,c);){const u=c;if(c=MU(c),c===u)break}c==null||c.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:i,handleFocusTargetFocus:r}}function JPt(e){const t=p.useRef(""),n=p.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:p.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function eDt(e,t){const n=Wn((s,o)=>{(typeof e=="function"?e():e)||t(o||(HI?"touch":""))}),{onClick:i,onPointerDown:r}=JPt(n);return p.useMemo(()=>({onClick:i,onPointerDown:r}),[i,r])}const tDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:o=!1,nativeButton:l=!0,handle:c,payload:u,openOnHover:d=!1,delay:f=YPt,closeDelay:h=0,id:m,...g}=t,b=r0(!0),y=_tt(c)??b;if(!y)throw new Error(du(74));const x=hg(m),w=y.useState("isTriggerActive",x),O=y.useState("floatingRootContext"),S=y.useState("isOpenedByTrigger",x),k=y.useState("triggerPopupId",x),C=p.useRef(null),{registerTrigger:E,isMountedByThisTrigger:R}=Ctt(x,C,y,{payload:u,disabled:o,openOnHover:d,closeDelay:h}),_=y.useState("openChangeReason"),j=y.useState("stickIfOpen"),T=y.useState("openMethod"),N=y.useState("focusManagerModal"),A=Ptt(O,{enabled:!o&&d&&(T!=="touch"||_!==Kx),mouseOnly:!0,move:!1,handleClose:Ltt(),restMs:f,delay:{close:h},triggerElementRef:C,isActiveTrigger:w,isClosing:()=>y.select("transitionStatus")==="ending"}),P=Pet(O,{stickIfOpen:j}),D=eDt(()=>y.select("open"),ie=>{y.set("openMethod",ie)}),M=y.useState("triggerProps",R),{getButtonProps:L,buttonRef:U}=QU({disabled:o,native:l}),I={open(ie){return ie&&_===Kx?Ztt.open(ie):Ytt.open(ie)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:K,handleFocusTargetFocus:F}=ZPt(y,C),V=Do("button",t,{state:{disabled:o,open:S},ref:[U,n,E,C],props:[P.reference,A,M,D,{[mTe]:"",id:x,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":k},g,L],stateAttributesMapping:I}),X=a.jsx(p.Fragment,{children:V},x);return R&&!N?a.jsxs(p.Fragment,{children:[a.jsx(hy,{ref:H,onFocus:K}),X,a.jsx(hy,{ref:y.context.triggerFocusTargetRef,onFocus:F})]}):X}),JDe=p.createContext(void 0);function nDt(){const e=p.useContext(JDe);if(e===void 0)throw new Error(du(45));return e}const iDt=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t;return r0().useState("mounted")||i?a.jsx(JDe.Provider,{value:i,children:a.jsx(TTe,{ref:n,...r})}):null}),eMe=p.createContext(void 0);function rDt(){const e=p.useContext(eMe);if(!e)throw new Error(du(46));return e}const tMe=p.forwardRef(function(t,n){const{cutout:i,...r}=t;let s;if(i){const o=i.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return a.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let Mte={},Lte={},$te="";function GP(e,t){return hC(e)?e:t}function Fte(e,t,n){return/hidden|clip/.test(e.getComputedStyle(GP(t,n)).overflowY)}function sDt(e){if(typeof document>"u")return!1;const t=lr(e);return Fs(t).innerWidth-t.documentElement.clientWidth>0}function oDt(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=lr(e),i=n.documentElement,r=n.body,s=GP(i,r),o=s.style.overflowY,l=i.style.scrollbarGutter;i.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=o,i.style.scrollbarGutter=l,c===u}function aDt(e){const t=lr(e),n=t.documentElement,i=t.body,r=GP(n,i),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function lDt(e){var m;const t=lr(e),n=t.documentElement,i=t.body,r=Fs(n);let s=0,o=0,l=!1;const c=Yl.create();if(Bw&&(((m=r.visualViewport)==null?void 0:m.scale)??1)!==1)return()=>{};function u(){const g=r.getComputedStyle(n),b=r.getComputedStyle(i),x=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,o=n.scrollLeft,Mte={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},$te=n.style.scrollBehavior,Lte={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const w=n.scrollHeight>n.clientHeight,O=n.scrollWidth>n.clientWidth,S=g.overflowY==="scroll"||b.overflowY==="scroll",k=g.overflowX==="scroll"||b.overflowX==="scroll",C=Math.max(0,r.innerWidth-i.clientWidth),E=Math.max(0,r.innerHeight-i.clientHeight),R=parseFloat(b.marginTop)+parseFloat(b.marginBottom),_=parseFloat(b.marginLeft)+parseFloat(b.marginRight),j=GP(n,i);if(l=oDt(e),l){n.style.scrollbarGutter=x,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(w||S)&&(n.style.overflowY="scroll"),(O||k)&&(n.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:R||E?`calc(100dvh - ${R+E}px)`:"100dvh",width:_||C?`calc(100vw - ${_+C}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),i.scrollTop=s,i.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Mte),Object.assign(i.style,Lte),l||(n.scrollTop=s,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=$te)}function f(){d(),c.request(u)}u();const h=mi(r,"resize",f);return()=>{c.cancel(),d(),typeof r.removeEventListener=="function"&&h()}}class cDt{constructor(){rn(this,"lockCount",0);rn(this,"restore",null);rn(this,"timeoutLock",lu.create());rn(this,"timeoutUnlock",lu.create());rn(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});rn(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const n=lr(t),i=n.documentElement,r=n.body,s=Fs(i);if(Fte(s,i,r)){const l=new s.MutationObserver(()=>{Fte(s,i,r)||(l.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};l.observe(i,c),l.observe(r,c),this.restore=()=>l.disconnect();return}const o=HI||!sDt(t);this.restore=o?aDt(t):lDt(t)}}const uDt=new cDt;function nMe(e=!0,t=null){Un(()=>{if(e)return uDt.acquire(t)},[e,t])}const dDt=20;function fDt(e,t,n,i){const[r,s]=p.useState(!1);Un(()=>{if(!e||!t||n==null){s(!1);return}const o=lr(n).documentElement.clientWidth,l=n.offsetWidth;s(o>0&&l>0&&l>=o-dDt)},[e,t,n]),nMe(e&&(!t||r),i)}const hDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,anchor:o,positionMethod:l,side:c,align:u,sideOffset:d,alignOffset:f,collisionBoundary:h="clipping-ancestors",collisionPadding:m,arrowPadding:g,sticky:b,disableAnchorTracking:v=!1,collisionAvoidance:y=net,...x}=t,w=r0(),O=nDt(),S=_et(),k=w.useState("floatingRootContext"),C=w.useState("mounted"),E=w.useState("open"),R=w.useState("openChangeReason"),_=w.useState("activeTriggerElement"),j=w.useState("modal"),T=w.useState("openMethod"),N=w.useState("positionerElement"),A=w.useState("instantType"),P=w.useState("transitionStatus"),D=w.useState("adaptiveOrigin"),M=p.useRef(null),L=UU(N),U=Vtt({anchor:o,floatingRootContext:k,positionMethod:l,mounted:C,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:g,collisionBoundary:h,collisionPadding:m,sticky:b,disableAnchorTracking:v,keepMounted:O,nodeId:S,collisionAvoidance:y,adaptiveOrigin:D}),I=k.useState("domReferenceElement");Un(()=>{const V=I,X=M.current;if(V&&(M.current=V),X&&V&&V!==X){w.set("instantType",void 0);const ie=new AbortController;return L(()=>{w.set("instantType","trigger-change")},ie.signal),()=>{ie.abort()}}},[I,L,w]);const H=j===!0&&R!==Bc;fDt(E&&H,T==="touch",N,_);const K=w.useStateSetter("positionerElement"),F={open:E,side:U.side,align:U.align,anchorHidden:U.anchorHidden,instant:A},W=Jtt(t,F,{styles:U.positionerStyles,transitionStatus:P,props:x,refs:[n,K],hidden:!C,inert:!E});return a.jsxs(eMe.Provider,{value:U,children:[C&&H&&a.jsx(tMe,{inert:BU(!E),cutout:_}),a.jsx(jet,{id:S,children:W})]})}),pDt="ArrowUp",mDt="ArrowDown",gDt="ArrowLeft",bDt="ArrowRight",yDt="Home",vDt="End",iMe=new Set([pDt,mDt,gDt,bDt,yDt,vDt]),xDt=p.createContext(void 0);function wDt(e){return p.useContext(xDt)}const ODt=p.createContext(void 0);function kDt(){const[e,t]=p.useState(0),n=Wn(()=>(t(r=>r+1),()=>{t(r=>Math.max(0,r-1))}));return{context:p.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const SDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,initialFocus:o,finalFocus:l,...c}=t,u=r0(),d=rDt(),f=wDt()!=null,{context:h,hasClosePart:m}=kDt(),g=u.useState("open"),b=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),x=u.useState("popupProps"),w=u.useState("titleElementId"),O=u.useState("descriptionElementId"),S=u.useState("modal"),k=u.useState("mounted"),C=u.useState("openChangeReason"),E=u.useState("activeTriggerElement"),R=u.useState("floatingRootContext"),_=R.useState("floatingId"),j=u.useState("disabled"),T=u.useState("openOnHover"),N=u.useState("closeDelay");mC({open:g,ref:u.context.popupRef,onComplete(){var U,I;g&&((I=(U=u.context).onOpenChangeComplete)==null||I.call(U,!0))}}),Rtt(R,{enabled:T&&!j,closeDelay:N});const A=o===void 0?XTe(u.context.popupRef):o,P=S!==!1&&m;u.useSyncedValue("focusManagerModal",P);const D=u.useStateSetter("popupElement"),M={open:g,side:d.side,align:d.align,instant:v,transitionStatus:y},L=Do("div",t,{state:M,ref:[n,u.context.popupRef,D],props:[x,{id:_,role:"dialog",...GTe,"aria-labelledby":w,"aria-describedby":O,onKeyDown(U){f&&iMe.has(U.key)&&U.stopPropagation()}},fAe(y),c],stateAttributesMapping:dAe});return a.jsx(ITe,{context:R,openInteractionType:b,modal:P,disabled:!k||C===Bc,initialFocus:A,returnFocus:l,restoreFocus:"popup",previousFocusableElement:Ls(E)?E:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:a.jsx(ODt.Provider,{value:h,children:L})})}),EDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,l=r0(),c=hg(o.id);return l.useSyncedValueWithCleanup("titleElementId",c),Do("h2",t,{ref:n,props:[{id:c},o]})}),CDt=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,l=r0(),c=hg(o.id);return l.useSyncedValueWithCleanup("descriptionElementId",c),Do("p",t,{ref:n,props:[{id:c},o]})});function Bte(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),a.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function TDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),a.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),a.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),a.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function aV(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{className:"video-generate-icon__body",d:"M3.25 9h17.5v7.35a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V9Z"}),a.jsxs("g",{className:"video-generate-icon__clapper",children:[a.jsx("path",{d:"M3.25 9V7.65a2.4 2.4 0 0 1 2.4-2.4h12.7a2.4 2.4 0 0 1 2.4 2.4V9H3.25Z"}),a.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),a.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function ADt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),a.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),a.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function _Dt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),a.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),a.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function jDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),a.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),a.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),a.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function NDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),a.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),a.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function RDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),a.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),a.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),a.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function IDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),a.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),a.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),a.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function Ute(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"9",cy:"8",r:"3"}),a.jsx("path",{d:"M3.75 18.75c.45-3.05 2.2-4.65 5.25-4.65s4.8 1.6 5.25 4.65"}),a.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function PDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),a.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),a.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function DDt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),a.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function Qte(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),a.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),a.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function r1(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function MDt({value:e}){const{t,i18n:n}=Ae("adk"),[i,r]=p.useState(!1),s=f=>f==null?t("developmentRuns.notReported"):f.toLocaleString(n.resolvedLanguage||n.language),o=PCe,l=e.usage,c=(l==null?void 0:l.inputTokens)!=null&&l.cachedInputTokens!=null&&l.cachedInputTokens<=l.inputTokens?l.inputTokens-l.cachedInputTokens:void 0,u=l!=null&&l.inputTokens&&l.cachedInputTokens!=null&&c!=null?`${(l.cachedInputTokens/l.inputTokens*100).toFixed(1)}%`:void 0,d=[["inputTokens",l==null?void 0:l.inputTokens],["cachedInputTokens",l==null?void 0:l.cachedInputTokens],["uncachedInputTokens",c],["cacheWriteInputTokens",l==null?void 0:l.cacheWriteInputTokens],["outputTokens",l==null?void 0:l.outputTokens],["reasoningOutputTokens",l==null?void 0:l.reasoningOutputTokens]];return a.jsxs("div",{className:"development-turn-summary","data-turn-id":e.turnId,children:[a.jsx("span",{children:t(`developmentRuns.turnStatus.${e.status}`)}),a.jsx("span",{children:t("developmentRuns.toolCalls",{count:e.toolCalls})}),a.jsx("span",{children:t("developmentRuns.turnDuration",{duration:o(e.durationMs)})}),a.jsx("span",{title:t("developmentRuns.toolDurationHelp"),children:t(e.toolDurationComplete?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:o(e.toolDurationMs)})}),a.jsxs(KPt,{open:i,onOpenChange:r,children:[a.jsxs(tDt,{className:"development-token-trigger",openOnHover:!0,delay:150,closeDelay:150,onFocus:f=>{f.currentTarget.matches(":focus-visible")&&r(!0)},children:[a.jsx("span",{children:"Tokens"}),a.jsx("span",{className:"development-token-value",children:s(l==null?void 0:l.totalTokens)}),e.usageIncomplete&&a.jsxs("span",{children:["· ",t("developmentRuns.partial")]}),a.jsx(r1,{className:"development-token-chevron"})]}),a.jsx(iDt,{children:a.jsx(hDt,{side:"top",align:"end",sideOffset:8,className:"development-token-positioner",children:a.jsxs(SDt,{className:"development-token-popup",initialFocus:!1,finalFocus:!1,children:[a.jsx(EDt,{className:"development-token-title",children:t("developmentRuns.tokenDetails")}),a.jsxs("dl",{children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.model")}),a.jsx("dd",{children:e.model||t("developmentRuns.notReported")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.totalTokens")}),a.jsx("dd",{children:s(l==null?void 0:l.totalTokens)})]}),d.map(([f,h])=>a.jsxs("div",{children:[a.jsx("dt",{children:t(`developmentRuns.${f}`)}),a.jsx("dd",{children:s(h)})]},f)),a.jsxs("div",{children:[a.jsx("dt",{children:t("developmentRuns.cacheHitRate")}),a.jsx("dd",{children:u||t("developmentRuns.notReported")})]})]}),a.jsxs(CDt,{className:"development-token-note",children:[t("developmentRuns.tokenHelp"),e.usageIncomplete?` ${t("developmentRuns.partialHelp")}`:""]})]})})})]})]})}function lV(e){return a.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M0 5.6016C7.82288e-05 0.621244 6.02226 -1.87314 9.54395 1.64847L40.1289 32.2334L68.5732 3.7891C69.5834 2.77903 70.9533 2.21099 72.3818 2.21097H82.7031C82.7917 2.20658 82.8806 2.20414 82.9697 2.20414H104.775C109.574 2.20427 111.977 8.00691 108.584 11.4004L64.916 55.0664C64.3075 55.8528 63.9436 56.7647 63.8242 57.6993C63.7142 56.4884 63.1964 55.3069 62.2695 54.3799L45.4082 37.5186H45.4072L40.124 32.2354L17.832 54.5284C16.7671 55.5933 16.2416 56.993 16.2549 58.3887C16.2417 59.7843 16.7672 61.1842 17.832 62.2491L39.9287 84.3467L9.54395 114.733C6.0223 118.255 0.000223474 115.761 0 110.78V5.6016ZM63.8018 58.8702C63.8962 59.9086 64.2936 60.9229 64.9961 61.7735L108.591 105.368C111.984 108.762 109.58 114.564 104.781 114.564H94.4336C94.3543 114.568 94.274 114.569 94.1934 114.569H72.3877C70.9592 114.569 69.5892 114.002 68.5791 112.992L39.9336 84.3467L58.4531 65.8282L58.4453 65.8203L62.2695 61.9981C63.1476 61.12 63.6567 60.0136 63.8018 58.8702Z",fill:"currentColor"})})}function XP({kind:e,...t}){return e==="thinking"?a.jsx(lV,{...t}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:e==="tool"?a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),a.jsx("path",{d:"m7 9 3 3-3 3m6 0h4"})]}):e==="plan"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"m4 7 1.5 1.5L8 6m-4 7 1.5 1.5L8 12M11 7h9m-9 6h9m-9 6h9"}),a.jsx("circle",{cx:"6",cy:"19",r:"1"})]}):a.jsx(a.Fragment,{children:a.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9zM14 3v6h6M8 13h8m-4-3v6M8 18h8"})})})}function LDt({blocks:e,active:t,status:n,render:i}){const{t:r}=Ae("adk"),[s,o]=p.useState(!1),l=[...e].reverse().find(h=>"done"in h&&!h.done),c=e.filter(h=>h.kind==="tool"),u=c.filter(h=>h.durationMs!=null),d=u.reduce((h,m)=>h+(m.durationMs||0),0);let f=r("developmentRuns.processSummary",{count:e.length});return t&&(f=n||((l==null?void 0:l.kind)==="thinking"?r("developmentRuns.thinking"):(l==null?void 0:l.kind)==="tool"?DCe(l):(l==null?void 0:l.kind)==="plan"?r("developmentRuns.plan"):(l==null?void 0:l.kind)==="diff"?r("developmentRuns.diff"):r("developmentRuns.processing"))),a.jsxs("section",{className:"development-process",children:[a.jsxs("button",{type:"button",className:"development-process__toggle","aria-expanded":s,onClick:()=>o(!s),children:[a.jsx(r1,{className:`tool-chevron${s?" is-open":""}`}),a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:(l==null?void 0:l.kind)==="thinking"||(l==null?void 0:l.kind)==="plan"||(l==null?void 0:l.kind)==="diff"?l.kind:"tool"})}),t?a.jsx(yn,{className:"development-process__title","aria-live":"polite",children:f}):a.jsx("span",{className:"development-process__title",children:f}),!t&&c.length>0&&a.jsxs("span",{className:"development-process__duration",children:[r("developmentRuns.toolCalls",{count:c.length}),u.length>0?` · ${r(u.length===c.length?"developmentRuns.toolDuration":"developmentRuns.toolDurationPartial",{duration:PCe(d)})}`:""]})]}),a.jsx("div",{className:"development-process__items",hidden:!s,children:i(e)})]})}function $Dt({blocks:e,active:t,status:n="",render:i}){const{t:r}=Ae("adk"),s=vZe(e),o=s[s.length-1],l=[...e].reverse().find(u=>u.kind==="progress"),c=n||((l==null?void 0:l.kind)==="progress"?l.text:"");return a.jsxs(a.Fragment,{children:[s.map(u=>u.process?a.jsx(LDt,{blocks:u.blocks,active:t&&u===o,status:c,render:i},u.id):a.jsx("div",{"data-assistant-phase":u.blocks[0].phase,children:i(u.blocks)},u.id)),t&&!(o!=null&&o.process)&&a.jsxs("div",{className:"development-process__status",role:"status",children:[a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:"thinking"})}),a.jsx(yn,{children:c||r("developmentRuns.processing")})]})]})}const FDt={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function BDt(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(const r of n){if(i==null||typeof i!="object")return;i=i[r]}return i}function UDt(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function QDt(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function cV(e,t){if(UDt(e))return BDt(t,e.path);if(QDt(e)){const n=FDt[e.call],i={};for(const[r,s]of Object.entries(e.args??{}))i[r]=cV(s,t);return n?n(i):`[unknown fn: ${e.call}]`}return e}function zDt(e,t){const n=cV(e,t);return n==null?"":typeof n=="string"?n:String(n)}const rMe=new Map;function s0(e,t){rMe.set(e,t)}function VDt(e){return rMe.get(e)}function HDt(e,t,n){const i=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(let s=0;scV(i,e.dataModel),resolveString:i=>zDt(i,e.dataModel),dispatchAction:t,render:i=>{if(!i)return null;const r=e.components[i];if(!r)return null;const s=VDt(r.component)??qDt;return a.jsx(s,{node:r,ctx:n},i)}};return a.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function oMe(e){const t=p.useRef(null),n=p.useRef(!0),i=28,r=p.useCallback(()=>{const s=t.current;s&&(n.current=s.scrollHeight-s.scrollTop-s.clientHeight{const s=t.current;s&&n.current&&(s.scrollTop=s.scrollHeight)},[e]),{ref:t,onScroll:r}}function YP({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:i}){const{t:r}=Ae("conversation");return e.skills.length===0&&!e.targetAgent?null:a.jsxs("div",{className:"invocation-chips","aria-label":r("invocation.ariaLabel"),children:[e.skills.map(s=>a.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:s.description,children:[a.jsx(BS,{"aria-hidden":!0}),a.jsxs("span",{children:[t,s.name]}),n?a.jsx("button",{type:"button",onClick:()=>n(s.name),"aria-label":r("invocation.removeSkill",{name:s.name}),children:a.jsx(xa,{})}):null]},s.name)),e.targetAgent?a.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[a.jsx(SAe,{"aria-hidden":!0}),a.jsx("span",{children:e.targetAgent.name}),i?a.jsx("button",{type:"button",onClick:i,"aria-label":r("invocation.removeAgent",{name:e.targetAgent.name}),children:a.jsx(xa,{})}):null]}):null]})}function uV(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function aMe(e){var n,i,r,s;const t=uV(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((i=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:i.toUpperCase())??"VIDEO":t==="image"?((s=(r=e.mimeType)==null?void 0:r.split("/")[1])==null?void 0:s.toUpperCase())??"IMAGE":"TXT"}function lMe(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function cMe(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?mEe(t,e.uri):""}function KDt({kind:e}){return e==="image"?a.jsx(tQ,{}):e==="video"?a.jsx(CAe,{}):e==="pdf"?a.jsx(nit,{}):a.jsx(JU,{})}function ZP({appName:e,items:t,compact:n=!1,onRemove:i}){const{t:r}=Ae("conversation"),[s,o]=p.useState(null);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(l=>{const c=uV(l.mimeType),u=cMe(l,e),d=l.status==="uploading"||l.status==="error"||!u,f=a.jsxs("button",{type:"button",className:"media-card-main",disabled:d,onClick:c==="image"?void 0:()=>o(l),"aria-label":r("media.preview",{name:l.name??r("media.attachment")}),children:[c==="image"&&u?a.jsx("img",{className:"media-card-image",src:u,alt:l.name??r("media.image"),loading:"lazy"}):c==="video"&&u?a.jsxs("div",{className:"media-card-video-container",children:[a.jsx("video",{className:"media-card-video",src:u,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),a.jsx("span",{className:"media-card-video-play",children:a.jsx(pit,{})})]}):a.jsx("span",{className:"media-card-icon",children:a.jsx(KDt,{kind:c})}),a.jsxs("span",{className:"media-card-copy",children:[a.jsx("span",{className:"media-card-name",children:l.name??r("media.attachment")}),a.jsxs("span",{className:"media-card-meta",children:[a.jsx("span",{className:"media-card-type",children:aMe(l)}),l.status==="uploading"?a.jsxs(a.Fragment,{children:[a.jsx(Ei,{className:"media-card-spinner"})," ",r("media.uploading")]}):l.status==="error"?l.error??r("media.uploadFailed"):lMe(l.sizeBytes)]})]}),!n&&l.status!=="uploading"&&l.status!=="error"?a.jsx(nx,{className:"media-card-open"}):null]});return a.jsxs(dr.div,{className:`media-card media-card--${c}${l.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[c==="image"&&!d?a.jsx(BSe,{src:u,children:f}):f,i?a.jsx("button",{type:"button",className:"media-card-remove","aria-label":r("media.remove",{name:l.name??r("media.attachment")}),onClick:()=>i(l.id),children:a.jsx(xa,{})}):null]},l.id)})}),a.jsx(Ed,{children:s?a.jsx(GDt,{appName:e,item:s,onClose:()=>o(null)}):null})]})}function GDt({appName:e,item:t,onClose:n}){const{t:i}=Ae("conversation"),r=p.useMemo(()=>cMe(t,e),[e,t]),s=uV(t.mimeType),[o,l]=p.useState(""),[c,u]=p.useState(s==="text"||s==="markdown"),[d,f]=p.useState("");return p.useEffect(()=>{const h=m=>{m.key==="Escape"&&n()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n]),p.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const h=new AbortController;return u(!0),f(""),fetch(r,{signal:h.signal}).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(l).catch(m=>{h.signal.aborted||f(m instanceof Error?m.message:String(m))}).finally(()=>{h.signal.aborted||u(!1)}),()=>h.abort()},[s,r]),a.jsx(dr.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":i("media.previewDialog",{name:t.name??i("media.attachment")}),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:h=>{h.target===h.currentTarget&&n()},children:a.jsxs(dr.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[a.jsxs("header",{className:"media-viewer-header",children:[a.jsxs("div",{children:[a.jsx("strong",{children:t.name??i("media.attachment")}),a.jsxs("span",{children:[aMe(t),t.sizeBytes?` · ${lMe(t.sizeBytes)}`:""]})]}),a.jsxs("nav",{children:[a.jsx("a",{href:r,download:t.name,"aria-label":i("media.download"),children:a.jsx(eP,{})}),a.jsx("button",{type:"button",onClick:n,"aria-label":i("media.close"),children:a.jsx(xa,{})})]})]}),a.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?a.jsx("img",{src:r,alt:t.name??i("media.image")}):null,s==="video"?a.jsx("div",{className:"media-viewer-video-wrapper",children:a.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?a.jsx("iframe",{src:r,title:t.name??"PDF"}):null,c?a.jsxs("div",{className:"media-viewer-loading",children:[a.jsx(Ei,{})," ",i("media.reading")]}):null,!c&&d?a.jsx("div",{className:"media-viewer-loading",children:i("media.loadFailed",{error:d})}):null,!c&&s==="markdown"?a.jsx("div",{className:"media-document",children:a.jsx(Yu,{text:o})}):null,!c&&s==="text"?a.jsx("pre",{className:"media-document media-document--plain",children:o}):null]})]})})}function XDt({definition:e,label:t,done:n,open:i,onToggle:r}){const{t:s}=Ae("conversation"),o=e.icon,l=n?e.doneLabel:e.runningLabel,c=t??s(`blocks.tools.${e.name}.${n?"done":"running"}`,{defaultValue:l});return a.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":i,children:[a.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:a.jsx(o,{})}),n?a.jsx("span",{className:"builtin-tool-label",children:c}):a.jsx(yn,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:c}),a.jsx(r1,{className:`builtin-tool-chevron${i?" is-open":""}`})]})}function nu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function In(e){return typeof e=="string"?e:""}function zte(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Nu(e){return Array.isArray(e)?e:[]}function O8(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=nu(t)??{};return nu(n.result)??n}function JP(e){if(typeof e=="string")try{return JP(JSON.parse(e))}catch{return e}const t=nu(e);if(!t)return"";const n=nu(t.result);return In(t.error)||In(t.message)||In(n==null?void 0:n.error)||In(n==null?void 0:n.message)}function YDt(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=nu(e.metadata),n=In(t==null?void 0:t.source_type).toLowerCase(),i=In(e.source).toLowerCase();return n==="skillhub"||i.startsWith("skill_hub:")?"skill_hub":"skill_space"}const uMe={tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknownSource:"Unknown source",unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"};function ZDt(e,t){return e==="veadk_builtin_tools"?t.tool:e==="agentkit_knowledge"?t.knowledge:e.startsWith("skill_hub:")?`Skill Hub ${e.slice(10)}`:e.startsWith("skill_space:")?`${t.skillCenter} ${e.slice(12)}`:e||t.unknownSource}function JDt(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function eMt(e,t=uMe){const n=O8(e),i=nu(n.capabilities)??{},r=Nu(n.resources).flatMap(o=>{const l=nu(o);if(!l)return[];const c=l.kind==="tool"?"tool":l.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:In(l.ref),kind:c,category:YDt(l),name:In(l.name)||In(l.ref)||t.unnamedResource,description:In(l.description),source:In(l.source),version:In(l.version)}]}),s=Nu(n.sources).flatMap(o=>{const l=nu(o);if(!l)return[];const c=In(l.source),u=In(l.status),d=u==="error"?"error":u==="skipped"?"skipped":"ok";return[{source:c,category:JDt(c),label:ZDt(c,t),status:d,count:zte(l.count),message:In(l.message),searchKeywords:Nu(l.search_keywords).map(In).filter(Boolean)}]});return{collectionId:In(n.collection_id),capabilities:{googleAdkVersion:In(i.google_adk_version),agentTypes:Nu(i.agent_types).map(In).filter(Boolean),maxOrchestrationDepth:zte(i.max_orchestration_depth)},resources:r,sources:s,counts:{all:r.length,skill_hub:r.filter(o=>o.category==="skill_hub").length,skill_space:r.filter(o=>o.category==="skill_space").length,knowledge_base:r.filter(o=>o.category==="knowledge_base").length,tool:r.filter(o=>o.category==="tool").length}}}function tMt(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function dMe(e,t,n=uMe){const i=O8(e),r=O8(t),s=new Map(Nu(r.results).flatMap(d=>{const f=nu(d),h=In(f==null?void 0:f.name);return f&&h?[[h,f]]:[]})),o=Nu(i.agents).flatMap(d=>{const f=nu(d),h=In(f==null?void 0:f.name);return f&&h?[f]:[]}),l=new Set(o.map(d=>In(d.name))),c=[...s.entries()].filter(([d])=>!l.has(d)).map(([d])=>({name:d})),u=[...o,...c].map(d=>{const f=In(d.name),h=Nu(d.nodes).flatMap(C=>{const E=nu(C);return E?[E]:[]}),m=In(d.root_node),g=h.find(C=>In(C.id)===m),b=h.filter(C=>In(C.id)!==m).map(C=>({id:In(C.id)||n.unnamedAgent,type:In(C.type)||"llm",description:In(C.description)})),v=s.get(f),y=In(v==null?void 0:v.status),x=y==="failed"?"failed":y==="completed"?"completed":"running",w=Vte(v==null?void 0:v.resources),O=w.length>0?w:Vte(h.flatMap(C=>Nu(C.resources))),S=Hte(v==null?void 0:v.python_tools),k=S.length>0?S:Hte(h.flatMap(C=>Nu(C.python_tools)));return{name:f,description:In(v==null?void 0:v.description)||In(g==null?void 0:g.description)||In(d.task),task:In(d.task),rootType:In(v==null?void 0:v.root_type)||In(g==null?void 0:g.type)||"llm",nodeCount:h.length,subAgentCount:b.length,resourceCount:O.length,pythonToolCount:k.length,skills:O.filter(C=>C.kind==="skill"),knowledgeBases:O.filter(C=>C.kind==="knowledge_base"),builtinTools:O.filter(C=>C.kind==="tool"),pythonTools:k,subAgents:b,status:x,output:In(v==null?void 0:v.output),error:In(v==null?void 0:v.error)}});return{collectionId:In(r.collection_id)||In(i.collection_id),agents:u,completedCount:u.filter(d=>d.status==="completed").length,failedCount:u.filter(d=>d.status==="failed").length,runningCount:u.filter(d=>d.status==="running").length}}function nMt(e,t){return!!JP(t)||dMe(e,t).failedCount>0}function Vte(e){const t=new Set;return Nu(e).flatMap(n=>{const i=nu(n),r=In(i?i.ref:n);if(!r||t.has(r))return[];t.add(r);const s=In(i==null?void 0:i.kind),o=s==="tool"||r.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||r.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=r.split(":");return[{ref:r,kind:o,name:In(i==null?void 0:i.name)||l[l.length-1]||r,description:In(i==null?void 0:i.description),version:In(i==null?void 0:i.version),source:In(i==null?void 0:i.source)}]})}function Hte(e){const t=new Set;return Nu(e).flatMap(n=>{const i=nu(n),r=In(i==null?void 0:i.name),s=In(i==null?void 0:i.code),o=`${r}\0${s}`;return!i||!r||t.has(o)?[]:(t.add(o),[{name:r,description:In(i.description),code:s,entrypoint:In(i.entrypoint)||r,dependencies:Nu(i.dependencies).map(In).filter(Boolean)}])})}function iMt({branch:e}){return a.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?a.jsx(Yu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?a.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?a.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function rMt({args:e,response:t,status:n,onBranchSelect:i}){const{t:r}=Ae("conversation"),s=p.useMemo(()=>RAe(e,t,n),[e,t,n]),[o,l]=p.useState(0);return a.jsxs("section",{className:"branch-compare","aria-label":r("blocks.branchCompare.ariaLabel"),children:[a.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":r("blocks.branchCompare.selectDirection"),children:s.branches.map((c,u)=>a.jsx("button",{className:`branch-compare__tab${o===u?" is-active":""}`,type:"button",role:"tab","aria-selected":o===u,"aria-controls":`branch-compare-panel-${u}`,onClick:()=>l(u),children:a.jsx(Io,{color:"info",size:"sm",variant:"soft",children:c.label})},`${c.label}:${u}`))}),a.jsx("div",{className:"branch-compare__branches",children:s.branches.map((c,u)=>a.jsxs("article",{className:`branch-compare__branch${o===u?" is-active":""}`,id:`branch-compare-panel-${u}`,role:"tabpanel",children:[a.jsx("header",{className:"branch-compare__head",children:a.jsx(Io,{color:"info",size:"sm",variant:"soft",children:c.label})}),a.jsx(iMt,{branch:c}),a.jsx("footer",{className:"branch-compare__footer",children:a.jsx(Dt,{type:"button",color:"info",variant:"ghost",size:"sm",pill:!1,disabled:c.status!=="completed",onClick:()=>i==null?void 0:i(c),children:r("blocks.branchCompare.continue")})})]},`${c.label}:${u}`))})]})}function fMe({controlled:e,default:t,name:n,state:i="value"}){const{current:r}=p.useRef(e!==void 0),[s,o]=p.useState(t),l=r?e:s,c=p.useCallback(u=>{r||o(u)},[]);return[l,c]}const hMe=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function sMt(){return p.useContext(hMe)}function oMt(e){const{children:t,elementsRef:n,labelsRef:i,onMapChange:r}=e,s=Wn(r),[,o]=p.useState(!1),l=Ku(lMt).current,c=Ku(aMt).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=Wn(()=>{d.current||(d.current=!0,o(S=>!S))}),g=Wn((S,k)=>{c.set(S,k),m()}),b=Wn(S=>{c.delete(S),m()}),v=Wn(S=>{const k=new Map;return n.current.length=0,i&&(i.current.length=0),S.forEach(C=>{var E,R;k.set(C.element,{...C.registration.metadata??{},index:C.index}),n.current[C.index]=C.element,i&&(i.current[C.index]=C.registration.label!==void 0?C.registration.label:((R=(E=C.registration.textRef)==null?void 0:E.current)==null?void 0:R.textContent)??C.element.textContent)}),u.current=n.current.length,k});function y(S){var E;if((E=h.current)==null||E.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const k=new MutationObserver(R=>{if(!dMt(R))return;let _=null;for(const j of S)if(j.isConnected){if(_&&pMe(_,j)>0){k.disconnect(),m();return}_=j}});h.current=k;const C=new Set;for(let R=1;Rk.observe(R,{childList:!0}))}const x=Wn(()=>{const[S,k]=cMt(c),C=v(S);y(k),f.current=S,d.current=!1,l.forEach(E=>E(C)),s(C)});Un(()=>(d.current||v(f.current),()=>{n.current=[],i&&(i.current=[])}),[n,i,v]),Un(()=>{d.current&&x()}),Un(()=>()=>{var S;(S=h.current)==null||S.disconnect(),d.current=!0},[]);const w=Wn(S=>(l.add(S),()=>{l.delete(S)})),O=p.useMemo(()=>({register:g,unregister:b,subscribeMapChange:w,nextIndexRef:u}),[g,b,w,u]);return a.jsx(hMe.Provider,{value:O,children:t})}function aMt(){return new Map}function lMt(){return new Set}function cMt(e){const t=new Set,n=[],i=[];e.forEach((s,o)=>{if(!o.isConnected)return;const l=s.index,c={index:l??-1,element:o,registration:s};l===null?i.push(c):l>=0&&(t.add(l),n.push(c))});let r=0;return i.sort((s,o)=>pMe(s.element,o.element)),i.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,o)=>s.index-o.index),[n,i.map(s=>s.element)]}function uMt(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function dMt(e){for(const t of e)for(let n=0;nnull},bMe=p.forwardRef(function(t,n){const{render:i,className:r,disabled:s=!1,hiddenUntilFound:o,keepMounted:l,loopFocus:c,onValueChange:u,multiple:d=!1,orientation:f="vertical",value:h,defaultValue:m,style:g,...b}=t,v=p.useMemo(()=>{if(h===void 0)return m??[]},[h,m]),y=p.useRef([]),[x,w]=fMe({controlled:h,default:v,name:"Accordion",state:"value"}),O=Wn((E,R,_)=>{if(d)if(R){const j=x.slice();if(j.push(E),u==null||u(j,_),_.isCanceled)return;w(j)}else{const j=x.filter(T=>T!==E);if(u==null||u(j,_),_.isCanceled)return;w(j)}else{const j=x[0]===E?[]:[E];if(u==null||u(j,_),_.isCanceled)return;w(j)}}),S=p.useMemo(()=>({value:x,disabled:s,orientation:f}),[x,s,f]),k=p.useMemo(()=>({disabled:s,handleValueChange:O,hiddenUntilFound:o??!1,keepMounted:l??!1,state:S,value:x}),[s,O,o,l,S,x]),C=Do("div",t,{state:S,ref:n,props:b,stateAttributesMapping:fMt});return a.jsx(mMe.Provider,{value:k,children:a.jsx(oMt,{elementsRef:y,children:C})})});function hMt(e){const{open:t,defaultOpen:n,onOpenChange:i,disabled:r}=e,[s,o]=fMe({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=KTe(s,!0,!0),d=hg(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=Wn(b=>{const v=!s,y=Gs(Kx,b.nativeEvent);i(v,y),!y.isCanceled&&o(v)});return p.useMemo(()=>({defaultPanelId:d,disabled:r,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:o,setPanelIdState:h,transitionStatus:u}),[d,r,g,l,s,m,c,o,h,u])}const yMe=p.createContext(void 0);function vMe(){const e=p.useContext(yMe);if(e===void 0)throw new Error(du(15));return e}function pMt(e={}){const{guess:t,label:n,metadata:i,textRef:r,index:s}=e,{register:o,unregister:l,subscribeMapChange:c,nextIndexRef:u}=sMt(),d=p.useRef(-1),[f,h]=p.useState(s==null&&t?()=>{if(d.current===-1){const v=u.current;u.current+=1,d.current=v}return d.current}:-1),m=s??f,g=p.useRef(null),b=p.useCallback(v=>{const y=g.current;y&&l(y),g.current=v,v&&o(v,{metadata:i??null,index:s??null,label:n,textRef:r})},[s,o,l,i,n,r]);return Un(()=>{if(s==null)return c(v=>{var x;const y=g.current?(x=v.get(g.current))==null?void 0:x.index:null;y!=null&&h(y)})},[s,c]),{ref:b,index:m}}const xMe=p.createContext(void 0);function dV(){const e=p.useContext(xMe);if(e===void 0)throw new Error(du(9));return e}let fV=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=pN.startingStyle]="startingStyle",e[e.endingStyle=pN.endingStyle]="endingStyle",e}({}),mMt=function(e){return e.panelOpen="data-panel-open",e}({});const gMt={[fV.open]:""},bMt={[fV.closed]:""},yMt={open(e){return e?{[mMt.panelOpen]:""}:null}},vMt={open(e){return e?gMt:bMt}};let xMt=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const hV={...vMt,index:e=>({[xMt.index]:String(e)}),...KI,value:()=>null},wMe=p.forwardRef(function(t,n){const{className:i,disabled:r=!1,onOpenChange:s,render:o,value:l,style:c,...u}=t,{ref:d,index:f}=pMt(),h=Wx(n,d),{disabled:m,handleValueChange:g,state:b,value:v}=gMe(),y=hg(),x=l??y,w=r||m,O=v.indexOf(x)!==-1,S=Wn((D,M)=>{s==null||s(D,M),!M.isCanceled&&g(x,D,M)}),k=hMt({open:O,onOpenChange:S,disabled:w}),C=p.useMemo(()=>({open:k.open,disabled:k.disabled,transitionStatus:k.transitionStatus}),[k.open,k.disabled,k.transitionStatus]),E=p.useMemo(()=>({...k,onOpenChange:S,state:C}),[k,C,S]),R=p.useMemo(()=>({...b,hidden:!O&&!k.mounted,index:f,disabled:w,open:O}),[k.mounted,w,f,O,b]),_=hg(),[j,T]=p.useState(),N=j===null?void 0:j??_,A=p.useMemo(()=>({defaultTriggerId:_,open:O,state:R,setTriggerId:T,triggerId:N}),[_,O,R,T,N]),P=Do("div",t,{state:R,ref:h,props:u,stateAttributesMapping:hV});return a.jsx(yMe.Provider,{value:E,children:a.jsx(xMe.Provider,{value:A,children:P})})}),OMe=p.forwardRef(function(t,n){const{render:i,className:r,style:s,...o}=t,{state:l}=dV();return Do("h3",t,{state:l,ref:n,props:o,stateAttributesMapping:hV})}),kMe=p.forwardRef(function(t,n){const{disabled:i,className:r,id:s,render:o,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=vMe(),g=i||m,{getButtonProps:b,buttonRef:v}=QU({disabled:g,focusableWhenDisabled:!0,native:l}),{defaultTriggerId:y,state:x,setTriggerId:w}=dV(),O=s||void 0,S=O??y;return Un(()=>(w(E=>O??(E===null?void 0:E)),()=>{w(E=>E===O?null:E)}),[O,w]),Do("button",t,{state:x,ref:[n,v],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:yMt})}),dO={height:void 0,width:void 0};function wMt(e){const{externalRef:t,hiddenUntilFound:n,id:i,keepMounted:r,mounted:s,onOpenChange:o,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(dO),b=p.useRef(dO),v=p.useRef(!1),y=p.useRef(l),x=p.useRef(!1),[w,O]=p.useState(!1),S=p.useRef(null),k=Wx(t,f),C=Ol(l),E=UU(f),R=!l&&!s,_=w?"idle":d,j=l&&(y.current||x.current),T=!l&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?b.current:m,N=n&&R&&h.current!=="css-animation",A=Wn((U,I=!0)=>{I&&(b.current=U),g(U)}),P=Wn(()=>{var U;(U=S.current)==null||U.call(S),S.current=null}),D=Wn(U=>{P(),S.current=()=>{S.current=null,U()}}),M=Wn(()=>{l&&s&&h.current==="css-animation"&&(x.current=!0)});Un(()=>{!w||d==="starting"||O(!1)},[w,d]),p.useEffect(()=>()=>{M(),P()},[M,P]),Un(()=>{const U=f.current;if(!U)return;!l&&S.current&&P();const I=OMt(U,j);if(h.current=I,l&&d==="idle"&&y.current&&I==="css-animation"){b.current=z0(U);return}if(l&&d==="starting"){const F=v.current;if(v.current=!1,I==="none"){A(z0(U)),O(!0);return}if(I==="css-transition"){const X=kMt(U);if(A(z0(U)),!F)return X;const ie=i2(U,"transition-duration","0s");return D(ie),O(!0),X}A(z0(U));const W=i2(U,"animation-name","none");if(!F){W();return}const V=i2(U,"animation-duration","0s");W(),D(V),O(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(y.current=!1,x.current=!1,I==="none"){A(dO,!1),c(!1);return}A(z0(U));return}if(d!=="ending")return;if(I==="none"){c(!1);return}const H=z0(U);if(!(H.height>0||H.width>0)){c(!1);return}A(H),I==="css-animation"&&i2(U,"animation-name","none")()},[s,l,P,A,c,D,j,d]),mC({enabled:l&&s&&_==="idle",open:!0,ref:f,onComplete(){l&&A(dO,!1)}}),p.useEffect(()=>{if(l||!s||_!=="ending"||!f.current)return;const I=new AbortController;let H=-1;function K(){C.current||(c(!1),A(dO,!1))}return H=Yl.request(()=>{E(K,I.signal)}),()=>{Yl.cancel(H),I.abort()}},[C,s,l,_,E,A,c]),Un(()=>{const U=f.current;!U||!n||!R||U.setAttribute("hidden","until-found")},[R,n]),p.useEffect(function(){const I=f.current;if(!I)return;function H(K){const F=Gs(vTe,K);o(!0,F),!F.isCanceled&&(v.current=!0,u(!0))}return mi(I,"beforematch",H)},[o,u]);const L=r||n||s||l;return{height:T.height,props:{...N?{[fV.startingStyle]:""}:void 0,hidden:R,id:i},ref:k,shouldPreventOpenAnimation:j,shouldRender:L,transitionStatus:_,width:T.width}}function z0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function OMt(e,t){const n=Fs(e).getComputedStyle(e),i=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&qte(n.animationDuration),r=qte(n.transitionDuration);return i&&r||r?"css-transition":i?"css-animation":"none"}function qte(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function i2(e,t,n){const i=e.style.getPropertyValue(t),r=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(i===""){e.style.removeProperty(t);return}e.style.setProperty(t,i,r)}}function kMt(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(r=>{e.style.setProperty(r,"initial","important")});function n(){Object.entries(t).forEach(([r,s])=>{if(s===""){e.style.removeProperty(r);return}e.style.setProperty(r,s)})}const i=Yl.request(n);return()=>{Yl.cancel(i),n()}}let Wte=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const SMe=p.forwardRef(function(t,n){const{className:i,hiddenUntilFound:r,keepMounted:s,id:o,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=gMe(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,setPanelIdState:x,transitionStatus:w}=vMe(),O=r??d,S=s??f,k=o||void 0,C=o??h;Un(()=>(x(I=>k??(I===null?void 0:I)),()=>{x(I=>I===k?null:I)}),[k,x]);const{height:E,props:R,ref:_,shouldPreventOpenAnimation:j,shouldRender:T,transitionStatus:N,width:A}=wMt({externalRef:n,hiddenUntilFound:O,id:C,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:v,setOpen:y,transitionStatus:w}),{state:P,triggerId:D}=dV(),M={...P,transitionStatus:N},L=lTe(c,M),U=Do("div",{...t,style:void 0},{state:M,ref:_,props:[R,{"aria-labelledby":D,role:"region",style:{[Wte.accordionPanelHeight]:E===void 0?"auto":`${E}px`,[Wte.accordionPanelWidth]:A===void 0?"auto":`${A}px`}},u,L?{style:L}:void 0,j?{style:{animationName:"none"}}:void 0],stateAttributesMapping:hV});return T?U:null}),SMt=(e,t)=>{const n=e.currentTarget,i={x:e.clientX,y:e.clientY},r=EMt(i,n.getBoundingClientRect()),s=CMt(i,r),o=TMt(t.getBoundingClientRect());return _Mt([...s,...o])};function EMt(e,t){const n=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,i,r,s)){case s:return"left";case r:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function CMt(e,t,n=5){const i=[];switch(t){case"top":i.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":i.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":i.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":i.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return i}function TMt(e){const{top:t,right:n,bottom:i,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:i},{x:r,y:i}]}function AMt(e,t){const{x:n,y:i}=e;let r=!1;for(let s=0,o=t.length-1;si!=h>i&&n<(f-u)*(i-d)/(h-d)+u&&(r=!r)}return r}function _Mt(e){const t=e.slice();return t.sort((n,i)=>n.xi.x?1:n.yi.y?1:0),jMt(t)}function jMt(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let i=e.length-1;i>=0;i--){const r=e[i];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const NMt="_Transition_1wdpp_1",RMt="_Popover_1wdpp_3",EMe={Transition:NMt,Popover:RMt},CMe=p.createContext(null),eD=()=>{const e=p.use(CMe);if(!e)throw new Error("Popover components must be wrapped in ");return e},Vm=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:i=150,children:r})=>{const[s,o]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null),f=p.useRef(void 0),h=p.useRef(!1),m=p.useRef(!1),g=e??s,[b,v]=p.useState(!1);rQ(()=>v(!1),b?500:null);const y=lg(t),x=lg(C=>{var E,R;clearTimeout(f.current),g!==C&&(C||(c(!1),n&&h.current&&((E=u.current)==null||E.focus()),h.current=!1),(R=y.current)==null||R.call(y,C),o(C),n&&v(C))}),w=p.useCallback(C=>{x.current(C)},[x]),O=p.useCallback(()=>{f.current=setTimeout(()=>w(!0),i)},[w,i]),S=p.useCallback(()=>{clearTimeout(f.current)},[]);p.useEffect(()=>()=>{clearTimeout(f.current)},[]);const k=p.useMemo(()=>({open:g,setOpen:w,shake:l,setShake:c,showOnHover:n,temporarilyPreventClickToClose:b,onTriggerEnter:O,onTriggerLeave:S,isPointerInTransitRef:m,triggerRef:u,contentRef:d,hoverOpenFocusedWithTab:h}),[g,w,l,c,n,b,h,m,O,S]);return a.jsx(CMe,{value:k,children:a.jsx(v_e,{open:g,onOpenChange:w,modal:!1,children:r})})},IMt=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:i,showOnHover:r,temporarilyPreventClickToClose:s,onTriggerEnter:o,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=eD(),f=p.useRef(!1),h=b=>{!(b.currentTarget.nodeName.toLocaleLowerCase()==="a")&&s&&(b.preventDefault(),b.stopPropagation())},m=b=>{b.pointerType!=="touch"&&!f.current&&!c.current&&(o(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return a.jsx(x_e,{asChild:!0,ref:u,onPointerDown:b=>{h(b),t==null||t(b)},onClick:b=>{h(b),n==null||n(b)},onPointerMove:r?m:void 0,onPointerLeave:r?g:void 0,onFocus:r?()=>i(!0):void 0,onBlur:r?()=>{setTimeout(()=>{var b;(b=d.current)!=null&&b.contains(document.activeElement)||i(!1)},50)}:void 0,children:e})},TMe=({children:e,avoidCollisions:t,width:n,minWidth:i,maxWidth:r,side:s,sideOffset:o=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=eD(),b=v=>{const y=g.current;if(y&&v.target===y&&v.key==="Tab"&&v.shiftKey){v.preventDefault(),v.stopPropagation();const x=HAe(y),w=x[x.length-1];w==null||w.focus()}};return p.useEffect(()=>{const v=g.current;!v||!f||v!=null&&v.contains(document.activeElement)||h||v.focus({preventScroll:!0})},[g,h,f]),a.jsx(O_e,{forceMount:!0,ref:g,className:Ti(EMe.Popover,d),style:zy({"popover-width":n,"popover-min-width":i,"popover-max-width":r}),onCloseAutoFocus:h?Kh:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:o,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Kh,onEscapeKeyDown:Kh,onKeyDown:b,children:e})},PMt=e=>{const{setOpen:t,triggerRef:n,contentRef:i,isPointerInTransitRef:r,hoverOpenFocusedWithTab:s}=eD(),[o,l]=p.useState(null),c=p.useCallback(()=>{l(null),r.current=!1},[r]),u=p.useCallback((d,f)=>{const h=SMt(d,f);l(h),r.current=!0},[r]);return p.useEffect(()=>()=>c(),[c]),p.useEffect(()=>{const d=n.current,f=i.current;if(!d||!f)return;const h=g=>u(g,f),m=g=>u(g,d);return d.addEventListener("pointerleave",h),f.addEventListener("pointerleave",m),()=>{d.removeEventListener("pointerleave",h),f.removeEventListener("pointerleave",m)}},[i,n,u,c]),p.useEffect(()=>{if(!o)return;const d=f=>{const h=n.current,m=i.current,g=f.target,b={x:f.clientX,y:f.clientY},v=(h==null?void 0:h.contains(g))||(m==null?void 0:m.contains(g)),y=!AMt(b,o),x=g.hasAttribute("aria-haspopup");v?c():(y||x)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[o,t,c,n,i]),p.useEffect(()=>{const d=f=>{if(i.current&&f.key==="Tab"&&!f.shiftKey){const[h]=HAe(i.current);h&&(f.preventDefault(),h.focus(),s.current=!0,document.removeEventListener("keydown",d))}};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[i,s]),a.jsx(TMe,{...e})},DMt=e=>{const{open:t,showOnHover:n,setOpen:i}=eD();return SC(t,()=>{i(!1)}),a.jsx(w_e,{forceMount:!0,children:a.jsx(Ww,{enterDuration:600,exitDuration:300,className:EMe.Transition,disableAnimations:!0,children:t&&(n?a.jsx(PMt,{...e},"popover-hover"):a.jsx(TMe,{...e},"popover"))})})};Vm.Trigger=IMt;Vm.Content=DMt;const MMt=["skill_hub","skill_space","knowledge_base","tool"];function AMe(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"m4 6 4 4 4-4"})})}function _Me({label:e}){return a.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>a.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{})]},t))})}function LMt(e,t){return e.kind==="tool"?t("blocks.createAgents.builtinTool"):e.kind==="knowledge_base"?t("blocks.createAgents.knowledgeBase"):e.source.startsWith("skill_hub:")?"Skill Hub":e.source.startsWith("skill_space:")?t("blocks.createAgents.skillCenter"):"Skill"}function J5({label:e,resources:t}){const{t:n}=Ae("conversation");return t.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:e}),a.jsx("div",{className:"create-agent-card__popover-list",children:t.map(i=>a.jsxs("div",{className:"create-agent-card__popover-item",children:[a.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[a.jsx("strong",{children:i.name}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:LMt(i,n)})]}),i.description?a.jsx("p",{children:i.description}):null]},i.ref))})]})}function $Mt({tools:e}){const{t}=Ae("conversation");return e.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:t("blocks.createAgents.selfAuthoredTools")}),a.jsx(bMe,{children:e.map((n,i)=>a.jsxs(wMe,{className:"create-agent-card__python-tool",value:`${n.name}:${i}`,children:[a.jsx(OMe,{className:"create-agent-card__python-tool-header",children:a.jsxs(kMe,{className:"create-agent-card__python-tool-trigger",children:[a.jsxs("span",{children:[a.jsx("strong",{children:n.name}),n.description?a.jsx("small",{children:n.description}):null]}),a.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:t("blocks.createAgents.selfAuthoredTools")}),a.jsx(AMe,{className:"create-agent-card__python-tool-chevron"})]})]})}),a.jsxs(SMe,{className:"create-agent-card__python-tool-panel",children:[n.dependencies.length>0?a.jsx("div",{className:"create-agent-card__python-tool-dependencies",children:t("blocks.createAgents.dependencies",{items:n.dependencies.join(", ")})}):null,a.jsx("pre",{tabIndex:0,"aria-label":t("blocks.createAgents.fullCode",{name:n.name}),children:a.jsx("code",{children:n.code})})]})]},`${n.name}:${i}`))})]})}function FMt({agents:e}){const{t}=Ae("conversation");return e.length===0?null:a.jsxs("section",{className:"create-agent-card__popover-section",children:[a.jsx("h4",{children:t("blocks.createAgents.subAgents")}),a.jsx("div",{className:"create-agent-card__popover-list",children:e.map(n=>a.jsxs("div",{className:"create-agent-card__popover-item",children:[a.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[a.jsx("strong",{children:n.id}),a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:t(`blocks.createAgents.agentTypes.${n.type}`,{defaultValue:n.type})})]}),n.description?a.jsx("p",{children:n.description}):null]},n.id))})]})}function r2({label:e,count:t,icon:n,children:i}){const{t:r}=Ae("conversation"),s=a.jsxs("button",{className:"create-agent-card__resource-metric",type:"button",disabled:t===0,"aria-label":r("blocks.createAgents.itemCount",{label:e,count:t}),children:[n,a.jsx("span",{children:t})]});return t===0?s:a.jsxs(Vm,{showOnHover:!0,hoverOpenDelay:120,children:[a.jsx(Vm.Trigger,{children:s}),a.jsx(Vm.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:i})]})}function BMt({response:e,status:t}){const{t:n}=Ae("conversation"),i=p.useMemo(()=>({tool:n("blocks.createAgents.sourceLabels.tool"),knowledge:n("blocks.createAgents.sourceLabels.knowledge"),skillCenter:n("blocks.createAgents.sourceLabels.skillCenter"),unknownSource:n("blocks.createAgents.sourceLabels.unknown"),unnamedResource:n("blocks.createAgents.unnamedResource"),unnamedAgent:n("blocks.createAgents.unnamedAgent")}),[n]),r=p.useMemo(()=>eMt(e,i),[i,e]),s=p.useMemo(()=>MMt.map(c=>{const u=tMt(r,c);return{value:c,label:n(`blocks.createAgents.categories.${c}`),...u,searchKeywords:[...new Set(u.sources.flatMap(d=>d.searchKeywords))]}}),[r,n]),o=t==="failed",l=o?JP(e):"";return a.jsx("section",{className:"create-agent-tool-card","aria-label":n("blocks.createAgents.collectionAria"),children:t==="running"?a.jsx(_Me,{label:n("blocks.createAgents.retrieving")}):o?a.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[a.jsx("span",{className:"create-agent-card__message-title",children:n("blocks.createAgents.retrievalFailed")}),a.jsx("span",{children:l||n("blocks.createAgents.checkConfig")})]}):a.jsx(bMe,{className:"create-agent-card__accordion",children:s.map(c=>a.jsxs(wMe,{className:"create-agent-card__accordion-item",value:c.value,children:[a.jsx(OMe,{className:"create-agent-card__accordion-header",children:a.jsxs(kMe,{className:"create-agent-card__accordion-trigger",children:[a.jsx("span",{children:c.label}),a.jsxs("span",{className:"create-agent-card__accordion-meta",children:[a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:c.sources.length===0?c.value==="skill_hub"?n("blocks.createAgents.notSearched"):n("blocks.createAgents.notConfigured"):c.resources.length}),a.jsx(AMe,{className:"create-agent-card__accordion-chevron"})]})]})}),a.jsx(SMe,{className:"create-agent-card__accordion-content",children:a.jsxs("div",{className:"create-agent-card__accordion-scroll",role:"region","aria-label":n("blocks.createAgents.resourceList",{label:c.label}),tabIndex:0,children:[c.value==="skill_hub"&&c.searchKeywords.length>0?a.jsxs("div",{className:"create-agent-card__search-keywords",children:[a.jsx("span",{children:n("blocks.createAgents.searchKeywords")}),a.jsx("span",{children:c.searchKeywords.join("、")})]}):null,c.resources.length>0?a.jsx("div",{className:"create-agent-card__resource-list",children:c.resources.map(u=>a.jsx("div",{className:"create-agent-card__resource",children:a.jsxs("div",{className:"create-agent-card__resource-main",children:[a.jsxs("div",{className:"create-agent-card__resource-title",children:[a.jsx("span",{className:"create-agent-card__resource-name",children:u.name}),u.version?a.jsx(Io,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:u.version}):null]}),u.description?a.jsx("p",{children:u.description}):null]})},u.ref))}):a.jsxs("div",{className:"create-agent-card__empty-category",children:[a.jsx("p",{children:c.sources.length===0?c.value==="skill_hub"?n("blocks.createAgents.skillHubSkipped"):n("blocks.createAgents.sourceSkipped",{label:c.label}):n("blocks.createAgents.noResources")}),c.sources.filter(u=>u.message).map(u=>a.jsx("p",{className:"create-agent-card__raw-source-error",children:u.message},u.source))]})]})})]},c.value))},r.collectionId||"collected-resources")})}function UMt({args:e,response:t,status:n}){const{t:i}=Ae("conversation"),r=p.useMemo(()=>({tool:i("blocks.createAgents.sourceLabels.tool"),knowledge:i("blocks.createAgents.sourceLabels.knowledge"),skillCenter:i("blocks.createAgents.sourceLabels.skillCenter"),unknownSource:i("blocks.createAgents.sourceLabels.unknown"),unnamedResource:i("blocks.createAgents.unnamedResource"),unnamedAgent:i("blocks.createAgents.unnamedAgent")}),[i]),s=p.useMemo(()=>dMe(e,t,r),[e,r,t]),o=n==="failed"?JP(t):"";return a.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":i("blocks.createAgents.resultAria"),children:[o?a.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[a.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.creationFailed")}),a.jsx("span",{children:o})]}):null,s.agents.length>0?a.jsx("div",{className:"create-agent-card__agent-grid",children:s.agents.map(l=>{const c=n==="failed"?"failed":l.status,u=l.error||c==="failed"&&o,d=l.builtinTools.length+l.pythonTools.length;return a.jsxs(Sz,{className:`create-agent-card__agent-card${u?" is-error":""}`,children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:l.name}),title:l.name,titleText:l.name,status:a.jsx(Io,{color:"secondary",size:"sm",variant:"soft",children:i(`blocks.createAgents.agentTypes.${l.rootType}`,{defaultValue:l.rootType})})}),l.description?a.jsx(Cz,{children:l.description}):null,u?a.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:u}):null,a.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":i("blocks.createAgents.agentResources",{name:l.name}),children:[a.jsx(r2,{label:i("blocks.createAgents.skill"),count:l.skills.length,icon:a.jsx(j_,{"aria-hidden":"true"}),children:a.jsx(J5,{label:i("blocks.createAgents.skill"),resources:l.skills})}),a.jsx(r2,{label:i("blocks.createAgents.knowledgeBase"),count:l.knowledgeBases.length,icon:a.jsx(tje,{"aria-hidden":"true"}),children:a.jsx(J5,{label:i("blocks.createAgents.knowledgeBase"),resources:l.knowledgeBases})}),a.jsxs(r2,{label:i("blocks.createAgents.toolsLabel"),count:d,icon:a.jsx(Mnt,{"aria-hidden":"true"}),children:[a.jsx(J5,{label:i("blocks.createAgents.builtinTool"),resources:l.builtinTools}),a.jsx($Mt,{tools:l.pythonTools})]}),a.jsx(r2,{label:i("blocks.createAgents.subAgents"),count:l.subAgentCount,icon:a.jsx($nt,{"aria-hidden":"true"}),children:a.jsx(FMt,{agents:l.subAgents})})]})]},l.name)})}):n==="running"?a.jsx(_Me,{label:i("blocks.createAgents.creating")}):a.jsxs("div",{className:"create-agent-card__message",children:[a.jsx("span",{className:"create-agent-card__message-title",children:i("blocks.createAgents.noAgents")}),a.jsx("span",{children:i("blocks.createAgents.noAgentResult")})]})]})}const QMt={web_search:{name:"web_search",runningLabel:"Searching the web",doneLabel:"Web search complete",tone:"search",icon:Bte},link_reader:{name:"link_reader",runningLabel:"Reading webpage",doneLabel:"Webpage read complete",tone:"search",icon:Bte},run_code:{name:"run_code",runningLabel:"Running code in the AgentKit sandbox",doneLabel:"Code execution completed in the AgentKit sandbox",tone:"sandbox",icon:RDt},list_envs:{name:"list_envs",runningLabel:"Checking available environments",doneLabel:"Available environments loaded",tone:"resources",icon:PDt},get_env_manifest:{name:"get_env_manifest",runningLabel:"Loading the environment manifest",doneLabel:"Environment manifest loaded",tone:"knowledge",icon:DDt},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"Running a command in the environment",doneLabel:"Command completed in the environment",tone:"sandbox",icon:Qte},delegate_to_codex_sandbox:{name:"delegate_to_codex_sandbox",runningLabel:"Codex Sandbox is running",doneLabel:"Codex Sandbox completed",failedLabel:"Codex Sandbox failed",tone:"sandbox",icon:Qte},image_generate:{name:"image_generate",runningLabel:"Generating image",doneLabel:"Image generated",tone:"image",icon:TDt},video_generate:{name:"video_generate",runningLabel:"Generating video",doneLabel:"Video generated",tone:"video",icon:aV},ppt_generate:{name:"ppt_generate",runningLabel:"Generating presentation",doneLabel:"Presentation generated",tone:"presentation",icon:ADt},load_memory:{name:"load_memory",runningLabel:"Searching long-term memory",doneLabel:"Memory search complete",tone:"memory",icon:_Dt},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"Searching the knowledge base",doneLabel:"Knowledge base search complete",tone:"knowledge",icon:jDt},load_skill:{name:"load_skill",runningLabel:"Loading skill",doneLabel:"Skill loaded",tone:"skill",icon:NDt},collect_resources:{name:"collect_resources",runningLabel:"Collecting available resources",doneLabel:"Resource collection complete",failedLabel:"Resource collection failed",tone:"resources",icon:IDt,detailRenderer:BMt},create_agents:{name:"create_agents",runningLabel:"Creating and running agents",doneLabel:"Agent creation complete",failedLabel:"Agent creation failed",tone:"agent",icon:Ute,detailRenderer:UMt},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:Ute,detailRenderer:rMt,hideHeader:!0}};function zMt(e){return QMt[e]}function VMt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),a.jsx("path",{d:"M14 3v5h5"}),a.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function HMt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M12 3 19 6v5c0 4.6-2.8 7.8-7 10-4.2-2.2-7-5.4-7-10V6l7-3Z"}),a.jsx("path",{d:"m9 12 2 2 4-4"})]})}function qMt(e,t){const n=new Map(e.map(o=>[o.path,o.content])),i=new Map(t.map(o=>[o.path,o.content])),r=new Set([...n.keys(),...i.keys()]),s=[];for(const o of[...r].sort((l,c)=>l.localeCompare(c))){const l=n.get(o),c=i.get(o);l!==c&&s.push({path:o,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function Mg(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function jMe(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function e3(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function WMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function KMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m9 5 7 7-7 7"})})}function tD(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function GMt(e){return a.jsxs("svg",{...Mg(e),children:[a.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),a.jsx("path",{d:"M12 2.75v2M12 19.25v2M2.75 12h2M19.25 12h2M5.45 5.45l1.4 1.4M17.15 17.15l1.4 1.4M18.55 5.45l-1.4 1.4M6.85 17.15l-1.4 1.4"})]})}function XMt(e){return a.jsx("svg",{...Mg(e),children:a.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function NMe(e){return a.jsxs("svg",{...Mg(e),children:[a.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),a.jsx("path",{d:"M19.25 4.5H15.5"})]})}const YMt=p.lazy(()=>Vu(()=>Promise.resolve().then(()=>a6e),void 0)),ZMt=p.lazy(()=>Vu(()=>import("../chunks/CodeDiffEditor-lkDpEXgT.js"),[])),RMe="veadk-code-workspace-theme";function JMt(e){const t={name:"",children:new Map};for(const n of e){const i=n.path.split("/").filter(Boolean);let r=t;i.forEach((s,o)=>{let l=r.children.get(s);l||(l={name:s,children:new Map},r.children.set(s,l)),o===i.length-1&&(l.path=n.path),r=l})}return t}function eLt(e,t=!1){return[...e.children.values()].sort((n,i)=>{const r=n.children.size>0&&n.path===void 0,s=i.children.size>0&&i.path===void 0;return r!==s?t?r?1:-1:r?-1:1:n.name.localeCompare(i.name)})}function tLt(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(RMe)==="dark"?"dark":"light"}catch{return"light"}}function nLt(e){return e===""?0:e.split(` +`).length}function dw({project:e,open:t,onClose:n,onChange:i,readOnly:r=!1,comparison:s}){var N;const{t:o}=Ae("workspaceTools"),l=p.useId(),c=p.useRef(null),u=p.useRef(null),d=p.useRef(n),[f,h]=p.useState(tLt),m=p.useMemo(()=>s?qMt(s.baseProject.files,e.files):[],[s,e.files]),g=p.useMemo(()=>s?m.map(A=>({path:A.path,content:A.status==="deleted"?A.before:A.after})):e.files,[m,s,e.files]),b=p.useMemo(()=>new Map(m.map(A=>[A.path,A.status])),[m]),[v,y]=p.useState(((N=g[0])==null?void 0:N.path)??null),[x,w]=p.useState(new Set),O=p.useMemo(()=>JMt(g),[g]),S=g.find(A=>A.path===v)??null,k=m.find(A=>A.path===v)??null;if(d.current=n,p.useEffect(()=>{try{window.localStorage.setItem(RMe,f)}catch{}},[f]),p.useEffect(()=>{var M;if(!t)return;const A=document.body.style.overflow,P=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(M=u.current)==null||M.focus();const D=L=>{if(L.key==="Escape"){L.preventDefault(),d.current();return}if(L.key!=="Tab"||!c.current)return;const U=[...c.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(K=>K.offsetParent!==null);if(U.length===0)return;const I=U[0],H=U[U.length-1];L.shiftKey&&document.activeElement===I?(L.preventDefault(),H.focus()):!L.shiftKey&&document.activeElement===H&&(L.preventDefault(),I.focus())};return window.addEventListener("keydown",D),()=>{document.body.style.overflow=A,window.removeEventListener("keydown",D),P!=null&&P.isConnected&&P.focus()}},[t]),p.useEffect(()=>{S||g.length===0||y(g[0].path)},[g,S]),!t)return null;function C(A){w(P=>{const D=new Set(P);return D.has(A)?D.delete(A):D.add(A),D})}function E(A){return A?a.jsx("span",{className:`code-browser-change is-${A}`,children:o(`codeBrowser.change.${A}`)}):null}function R(A,P,D){return eLt(A,P===0).map(M=>{const L=D?`${D}/${M.name}`:M.name;if(!(M.children.size>0&&M.path===void 0)&&M.path){const H=b.get(M.path);return a.jsxs("button",{type:"button",className:`code-browser-file${v===M.path?" is-active":""}`,style:{paddingLeft:`${12+P*16}px`},onClick:()=>y(M.path??null),title:M.path,"aria-pressed":v===M.path,children:[a.jsx(e3,{}),a.jsx("span",{children:M.name}),E(H)]},L)}const I=x.has(L);return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+P*16}px`},onClick:()=>C(L),"aria-expanded":!I,children:[a.jsx(KMt,{className:I?"":"is-open"}),a.jsx(WMt,{}),a.jsx("span",{children:M.name})]}),!I&&R(M,P+1,L)]},L)})}function _(A){!S||s||i({...e,files:e.files.map(P=>P.path===S.path?{...P,content:A}:P)})}const j=f==="light"?"dark":"light",T=o(s?"codeBrowser.noChanges":"codeBrowser.chooseFile");return ri.createPortal(a.jsx("div",{className:"code-browser-backdrop",onMouseDown:A=>{A.target===A.currentTarget&&n()},children:a.jsxs("section",{ref:c,className:`code-browser-dialog is-${f}`,role:"dialog","aria-modal":"true","aria-labelledby":l,children:[a.jsxs("header",{className:"code-browser-head",children:[a.jsxs("div",{className:"code-browser-title-wrap",children:[a.jsx("span",{className:"code-browser-title-icon",children:a.jsx(jMe,{})}),a.jsxs("div",{children:[a.jsx("h2",{id:l,children:o(s?"codeBrowser.compareTitle":"codeBrowser.workspaceTitle")}),a.jsx("p",{title:e.name,children:e.name||o("codeBrowser.projectFallback")})]})]}),a.jsxs("div",{className:"code-browser-head-actions",children:[a.jsx("button",{type:"button",className:"code-browser-icon-button",onClick:()=>h(j),"aria-label":o("codeBrowser.switchTheme"),title:o("codeBrowser.switchThemeTitle",{theme:o(`codeBrowser.themes.${j}`)}),children:f==="light"?a.jsx(XMt,{}):a.jsx(GMt,{})}),a.jsx("button",{ref:u,type:"button",className:"code-browser-icon-button",onClick:n,"aria-label":o("codeBrowser.closeWorkspace"),title:o("codeBrowser.close"),children:a.jsx(tD,{})})]})]}),a.jsxs("div",{className:"code-browser-workspace",children:[a.jsxs("aside",{className:"code-browser-sidebar","aria-label":o(s?"codeBrowser.changedFiles":"codeBrowser.projectFiles"),children:[a.jsxs("div",{className:"code-browser-sidebar-head",children:[a.jsx("span",{children:o(s?"codeBrowser.changes":"codeBrowser.files")}),a.jsx("span",{children:g.length})]}),a.jsx("div",{className:"code-browser-tree",children:g.length>0?R(O,0,""):a.jsx("div",{className:"code-browser-empty",children:T})})]}),a.jsxs("main",{className:"code-browser-main",children:[a.jsx("div",{className:"code-browser-tabs",role:"tablist","aria-label":o("codeBrowser.openFiles"),children:S?a.jsxs("div",{className:"code-browser-tab",role:"tab","aria-selected":"true",children:[a.jsx(e3,{}),a.jsx("span",{children:S.path.split("/").pop()}),E(k==null?void 0:k.status)]}):null}),a.jsxs("div",{className:"code-browser-path",children:[a.jsx(e3,{}),a.jsx("span",{children:(S==null?void 0:S.path)??o("codeBrowser.noFileSelected")})]}),s?a.jsxs("div",{className:"code-browser-diff-labels","aria-label":o("codeBrowser.comparisonDirection"),children:[a.jsx("span",{children:s.baseLabel??o("codeBrowser.before")}),a.jsx("span",{children:s.targetLabel??o("codeBrowser.after")})]}):null,a.jsx("div",{className:"code-browser-editor",children:S?a.jsx(p.Suspense,{fallback:a.jsx("div",{className:"code-browser-empty",children:o("codeBrowser.loadingEditor")}),children:k?a.jsx(ZMt,{before:k.before,after:k.after,path:k.path,theme:f}):a.jsx(YMt,{value:S.content,path:S.path,onChange:_,readOnly:r,theme:f})}):a.jsx("div",{className:"code-browser-empty",children:T})}),a.jsxs("footer",{className:"code-browser-statusbar",children:[a.jsx("span",{children:s?o("codeBrowser.changedFileCount",{count:m.length}):o("codeBrowser.fileCount",{count:e.files.length})}),a.jsx("span",{children:S?o("codeBrowser.lineCount",{count:nLt(S.content)}):"UTF-8"})]})]})]})]})}),document.body)}function iLt({project:e,onChange:t,className:n="",label:i}){const{t:r}=Ae("workspaceTools"),[s,o]=p.useState(!1),l=i??r("codeBrowser.viewSource");return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>o(!0),"aria-label":r("codeBrowser.viewSourceAria"),title:l,children:[a.jsx(jMe,{}),a.jsx("span",{children:l})]}),a.jsx(dw,{project:e,open:s,onClose:()=>o(!1),onChange:t})]})}const IMe="send_a2ui_json_to_client",rLt=28,sLt=3e3;function oLt(e,t,n){let i=t;for(let r=0;r65535?2:1}return i}function aLt(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function PMe(e,t,n,i){const[r,s]=p.useState(()=>t?"":e),o=p.useRef(r),l=p.useRef(e),c=p.useRef(null),u=p.useRef(0),d=p.useRef(n);return l.current=e,d.current=n,p.useEffect(()=>{const f=o.current,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||h||!e.startsWith(f)){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=null,f!==e&&(o.current=e,s(e));return}if(f===e||c.current!==null)return;const m=g=>{const b=l.current,v=o.current;if(!b.startsWith(v)){o.current=b,s(b),c.current=null;return}if(g-u.current{var f;(f=d.current)==null||f.call(d)},[r]),p.useEffect(()=>{r===e&&(i==null||i())},[r,i,e]),p.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),r}function lLt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:a.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function cLt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"m4.5 7 1.8 1.8L9.5 5.5"}),a.jsx("path",{d:"M12 7h7.5"}),a.jsx("path",{d:"m4.5 13 1.8 1.8 3.2-3.3"}),a.jsx("path",{d:"M12 13h7.5"}),a.jsx("path",{d:"M5 19h4"}),a.jsx("path",{d:"M12 19h7.5"})]})}function uLt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5 5v7.25A3.75 3.75 0 0 0 8.75 16H19"}),a.jsx("path",{d:"m15.5 12.5 3.5 3.5-3.5 3.5"})]})}function dLt({activity:e}){const{t}=Ae("conversation"),n=[["Agent Session",e.agentSessionId],["Sandbox Session",e.sandboxSessionId],["Codex Thread",e.threadId]].filter(i=>!!i[1]);return n.length?a.jsx("dl",{className:"codex-sandbox-run__identity","aria-label":t("blocks.sandboxIdentity"),children:n.map(([i,r])=>a.jsxs("div",{children:[a.jsx("dt",{children:i}),a.jsx("dd",{title:r,children:r})]},i))}):null}function fLt(e,t,n){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const i=t.skill_name;if(!(typeof i!="string"||!i.trim()))return n("blocks.useSkill",{name:i.trim()})}function DMe({text:e,done:t,answerStarted:n=!1,streaming:i=!1,onStreamFrame:r}){const{t:s}=Ae("conversation"),[o,l]=p.useState(!(t||n)),c=p.useRef(!1);p.useEffect(()=>{c.current||l(!(t||n))},[n,t]);const u=()=>{c.current=!0,l(g=>!g)},d=e.replace(/\r\n?/g,` `).trimStart().split(/\n{2,}/).map(g=>g.replace(/[^\S\n]*\n[^\S\n]*/g,(b,v,y)=>{const x=y[v-1]??"",w=y[v+b.length]??"";return!x||!w||new RegExp("\\p{Script=Han}","u").test(x)&&new RegExp("\\p{Script=Han}","u").test(w)||/[(\[{“‘/]/u.test(x)||/[),.\]},。!?;:、”’]/u.test(w)?"":" "})).join(` -`),f=PMe(d,!t||i,r),{ref:h,onScroll:m}=oMe(f);return a.jsxs("div",{className:"block-thinking",children:[a.jsxs("button",{className:"think-head",onClick:u,type:"button",children:[a.jsx("span",{className:"think-icon","aria-hidden":"true",children:a.jsx(lV,{className:`thinking-logo ${t?"":"is-active"}`})}),t?a.jsx("span",{className:"think-label think-label--done",children:s("blocks.thinkingDone")}):a.jsx(yn,{className:"think-label",duration:2.4,spread:18,children:s("blocks.thinking")}),a.jsx(bC,{className:`chev ${o?"open":""}`})]}),a.jsx("div",{className:`think-collapse ${o&&f?"open":""}`,children:a.jsx("div",{className:"think-collapse-inner",children:a.jsx("div",{className:"think-body scroll",ref:h,onScroll:m,children:f})})})]})}function dLt({text:e}){return a.jsx("div",{className:"block-progress",role:"status","aria-live":"polite","aria-atomic":"true",children:a.jsxs("div",{className:"think-head progress-head",children:[a.jsx("span",{className:"think-icon","aria-hidden":"true",children:a.jsx(lV,{className:"thinking-logo is-active"})}),a.jsx(yn,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function fLt({value:e,onResolve:t,onResolveComparison:n,onDownload:i,onDeploy:r}){const{t:s,i18n:o}=Ae("conversation"),l=N=>N.split(new RegExp("(?<=[/_-])")).map((A,P)=>a.jsxs(p.Fragment,{children:[A,a.jsx("wbr",{})]},`${P}:${A}`)),[c,u]=p.useState(e.files?e:null),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,b]=p.useState(null),[v,y]=p.useState(null),[x,w]=p.useState(""),[O,S]=p.useState(null),k=new Date(e.validatedAt),C=e.validatedAt?Number.isNaN(k.getTime())?e.validatedAt:k.toLocaleString(o.resolvedLanguage??o.language,{hour12:!1}):s("blocks.justNow");p.useEffect(()=>{if(!O)return;const N=window.setTimeout(()=>S(null),iLt);return()=>window.clearTimeout(N)},[O]);async function E(){if(c)return c;if(!t)throw new Error(s("blocks.sourceUnavailable"));const N=await t(e);return u(N),N}async function R(){y("source"),w(""),S(null);try{await E(),f(!0)}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}async function _(){if(i){y("download"),w(""),S(null);try{await i(e),S({message:s("blocks.downloadStarted")})}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}}async function j(){if(n){y("compare"),w(""),S(null);try{const N=g??await n(e);b(N),m(!0)}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}}async function T(){y("deploy"),w(""),S(null);try{r==null||r(await E())}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:`delivery-card${e.verified?" is-verified":" is-unverified"}`,"aria-label":e.verified?s("blocks.verifiedDelivery"):s("blocks.generatedSource"),children:[a.jsxs("header",{className:"delivery-card-header",children:[a.jsx("span",{className:"delivery-card-icon",children:e.verified?a.jsx(zMt,{}):a.jsx(QMt,{})}),a.jsxs("div",{className:"delivery-card-heading",children:[a.jsx("strong",{children:l(e.agentName)}),a.jsx("span",{children:e.verified?s("blocks.verifiedDelivery"):s("blocks.generatedSource")})]})]}),a.jsxs("dl",{className:"delivery-card-grid",children:[a.jsxs("div",{className:"delivery-card-entry",children:[a.jsx("dt",{children:s("blocks.entryPoint")}),a.jsx("dd",{children:a.jsx("code",{children:l(e.entryPoint)})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("blocks.fileCount")}),a.jsx("dd",{children:e.fileCount})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("blocks.size")}),a.jsxs("dd",{children:[(e.artifactSize/1024).toFixed(1)," KiB"]})]}),a.jsxs("div",{className:"delivery-card-time",children:[a.jsx("dt",{children:e.verified?s("blocks.validationTime"):s("blocks.generationTime")}),a.jsx("dd",{children:C})]})]}),a.jsxs("p",{className:"delivery-card-gates",children:[e.verified?s("blocks.checksPassed",{count:e.gateSummary.length}):s("blocks.sourceReady")," ","· ",a.jsx("code",{children:e.artifactSha256.slice(0,12)})]}),e.verified?null:a.jsx("p",{className:"delivery-card-guidance",children:s("blocks.sourceGuidance")}),a.jsxs("div",{className:"delivery-card-actions",children:[a.jsxs("div",{className:"delivery-card-secondary-actions",children:[a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void R(),disabled:!t||v!==null,children:[v==="source"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s("blocks.viewSource")]}),e.projectId&&e.versionId&&e.parentVersionId?a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void j(),disabled:!n||v!==null,children:[v==="compare"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s(v==="compare"?"blocks.preparing":"blocks.viewChanges")]}):null,a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void _(),disabled:!i||v!==null,"aria-busy":v==="download",children:[v==="download"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s(v==="download"?"blocks.preparing":"blocks.downloadSource")]})]}),a.jsxs("button",{type:"button",className:"delivery-card-primary",onClick:()=>void T(),disabled:!e.deployable||!r||!t||v!==null,title:e.deployable?s("blocks.manualDeploy"):s("blocks.sourceNotReady"),children:[v==="deploy"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s("blocks.deployAgent")]})]}),x?a.jsx("p",{className:"delivery-card-error",role:"alert",children:x}):null,O?a.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:O.message}):null]}),a.jsx(dw,{project:{name:e.agentName,files:(c==null?void 0:c.files)??[]},open:d,onClose:()=>f(!1),onChange:()=>{},readOnly:!0}),a.jsx(dw,{project:{name:(g==null?void 0:g.target.agentName)??e.agentName,files:(g==null?void 0:g.target.files)??[]},comparison:g?{baseProject:{name:g.base.agentName,files:g.base.files??[]},baseLabel:s("blocks.beforeOptimization"),targetLabel:s("blocks.afterOptimization")}:void 0,open:h,onClose:()=>m(!1),onChange:()=>{},readOnly:!0})]})}function MMe(){return a.jsx(DMe,{text:"",done:!1})}const hLt=p.memo(function({text:t,streaming:n,onStreamFrame:i,onStreamComplete:r}){const s=PMe(t,n,i,r);return s?a.jsx("div",{className:"bubble",children:a.jsx(Yu,{text:s,streaming:n})}):null});function pLt({title:e,summary:t,items:n,done:i}){const{t:r}=Ae("conversation"),[s,o]=p.useState(!i),l=p.useRef(!1);p.useEffect(()=>{l.current||o(!i)},[i]);const c=()=>{l.current=!0,o(u=>!u)};return a.jsxs("div",{className:"block-plan",children:[a.jsxs("button",{className:"plan-head",type:"button",onClick:c,"aria-expanded":n.length>0?s:void 0,disabled:n.length===0,children:[a.jsx("span",{className:"plan-icon","aria-hidden":"true",children:a.jsx(aLt,{})}),i?a.jsx("span",{className:"plan-title",children:e}):a.jsx(yn,{className:"plan-title",duration:2.2,spread:15,children:e}),t?a.jsx("span",{className:"plan-summary",children:t}):null,n.length>0?a.jsx(r1,{className:`plan-chevron${s?" is-open":""}`}):null]}),a.jsx("div",{className:`think-collapse ${s&&n.length>0?"open":""}`,children:a.jsx("div",{className:"think-collapse-inner",children:n.length>0?a.jsx("ol",{className:"plan-items",children:n.map((u,d)=>a.jsxs("li",{"data-status":u.status,children:[a.jsx("span",{className:"plan-item-marker","aria-hidden":"true"}),a.jsx("span",{className:"plan-item-text",children:u.text}),a.jsx("small",{children:r(`blocks.planStatuses.${u.status}`)})]},`${d}:${u.text}`))}):null})})]})}function mLt(e){if(!e||typeof e!="object")return[];const t=e,n=t.result;let i=[];if(Array.isArray(t.studio_artifacts))i=t.studio_artifacts;else if(n&&typeof n=="object"){const r=n.studio_artifacts;Array.isArray(r)&&(i=r)}return i.flatMap(r=>{if(!r||typeof r!="object")return[];const s=r;return typeof s.name=="string"&&typeof s.contentUrl=="string"?[{name:s.name,contentUrl:s.contentUrl}]:[]})}function gLt({name:e,args:t,response:n,done:i,status:r,defaultOpen:s=!1,retrying:o=!1,codexActivity:l,native:c=!1,progressText:u,onBranchSelect:d,onAction:f}){const{t:h}=Ae("conversation"),g=e==="create_agents"&&i&&eMt(t,n)?"failed":r??(i?"completed":"running"),b=e==="create_agents"&&g==="failed"&&o,v=UMt(e),y=v==null?void 0:v.detailRenderer,x=(v==null?void 0:v.hideHeader)===!0,w=x||s||!!y||!!l,[O,S]=p.useState(w),k=p.useRef(!1);p.useEffect(()=>{!k.current&&w&&S(!0)},[w]);const C=()=>{k.current=!0,S(T=>!T)},E=e===IMe?h("blocks.renderUi"):e,R=mLt(n),_=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),j=!c&&_&&_.length>2e3?`${_.slice(0,2e3)} -${h("blocks.truncated")}`:_;return a.jsxs(dr.div,{className:`block-tool${v?" block-tool--builtin":""}`,"data-status":g,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[v&&!x?a.jsx(KDt,{definition:v,label:b?h("blocks.agentAdjusting"):g==="failed"?h(`blocks.tools.${v.name}.failed`,{defaultValue:v.failedLabel??v.doneLabel}):uLt(e,t,h),done:i,open:O,onToggle:C}):v?null:a.jsxs("button",{className:"tool-head tool-head--generic",onClick:C,type:"button","aria-expanded":O,children:[a.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:c?a.jsx(XP,{kind:"tool"}):a.jsx(oLt,{})}),i?a.jsx("span",{className:"tool-name",children:E}):a.jsx(yn,{className:"tool-name",duration:2.2,spread:15,children:E}),c&&g==="failed"&&a.jsx("span",{className:"development-tool-failure",children:a.jsx(Tx,{ns:"adk",i18nKey:"developmentRuns.toolFailed"})}),a.jsx(r1,{className:`tool-chevron${O?" is-open":""}`})]}),a.jsx("div",{className:`${x?"":"think-collapse "}${O?"open":""}`,children:a.jsxs("div",{className:"think-collapse-inner",children:[l?a.jsxs("section",{className:"codex-sandbox-run","aria-label":h("blocks.sandboxDetails"),children:[a.jsxs("div",{className:"codex-sandbox-run__label",children:[a.jsxs("span",{className:"codex-sandbox-run__badge",children:[a.jsx(lLt,{}),a.jsx("span",{children:"Codex Sandbox"})]}),a.jsx("span",{className:"codex-sandbox-run__title",children:l.title})]}),a.jsx(cLt,{activity:l}),a.jsx("div",{className:"codex-sandbox-run__stream",children:l.items.length>0?a.jsx(Sy,{blocks:l.items.map(T=>T.block),streaming:!i,onAction:f}):a.jsx(yn,{className:"codex-sandbox-run__empty",children:h("blocks.waitingCodex")})})]}):null,y?a.jsx(y,{args:t,response:n,status:g,onBranchSelect:d}):l?null:a.jsxs("div",{className:"tool-detail",children:[u&&a.jsx("div",{className:"development-tool-meta",children:u}),t!=null&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.arguments")}),a.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),j!=null&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.result")}),a.jsx("pre",{className:"tool-args tool-result",children:j})]}),R.length>0&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.artifacts")}),a.jsx("div",{className:"studio-tool-artifacts",children:R.map(T=>a.jsx("a",{href:T.contentUrl,download:T.name,children:h("blocks.downloadNamed",{name:T.name})},`${T.contentUrl}:${T.name}`))})]})]})]})})]})}function bLt({block:e,onDownload:t,onPreview:n}){const{t:i}=Ae("conversation"),[r,s]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(null);p.useEffect(()=>()=>{c&&URL.revokeObjectURL(c.url)},[c]);const d=()=>u(null),f=async(g,b)=>{if(t){s(`download:${g}`),l("");try{await t(g,b)}catch(v){l(v instanceof Error?v.message:String(v))}finally{s("")}}},h=async(g,b,v)=>{if(n){s(`preview:${v}`),l("");try{const y=await n(g,b);u({name:v,url:y})}catch(y){l(y instanceof Error?y.message:String(y))}finally{s("")}}},m=e.files.filter(g=>!g.filename.endsWith(".preview.webp"));return a.jsxs("div",{className:"artifact-list",children:[m.map(g=>{const b=`${g.filename.replace(/\.pptx$/i,"")}.preview.webp`,v=e.files.find(y=>y.filename===b);return a.jsxs("div",{className:"artifact-card",children:[a.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:a.jsx(JU,{})}),a.jsxs("span",{className:"artifact-card__copy",children:[a.jsx("span",{className:"artifact-card__name",children:g.filename}),a.jsx("span",{className:"artifact-card__hint",children:i("blocks.powerpoint")})]}),a.jsxs("span",{className:"artifact-card__actions",children:[v&&a.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void h(v.filename,v.version,g.filename),children:[r===`preview:${g.filename}`?a.jsx(Ei,{className:"spin"}):a.jsx(Ynt,{}),i("blocks.preview")]}),a.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void f(g.filename,g.version),children:[r===`download:${g.filename}`?a.jsx(Ei,{className:"spin"}):a.jsx(eP,{}),i("blocks.download")]})]})]},`${g.filename}:${g.version}`)}),o&&a.jsx("div",{className:"artifact-card__error",children:o}),c&&a.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":i("blocks.previewDialog",{name:c.name}),children:[a.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":i("blocks.closePreview"),onClick:d}),a.jsxs("div",{className:"artifact-preview__panel",children:[a.jsxs("div",{className:"artifact-preview__header",children:[a.jsx("span",{children:c.name}),a.jsx("button",{type:"button","aria-label":i("blocks.closePreview"),onClick:d,children:a.jsx(xa,{})})]}),a.jsx("div",{className:"artifact-preview__canvas",children:a.jsx("img",{src:c.url,alt:i("blocks.slidePreview",{name:c.name})})})]})]})]})}function yLt({block:e,onAuth:t}){const{t:n}=Ae("conversation"),[i,r]=p.useState(e.done?"done":"idle"),[s,o]=p.useState(""),l=e.label||n("blocks.mcpToolset"),c=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),u=async()=>{if(t){o(""),r("authorizing");try{await t(e),r("done")}catch(f){o(f instanceof Error?f.message:String(f)),r("idle")}}};return e.done||i==="done"?a.jsxs(dr.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[a.jsx(MY,{className:"auth-card-icon auth-card-icon--done"}),a.jsx("span",{children:n("blocks.authorized",{tool:l})})]}):a.jsxs(dr.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[a.jsxs("div",{className:"auth-card-head",children:[a.jsx(MY,{className:"auth-card-icon"}),a.jsx("span",{className:"auth-card-title",children:n("blocks.authorizationRequired",{tool:l})})]}),a.jsxs("p",{className:"auth-card-desc",children:[a.jsx(Tx,{t:n,i18nKey:"blocks.oauthDescription",values:{tool:l},components:{code:a.jsx("code",{className:"auth-card-code"})}}),c&&a.jsxs(a.Fragment,{children:[" ",a.jsx(Tx,{t:n,i18nKey:"blocks.oauthProvider",values:{provider:c},components:{code:a.jsx("code",{className:"auth-card-code"})}})," "]}),n("blocks.oauthContinue")]}),a.jsx("button",{className:"auth-card-btn",onClick:u,disabled:i==="authorizing"||!e.authUri,children:i==="authorizing"?a.jsxs(a.Fragment,{children:[a.jsx(Ei,{className:"cw-i spin"})," ",n("blocks.waitingAuthorization")]}):a.jsx(a.Fragment,{children:n("blocks.authorize")})}),!e.authUri&&a.jsx("div",{className:"auth-card-err",children:n("blocks.missingAuthorizationUrl")}),s&&a.jsx("div",{className:"auth-card-err",children:s})]})}function Sy({groupProcess:e=!1,liveStatus:t,blocks:n,appName:i="",streaming:r=!1,onStreamFrame:s,onStreamComplete:o,onAction:l,onAuth:c,onArtifactDownload:u,onArtifactPreview:d,onResolveDelivery:f,onResolveDeliveryComparison:h,onDownloadDelivery:m,onDeployDelivery:g,onBranchSelect:b}){if(e)return a.jsx(MDt,{blocks:n,active:r,status:t,render:y=>a.jsx(Sy,{blocks:y,appName:i,streaming:r,onStreamFrame:s,onStreamComplete:o,onAction:l,onAuth:c,onArtifactDownload:u,onArtifactPreview:d,onResolveDelivery:f,onResolveDeliveryComparison:h,onDownloadDelivery:m,onDeployDelivery:g,onBranchSelect:b})});const v=n.reduce((y,x,w)=>x.kind==="text"?w:y,-1);return a.jsx(a.Fragment,{children:n.map((y,x)=>{switch(y.kind){case"turn-summary":return a.jsx(PDt,{value:y.value},y.id||x);case"diff":return a.jsxs("details",{className:"development-diff",children:[a.jsxs("summary",{children:[a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:"diff"})}),a.jsx("span",{children:a.jsx(Tx,{ns:"adk",i18nKey:"developmentRuns.diff"})}),a.jsx(r1,{className:"tool-chevron"})]}),a.jsx("pre",{children:y.text})]},y.id??x);case"progress":return a.jsx(dLt,{text:y.text},"build-progress");case"thinking":{const w=n.slice(x+1).some(O=>O.kind==="text"&&!!O.text.trim());return a.jsx(DMe,{text:y.text,done:y.done,answerStarted:w,streaming:r,onStreamFrame:s},y.id??x)}case"text":{const w=y.text.replace(/^\s+/,"");return w?a.jsx(hLt,{text:w,streaming:r,onStreamFrame:s,onStreamComplete:x===v?o:void 0},y.id??x):null}case"plan":return a.jsx(pLt,{title:y.title,summary:y.summary,items:y.items,done:y.done},y.id??x);case"attachment":return a.jsx(ZP,{appName:i,items:y.files},y.id??x);case"artifact":return a.jsx(bLt,{block:y,onDownload:u,onPreview:d},y.id??x);case"delivery":return a.jsx(fLt,{value:y.value,onResolve:f,onResolveComparison:h,onDownload:m,onDeploy:g},y.id??x);case"invocation":return a.jsx(YP,{value:y.value},y.id??x);case"tool":{if(y.name===IMe&&y.done)return null;const w=y.name==="create_agents"&&n.slice(x+1).some(O=>O.kind==="tool"&&O.name==="create_agents");return a.jsx(gLt,{name:y.itemType?DCe(y):y.name,native:!!y.itemType,progressText:y.progressText,args:y.args,response:y.response,done:y.done,status:y.status,defaultOpen:y.defaultOpen,retrying:y.name==="create_agents"&&(r||w),codexActivity:y.codexActivity,onBranchSelect:b,onAction:l},y.id??x)}case"agent-transfer":return null;case"auth":return a.jsx(yLt,{block:y,onAuth:c},y.id??x);case"a2ui":return sMe(y.messages).filter(w=>w.components[w.rootId]).map(w=>a.jsx(dr.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:a.jsx(HDt,{surface:w,onAction:l})},`${x}-${w.surfaceId}`));default:return null}})})}const vLt=()=>{};function xLt(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error(Jt("conversation.unsupportedActivity"))}function wLt({activities:e}){const{t}=Ae("skills"),n=p.useMemo(()=>e.filter(i=>i.kind!=="status").map(xLt),[e]);return n.length===0?null:a.jsx("div",{className:"skill-conversation","aria-label":t("conversation.ariaLabel"),"aria-live":"polite",children:a.jsx(Sy,{blocks:n,onAction:vLt})})}function Kte(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m7 9 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function Y_({label:e,value:t,options:n,onChange:i,disabled:r=!1,allowCustom:s=!1,required:o=!1,placeholder:l,error:c}){const{t:u}=Ae("skills"),d=l??u("configSelect.placeholder"),f=p.useId(),h=p.useId(),m=p.useId(),g=p.useRef(null),b=p.useRef(null),v=p.useRef(null),y=p.useRef(null),x=p.useRef([]),w=n.findIndex(P=>P.value===t),O=t.trim().toLocaleLowerCase(),S=s&&O?n.filter(P=>P.value.toLocaleLowerCase().includes(O)||P.label.toLocaleLowerCase().includes(O)):n,[k,C]=p.useState(!1),[E,R]=p.useState(Math.max(0,w)),_=w>=0?n[w]:void 0,j=r||!s&&n.length===0,T=(P=!1)=>{C(!1),P&&window.requestAnimationFrame(()=>{var D,M;return s?(D=v.current)==null?void 0:D.focus():(M=b.current)==null?void 0:M.focus()})},N=P=>{j||S.length!==0&&(R(Math.min(Math.max(P,0),S.length-1)),C(!0))};p.useEffect(()=>{if(!k)return;const P=y.current,D=s?void 0:window.requestAnimationFrame(()=>{var I;(I=x.current[E])==null||I.focus()}),M=I=>{if(!P)return;const H=P.scrollTop<=0,K=P.scrollTop+P.clientHeight>=P.scrollHeight-1;(P.scrollHeight<=P.clientHeight||I.deltaY<0&&H||I.deltaY>0&&K)&&I.preventDefault(),I.stopPropagation()},L=I=>{var H;I.target instanceof Node&&!((H=g.current)!=null&&H.contains(I.target))&&T()},U=I=>{I.key==="Escape"&&T(!0)};return P==null||P.addEventListener("wheel",M,{passive:!1}),window.addEventListener("pointerdown",L),window.addEventListener("keydown",U),()=>{D!==void 0&&window.cancelAnimationFrame(D),P==null||P.removeEventListener("wheel",M),window.removeEventListener("pointerdown",L),window.removeEventListener("keydown",U)}},[E,s,k]);const A=P=>{var M;if(S.length===0)return;const D=(P+S.length)%S.length;R(D),(M=x.current[D])==null||M.focus()};return a.jsxs("div",{ref:g,className:`skill-config-select${k?" is-open":""}`,onBlur:P=>{var D;(!P.relatedTarget||!((D=g.current)!=null&&D.contains(P.relatedTarget)))&&T()},children:[a.jsxs("span",{id:h,className:"skill-config-select__label",children:[e,o?a.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"}):null]}),s?a.jsxs("div",{className:`skill-config-select__trigger is-editable${r?" is-disabled":""}`,"aria-expanded":k,children:[a.jsx("input",{ref:v,value:t,disabled:r,role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":k?f:void 0,"aria-labelledby":h,"aria-required":o,"aria-invalid":!!c,"aria-describedby":c?m:void 0,placeholder:d,onChange:P=>{i(P.target.value),R(0),n.length>0&&C(!0)},onClick:()=>{!k&&S.length>0&&N(0)},onKeyDown:P=>{var D,M;if(!(P.nativeEvent.isComposing||P.keyCode===229))if(P.key==="ArrowDown")P.preventDefault(),k?(D=x.current[E])==null||D.focus():N(0);else if(P.key==="ArrowUp")P.preventDefault(),k?(M=x.current[S.length-1])==null||M.focus():N(S.length-1);else if(P.key==="Enter"&&k){P.preventDefault();const L=S[E];L&&i(L.value),T()}else P.key==="Escape"&&(P.preventDefault(),T())}}),a.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:r||n.length===0,"aria-label":u(k?"configSelect.collapseOptions":"configSelect.expandOptions"),onClick:()=>{k?T():N(0)},children:a.jsx(Kte,{})})]}):a.jsxs("button",{ref:b,type:"button",className:"skill-config-select__trigger",disabled:j,"aria-haspopup":"listbox","aria-expanded":k,"aria-controls":k?f:void 0,"aria-labelledby":h,"aria-required":o,onClick:()=>{k?T():N(w>=0?w:0)},onKeyDown:P=>{P.key==="ArrowDown"?(P.preventDefault(),N(w>=0?w:0)):P.key==="ArrowUp"&&(P.preventDefault(),N(w>=0?w:n.length-1))},children:[a.jsx("span",{className:_?void 0:"is-placeholder",title:_==null?void 0:_.label,children:(_==null?void 0:_.label)||(n.length===0?u("configSelect.noOptions"):d)}),a.jsx(Kte,{})]}),k?a.jsxs("div",{ref:y,id:f,className:"skill-config-select__menu",role:"listbox","aria-labelledby":h,children:[S.length===0?a.jsx("div",{className:"skill-config-select__empty",role:"status",children:u("configSelect.noMatches")}):null,S.map((P,D)=>{const M=P.value===t;return a.jsx("button",{ref:L=>{x.current[D]=L},type:"button",role:"option","aria-selected":M,tabIndex:D===E?0:-1,className:`skill-config-select__option${M?" is-selected":""}`,title:P.label,onFocus:()=>R(D),onClick:()=>{i(P.value),T(!0)},onKeyDown:L=>{L.key==="Enter"||L.key===" "?(L.preventDefault(),i(P.value),T(!0)):L.key==="ArrowDown"?(L.preventDefault(),A(D+1)):L.key==="ArrowUp"?(L.preventDefault(),A(D-1)):L.key==="Home"?(L.preventDefault(),A(0)):L.key==="End"&&(L.preventDefault(),A(n.length-1))},children:P.label},P.value)})]}):null,c?a.jsx("span",{id:m,className:"skill-config-select__error",role:"alert",children:c}):null]})}function vr(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function ms({error:e}){var s,o,l,c,u;const{t}=Ae("skills"),n=e,i=(o=(s=n.originalError)==null?void 0:s.message)==null?void 0:o.trim(),r=[typeof n.status=="number"?`HTTP ${n.status}${n.statusText?` ${n.statusText}`:""}`:"",n.code?t("errorDetails.code",{code:n.code}):"",(l=n.originalError)!=null&&l.type?t("errorDetails.type",{type:n.originalError.type}):"",(c=n.originalError)!=null&&c.repr&&n.originalError.repr!==i?t("errorDetails.representation",{value:n.originalError.repr}):"",(u=n.rawResponse)!=null&&u.trim()?t("errorDetails.rawResponse",{value:n.rawResponse.trim()}):""].filter(Boolean);return a.jsxs("div",{className:"skill-error-details",children:[a.jsx("div",{className:"skill-error-details__summary",children:e.message}),i?a.jsx("div",{className:"skill-error-details__original",children:t("errorDetails.original",{message:i})}):null,r.length>0?a.jsxs("details",{children:[a.jsx("summary",{children:t("errorDetails.details")}),a.jsx("pre",{children:r.join(` -`)})]}):null]})}const pV=Symbol.for("yaml.alias"),k8=Symbol.for("yaml.document"),Hm=Symbol.for("yaml.map"),LMe=Symbol.for("yaml.pair"),Lf=Symbol.for("yaml.scalar"),s1=Symbol.for("yaml.seq"),Zu=Symbol.for("yaml.node.type"),o1=e=>!!e&&typeof e=="object"&&e[Zu]===pV,XC=e=>!!e&&typeof e=="object"&&e[Zu]===k8,YC=e=>!!e&&typeof e=="object"&&e[Zu]===Hm,bo=e=>!!e&&typeof e=="object"&&e[Zu]===LMe,ns=e=>!!e&&typeof e=="object"&&e[Zu]===Lf,ZC=e=>!!e&&typeof e=="object"&&e[Zu]===s1;function po(e){if(e&&typeof e=="object")switch(e[Zu]){case Hm:case s1:return!0}return!1}function go(e){if(e&&typeof e=="object")switch(e[Zu]){case pV:case Hm:case Lf:case s1:return!0}return!1}const $Me=e=>(ns(e)||po(e))&&!!e.anchor,vb=Symbol("break visit"),OLt=Symbol("skip children"),Yk=Symbol("remove node");function a1(e,t){const n=kLt(t);XC(e)?Mv(null,e.contents,n,Object.freeze([e]))===Yk&&(e.contents=null):Mv(null,e,n,Object.freeze([]))}a1.BREAK=vb;a1.SKIP=OLt;a1.REMOVE=Yk;function Mv(e,t,n,i){const r=SLt(e,t,n,i);if(go(r)||bo(r))return ELt(e,i,r),Mv(e,r,n,i);if(typeof r!="symbol"){if(po(t)){i=Object.freeze(i.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>CLt[t]);class xl{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},xl.defaultYaml,t),this.tags=Object.assign({},xl.defaultTags,n)}clone(){const t=new xl(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new xl(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:xl.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},xl.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:xl.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},xl.defaultTags),this.atNextDocument=!1);const i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;const[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);const s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+TLt(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags);let r;if(t&&i.length>0&&go(t.contents)){const s={};a1(t.contents,(o,l)=>{go(l)&&l.tag&&(s[l.tag]=!0)}),r=Object.keys(s)}else r=[];for(const[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!t||r.some(l=>l.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(` -`)}}xl.defaultYaml={explicit:!1,version:"1.2"};xl.defaultTags={"!!":"tag:yaml.org,2002:"};function FMe(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function BMe(e){const t=new Set;return a1(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function UMe(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function ALt(e,t){const n=[],i=new Map;let r=null;return{onAnchor:s=>{n.push(s),r??(r=BMe(e));const o=UMe(t,r);return r.add(o),o},setAnchors:()=>{for(const s of n){const o=i.get(s);if(typeof o=="object"&&o.anchor&&(ns(o.node)||po(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:i}}function Lv(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;rqu(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!$Me(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=s=>{i.res=s,delete n.onCreate};const r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class mV{constructor(t){Object.defineProperty(this,Zu,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!XC(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=qu(this,"",o);if(typeof r=="function")for(const{count:c,res:u}of o.anchors.values())r(u,c);return typeof s=="function"?Lv(s,{"":l},"",l):l}}let gV=class extends mV{constructor(t){super(pV),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let i;n!=null&&n.aliasResolveCache?i=n.aliasResolveCache:(i=[],a1(t,{Node:(s,o)=>{(o1(o)||$Me(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(const s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(t,n){if(!n)return{source:this.source};const{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=i.get(o);if(l||(qu(o,null,n),l=i.get(o)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Z_(r,o,i)),l.count*l.aliasCount>s)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,i){const r=`*${this.source}`;if(t){if(FMe(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${r} `}return r}};function Z_(e,t,n){if(o1(t)){const i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(po(t)){let i=0;for(const r of t.items){const s=Z_(e,r,n);s>i&&(i=s)}return i}else if(bo(t)){const i=Z_(e,t.key,n),r=Z_(e,t.value,n);return Math.max(i,r)}return 1}const QMe=e=>!e||typeof e!="function"&&typeof e!="object";class ii extends mV{constructor(t){super(Lf),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:qu(this.value,t,n)}toString(){return String(this.value)}}ii.BLOCK_FOLDED="BLOCK_FOLDED";ii.BLOCK_LITERAL="BLOCK_LITERAL";ii.PLAIN="PLAIN";ii.QUOTE_DOUBLE="QUOTE_DOUBLE";ii.QUOTE_SINGLE="QUOTE_SINGLE";const _Lt="tag:yaml.org,2002:";function jLt(e,t,n){if(t){const i=n.filter(s=>s.tag===t),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>{var r;return((r=i.identify)==null?void 0:r.call(i,e))&&!i.format})}function pE(e,t,n){var f,h,m;if(XC(e)&&(e=e.contents),go(e))return e;if(bo(e)){const g=(h=(f=n.schema[Hm]).createNode)==null?void 0:h.call(f,n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:r,onTagObj:s,schema:o,sourceObjects:l}=n;let c;if(i&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=r(e)),new gV(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=_Lt+t.slice(2));let u=jLt(e,t,o.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const g=new ii(e);return c&&(c.node=g),g}u=e instanceof Map?o[Hm]:Symbol.iterator in Object(e)?o[s1]:o[Hm]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((m=u==null?void 0:u.nodeClass)==null?void 0:m.from)=="function"?u.nodeClass.from(n.schema,e,n):new ii(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function JN(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){const s=t[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return pE(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const ek=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class zMe extends mV{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>go(i)||bo(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(ek(t))this.add(n);else{const[i,...r]=t,s=this.get(i,!0);if(po(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,JN(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){const[n,...i]=t;if(i.length===0)return this.delete(n);const r=this.get(n,!0);if(po(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){const[i,...r]=t,s=this.get(i,!0);return r.length===0?!n&&ns(s)?s.value:s:po(s)?s.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!bo(n))return!1;const i=n.value;return i==null||t&&ns(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){const[n,...i]=t;if(i.length===0)return this.has(n);const r=this.get(n,!0);return po(r)?r.hasIn(i):!1}setIn(t,n){const[i,...r]=t;if(r.length===0)this.set(i,n);else{const s=this.get(i,!0);if(po(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,JN(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}}const NLt=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Fh(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Mb=(e,t,n)=>e.endsWith(` +`),f=PMe(d,!t||i,r),{ref:h,onScroll:m}=oMe(f);return a.jsxs("div",{className:"block-thinking",children:[a.jsxs("button",{className:"think-head",onClick:u,type:"button",children:[a.jsx("span",{className:"think-icon","aria-hidden":"true",children:a.jsx(lV,{className:`thinking-logo ${t?"":"is-active"}`})}),t?a.jsx("span",{className:"think-label think-label--done",children:s("blocks.thinkingDone")}):a.jsx(yn,{className:"think-label",duration:2.4,spread:18,children:s("blocks.thinking")}),a.jsx(bC,{className:`chev ${o?"open":""}`})]}),a.jsx("div",{className:`think-collapse ${o&&f?"open":""}`,children:a.jsx("div",{className:"think-collapse-inner",children:a.jsx("div",{className:"think-body scroll",ref:h,onScroll:m,children:f})})})]})}function hLt({text:e}){return a.jsx("div",{className:"block-progress",role:"status","aria-live":"polite","aria-atomic":"true",children:a.jsxs("div",{className:"think-head progress-head",children:[a.jsx("span",{className:"think-icon","aria-hidden":"true",children:a.jsx(lV,{className:"thinking-logo is-active"})}),a.jsx(yn,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function pLt({value:e,onResolve:t,onResolveComparison:n,onDownload:i,onDeploy:r}){const{t:s,i18n:o}=Ae("conversation"),l=N=>N.split(new RegExp("(?<=[/_-])")).map((A,P)=>a.jsxs(p.Fragment,{children:[A,a.jsx("wbr",{})]},`${P}:${A}`)),[c,u]=p.useState(e.files?e:null),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,b]=p.useState(null),[v,y]=p.useState(null),[x,w]=p.useState(""),[O,S]=p.useState(null),k=new Date(e.validatedAt),C=e.validatedAt?Number.isNaN(k.getTime())?e.validatedAt:k.toLocaleString(o.resolvedLanguage??o.language,{hour12:!1}):s("blocks.justNow");p.useEffect(()=>{if(!O)return;const N=window.setTimeout(()=>S(null),sLt);return()=>window.clearTimeout(N)},[O]);async function E(){if(c)return c;if(!t)throw new Error(s("blocks.sourceUnavailable"));const N=await t(e);return u(N),N}async function R(){y("source"),w(""),S(null);try{await E(),f(!0)}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}async function _(){if(i){y("download"),w(""),S(null);try{await i(e),S({message:s("blocks.downloadStarted")})}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}}async function j(){if(n){y("compare"),w(""),S(null);try{const N=g??await n(e);b(N),m(!0)}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}}async function T(){y("deploy"),w(""),S(null);try{r==null||r(await E())}catch(N){w(N instanceof Error?N.message:String(N))}finally{y(null)}}return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:`delivery-card${e.verified?" is-verified":" is-unverified"}`,"aria-label":e.verified?s("blocks.verifiedDelivery"):s("blocks.generatedSource"),children:[a.jsxs("header",{className:"delivery-card-header",children:[a.jsx("span",{className:"delivery-card-icon",children:e.verified?a.jsx(HMt,{}):a.jsx(VMt,{})}),a.jsxs("div",{className:"delivery-card-heading",children:[a.jsx("strong",{children:l(e.agentName)}),a.jsx("span",{children:e.verified?s("blocks.verifiedDelivery"):s("blocks.generatedSource")})]})]}),a.jsxs("dl",{className:"delivery-card-grid",children:[a.jsxs("div",{className:"delivery-card-entry",children:[a.jsx("dt",{children:s("blocks.entryPoint")}),a.jsx("dd",{children:a.jsx("code",{children:l(e.entryPoint)})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("blocks.fileCount")}),a.jsx("dd",{children:e.fileCount})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("blocks.size")}),a.jsxs("dd",{children:[(e.artifactSize/1024).toFixed(1)," KiB"]})]}),a.jsxs("div",{className:"delivery-card-time",children:[a.jsx("dt",{children:e.verified?s("blocks.validationTime"):s("blocks.generationTime")}),a.jsx("dd",{children:C})]})]}),a.jsxs("p",{className:"delivery-card-gates",children:[e.verified?s("blocks.checksPassed",{count:e.gateSummary.length}):s("blocks.sourceReady")," ","· ",a.jsx("code",{children:e.artifactSha256.slice(0,12)})]}),e.verified?null:a.jsx("p",{className:"delivery-card-guidance",children:s("blocks.sourceGuidance")}),a.jsxs("div",{className:"delivery-card-actions",children:[a.jsxs("div",{className:"delivery-card-secondary-actions",children:[a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void R(),disabled:!t||v!==null,children:[v==="source"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s("blocks.viewSource")]}),e.projectId&&e.versionId&&e.parentVersionId?a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void j(),disabled:!n||v!==null,children:[v==="compare"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s(v==="compare"?"blocks.preparing":"blocks.viewChanges")]}):null,a.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void _(),disabled:!i||v!==null,"aria-busy":v==="download",children:[v==="download"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s(v==="download"?"blocks.preparing":"blocks.downloadSource")]})]}),a.jsxs("button",{type:"button",className:"delivery-card-primary",onClick:()=>void T(),disabled:!e.deployable||!r||!t||v!==null,title:e.deployable?s("blocks.manualDeploy"):s("blocks.sourceNotReady"),children:[v==="deploy"?a.jsx(Ei,{className:"spin","aria-hidden":"true"}):null,s("blocks.deployAgent")]})]}),x?a.jsx("p",{className:"delivery-card-error",role:"alert",children:x}):null,O?a.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:O.message}):null]}),a.jsx(dw,{project:{name:e.agentName,files:(c==null?void 0:c.files)??[]},open:d,onClose:()=>f(!1),onChange:()=>{},readOnly:!0}),a.jsx(dw,{project:{name:(g==null?void 0:g.target.agentName)??e.agentName,files:(g==null?void 0:g.target.files)??[]},comparison:g?{baseProject:{name:g.base.agentName,files:g.base.files??[]},baseLabel:s("blocks.beforeOptimization"),targetLabel:s("blocks.afterOptimization")}:void 0,open:h,onClose:()=>m(!1),onChange:()=>{},readOnly:!0})]})}function MMe(){return a.jsx(DMe,{text:"",done:!1})}const mLt=p.memo(function({text:t,streaming:n,onStreamFrame:i,onStreamComplete:r}){const s=PMe(t,n,i,r);return s?a.jsx("div",{className:"bubble",children:a.jsx(Yu,{text:s,streaming:n})}):null});function gLt({title:e,summary:t,items:n,done:i}){const{t:r}=Ae("conversation"),[s,o]=p.useState(!i),l=p.useRef(!1);p.useEffect(()=>{l.current||o(!i)},[i]);const c=()=>{l.current=!0,o(u=>!u)};return a.jsxs("div",{className:"block-plan",children:[a.jsxs("button",{className:"plan-head",type:"button",onClick:c,"aria-expanded":n.length>0?s:void 0,disabled:n.length===0,children:[a.jsx("span",{className:"plan-icon","aria-hidden":"true",children:a.jsx(cLt,{})}),i?a.jsx("span",{className:"plan-title",children:e}):a.jsx(yn,{className:"plan-title",duration:2.2,spread:15,children:e}),t?a.jsx("span",{className:"plan-summary",children:t}):null,n.length>0?a.jsx(r1,{className:`plan-chevron${s?" is-open":""}`}):null]}),a.jsx("div",{className:`think-collapse ${s&&n.length>0?"open":""}`,children:a.jsx("div",{className:"think-collapse-inner",children:n.length>0?a.jsx("ol",{className:"plan-items",children:n.map((u,d)=>a.jsxs("li",{"data-status":u.status,children:[a.jsx("span",{className:"plan-item-marker","aria-hidden":"true"}),a.jsx("span",{className:"plan-item-text",children:u.text}),a.jsx("small",{children:r(`blocks.planStatuses.${u.status}`)})]},`${d}:${u.text}`))}):null})})]})}function bLt(e){if(!e||typeof e!="object")return[];const t=e,n=t.result;let i=[];if(Array.isArray(t.studio_artifacts))i=t.studio_artifacts;else if(n&&typeof n=="object"){const r=n.studio_artifacts;Array.isArray(r)&&(i=r)}return i.flatMap(r=>{if(!r||typeof r!="object")return[];const s=r;return typeof s.name=="string"&&typeof s.contentUrl=="string"?[{name:s.name,contentUrl:s.contentUrl}]:[]})}function yLt({name:e,args:t,response:n,done:i,status:r,defaultOpen:s=!1,retrying:o=!1,codexActivity:l,native:c=!1,progressText:u,onBranchSelect:d,onAction:f}){const{t:h}=Ae("conversation"),g=e==="create_agents"&&i&&nMt(t,n)?"failed":r??(i?"completed":"running"),b=e==="create_agents"&&g==="failed"&&o,v=zMt(e),y=v==null?void 0:v.detailRenderer,x=(v==null?void 0:v.hideHeader)===!0,w=x||s||!!y||!!l,[O,S]=p.useState(w),k=p.useRef(!1);p.useEffect(()=>{!k.current&&w&&S(!0)},[w]);const C=()=>{k.current=!0,S(T=>!T)},E=e===IMe?h("blocks.renderUi"):e,R=bLt(n),_=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),j=!c&&_&&_.length>2e3?`${_.slice(0,2e3)} +${h("blocks.truncated")}`:_;return a.jsxs(dr.div,{className:`block-tool${v?" block-tool--builtin":""}`,"data-status":g,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[v&&!x?a.jsx(XDt,{definition:v,label:b?h("blocks.agentAdjusting"):g==="failed"?h(`blocks.tools.${v.name}.failed`,{defaultValue:v.failedLabel??v.doneLabel}):fLt(e,t,h),done:i,open:O,onToggle:C}):v?null:a.jsxs("button",{className:"tool-head tool-head--generic",onClick:C,type:"button","aria-expanded":O,children:[a.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:c?a.jsx(XP,{kind:"tool"}):a.jsx(lLt,{})}),i?a.jsx("span",{className:"tool-name",children:E}):a.jsx(yn,{className:"tool-name",duration:2.2,spread:15,children:E}),c&&g==="failed"&&a.jsx("span",{className:"development-tool-failure",children:a.jsx(Tx,{ns:"adk",i18nKey:"developmentRuns.toolFailed"})}),a.jsx(r1,{className:`tool-chevron${O?" is-open":""}`})]}),a.jsx("div",{className:`${x?"":"think-collapse "}${O?"open":""}`,children:a.jsxs("div",{className:"think-collapse-inner",children:[l?a.jsxs("section",{className:"codex-sandbox-run","aria-label":h("blocks.sandboxDetails"),children:[a.jsxs("div",{className:"codex-sandbox-run__label",children:[a.jsxs("span",{className:"codex-sandbox-run__badge",children:[a.jsx(uLt,{}),a.jsx("span",{children:"Codex Sandbox"})]}),a.jsx("span",{className:"codex-sandbox-run__title",children:l.title})]}),a.jsx(dLt,{activity:l}),a.jsx("div",{className:"codex-sandbox-run__stream",children:l.items.length>0?a.jsx(Sy,{blocks:l.items.map(T=>T.block),streaming:!i,onAction:f}):a.jsx(yn,{className:"codex-sandbox-run__empty",children:h("blocks.waitingCodex")})})]}):null,y?a.jsx(y,{args:t,response:n,status:g,onBranchSelect:d}):l?null:a.jsxs("div",{className:"tool-detail",children:[u&&a.jsx("div",{className:"development-tool-meta",children:u}),t!=null&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.arguments")}),a.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),j!=null&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.result")}),a.jsx("pre",{className:"tool-args tool-result",children:j})]}),R.length>0&&a.jsxs("div",{className:"tool-section",children:[a.jsx("div",{className:"tool-section-label",children:h("blocks.artifacts")}),a.jsx("div",{className:"studio-tool-artifacts",children:R.map(T=>a.jsx("a",{href:T.contentUrl,download:T.name,children:h("blocks.downloadNamed",{name:T.name})},`${T.contentUrl}:${T.name}`))})]})]})]})})]})}function vLt({block:e,onDownload:t,onPreview:n}){const{t:i}=Ae("conversation"),[r,s]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(null);p.useEffect(()=>()=>{c&&URL.revokeObjectURL(c.url)},[c]);const d=()=>u(null),f=async(g,b)=>{if(t){s(`download:${g}`),l("");try{await t(g,b)}catch(v){l(v instanceof Error?v.message:String(v))}finally{s("")}}},h=async(g,b,v)=>{if(n){s(`preview:${v}`),l("");try{const y=await n(g,b);u({name:v,url:y})}catch(y){l(y instanceof Error?y.message:String(y))}finally{s("")}}},m=e.files.filter(g=>!g.filename.endsWith(".preview.webp"));return a.jsxs("div",{className:"artifact-list",children:[m.map(g=>{const b=`${g.filename.replace(/\.pptx$/i,"")}.preview.webp`,v=e.files.find(y=>y.filename===b);return a.jsxs("div",{className:"artifact-card",children:[a.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:a.jsx(JU,{})}),a.jsxs("span",{className:"artifact-card__copy",children:[a.jsx("span",{className:"artifact-card__name",children:g.filename}),a.jsx("span",{className:"artifact-card__hint",children:i("blocks.powerpoint")})]}),a.jsxs("span",{className:"artifact-card__actions",children:[v&&a.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void h(v.filename,v.version,g.filename),children:[r===`preview:${g.filename}`?a.jsx(Ei,{className:"spin"}):a.jsx(Jnt,{}),i("blocks.preview")]}),a.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void f(g.filename,g.version),children:[r===`download:${g.filename}`?a.jsx(Ei,{className:"spin"}):a.jsx(eP,{}),i("blocks.download")]})]})]},`${g.filename}:${g.version}`)}),o&&a.jsx("div",{className:"artifact-card__error",children:o}),c&&a.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":i("blocks.previewDialog",{name:c.name}),children:[a.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":i("blocks.closePreview"),onClick:d}),a.jsxs("div",{className:"artifact-preview__panel",children:[a.jsxs("div",{className:"artifact-preview__header",children:[a.jsx("span",{children:c.name}),a.jsx("button",{type:"button","aria-label":i("blocks.closePreview"),onClick:d,children:a.jsx(xa,{})})]}),a.jsx("div",{className:"artifact-preview__canvas",children:a.jsx("img",{src:c.url,alt:i("blocks.slidePreview",{name:c.name})})})]})]})]})}function xLt({block:e,onAuth:t}){const{t:n}=Ae("conversation"),[i,r]=p.useState(e.done?"done":"idle"),[s,o]=p.useState(""),l=e.label||n("blocks.mcpToolset"),c=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),u=async()=>{if(t){o(""),r("authorizing");try{await t(e),r("done")}catch(f){o(f instanceof Error?f.message:String(f)),r("idle")}}};return e.done||i==="done"?a.jsxs(dr.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[a.jsx(MY,{className:"auth-card-icon auth-card-icon--done"}),a.jsx("span",{children:n("blocks.authorized",{tool:l})})]}):a.jsxs(dr.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[a.jsxs("div",{className:"auth-card-head",children:[a.jsx(MY,{className:"auth-card-icon"}),a.jsx("span",{className:"auth-card-title",children:n("blocks.authorizationRequired",{tool:l})})]}),a.jsxs("p",{className:"auth-card-desc",children:[a.jsx(Tx,{t:n,i18nKey:"blocks.oauthDescription",values:{tool:l},components:{code:a.jsx("code",{className:"auth-card-code"})}}),c&&a.jsxs(a.Fragment,{children:[" ",a.jsx(Tx,{t:n,i18nKey:"blocks.oauthProvider",values:{provider:c},components:{code:a.jsx("code",{className:"auth-card-code"})}})," "]}),n("blocks.oauthContinue")]}),a.jsx("button",{className:"auth-card-btn",onClick:u,disabled:i==="authorizing"||!e.authUri,children:i==="authorizing"?a.jsxs(a.Fragment,{children:[a.jsx(Ei,{className:"cw-i spin"})," ",n("blocks.waitingAuthorization")]}):a.jsx(a.Fragment,{children:n("blocks.authorize")})}),!e.authUri&&a.jsx("div",{className:"auth-card-err",children:n("blocks.missingAuthorizationUrl")}),s&&a.jsx("div",{className:"auth-card-err",children:s})]})}function Sy({groupProcess:e=!1,liveStatus:t,blocks:n,appName:i="",streaming:r=!1,onStreamFrame:s,onStreamComplete:o,onAction:l,onAuth:c,onArtifactDownload:u,onArtifactPreview:d,onResolveDelivery:f,onResolveDeliveryComparison:h,onDownloadDelivery:m,onDeployDelivery:g,onBranchSelect:b}){if(e)return a.jsx($Dt,{blocks:n,active:r,status:t,render:y=>a.jsx(Sy,{blocks:y,appName:i,streaming:r,onStreamFrame:s,onStreamComplete:o,onAction:l,onAuth:c,onArtifactDownload:u,onArtifactPreview:d,onResolveDelivery:f,onResolveDeliveryComparison:h,onDownloadDelivery:m,onDeployDelivery:g,onBranchSelect:b})});const v=n.reduce((y,x,w)=>x.kind==="text"?w:y,-1);return a.jsx(a.Fragment,{children:n.map((y,x)=>{switch(y.kind){case"turn-summary":return a.jsx(MDt,{value:y.value},y.id||x);case"diff":return a.jsxs("details",{className:"development-diff",children:[a.jsxs("summary",{children:[a.jsx("span",{className:"tool-icon",children:a.jsx(XP,{kind:"diff"})}),a.jsx("span",{children:a.jsx(Tx,{ns:"adk",i18nKey:"developmentRuns.diff"})}),a.jsx(r1,{className:"tool-chevron"})]}),a.jsx("pre",{children:y.text})]},y.id??x);case"progress":return a.jsx(hLt,{text:y.text},"build-progress");case"thinking":{const w=n.slice(x+1).some(O=>O.kind==="text"&&!!O.text.trim());return a.jsx(DMe,{text:y.text,done:y.done,answerStarted:w,streaming:r,onStreamFrame:s},y.id??x)}case"text":{const w=y.text.replace(/^\s+/,"");return w?a.jsx(mLt,{text:w,streaming:r,onStreamFrame:s,onStreamComplete:x===v?o:void 0},y.id??x):null}case"plan":return a.jsx(gLt,{title:y.title,summary:y.summary,items:y.items,done:y.done},y.id??x);case"attachment":return a.jsx(ZP,{appName:i,items:y.files},y.id??x);case"artifact":return a.jsx(vLt,{block:y,onDownload:u,onPreview:d},y.id??x);case"delivery":return a.jsx(pLt,{value:y.value,onResolve:f,onResolveComparison:h,onDownload:m,onDeploy:g},y.id??x);case"invocation":return a.jsx(YP,{value:y.value},y.id??x);case"tool":{if(y.name===IMe&&y.done)return null;const w=y.name==="create_agents"&&n.slice(x+1).some(O=>O.kind==="tool"&&O.name==="create_agents");return a.jsx(yLt,{name:y.itemType?DCe(y):y.name,native:!!y.itemType,progressText:y.progressText,args:y.args,response:y.response,done:y.done,status:y.status,defaultOpen:y.defaultOpen,retrying:y.name==="create_agents"&&(r||w),codexActivity:y.codexActivity,onBranchSelect:b,onAction:l},y.id??x)}case"agent-transfer":return null;case"auth":return a.jsx(xLt,{block:y,onAuth:c},y.id??x);case"a2ui":return sMe(y.messages).filter(w=>w.components[w.rootId]).map(w=>a.jsx(dr.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:a.jsx(WDt,{surface:w,onAction:l})},`${x}-${w.surfaceId}`));default:return null}})})}const wLt=()=>{};function OLt(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error(Jt("conversation.unsupportedActivity"))}function kLt({activities:e}){const{t}=Ae("skills"),n=p.useMemo(()=>e.filter(i=>i.kind!=="status").map(OLt),[e]);return n.length===0?null:a.jsx("div",{className:"skill-conversation","aria-label":t("conversation.ariaLabel"),"aria-live":"polite",children:a.jsx(Sy,{blocks:n,onAction:wLt})})}function Kte(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m7 9 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function Y_({label:e,value:t,options:n,onChange:i,disabled:r=!1,allowCustom:s=!1,required:o=!1,placeholder:l,error:c}){const{t:u}=Ae("skills"),d=l??u("configSelect.placeholder"),f=p.useId(),h=p.useId(),m=p.useId(),g=p.useRef(null),b=p.useRef(null),v=p.useRef(null),y=p.useRef(null),x=p.useRef([]),w=n.findIndex(P=>P.value===t),O=t.trim().toLocaleLowerCase(),S=s&&O?n.filter(P=>P.value.toLocaleLowerCase().includes(O)||P.label.toLocaleLowerCase().includes(O)):n,[k,C]=p.useState(!1),[E,R]=p.useState(Math.max(0,w)),_=w>=0?n[w]:void 0,j=r||!s&&n.length===0,T=(P=!1)=>{C(!1),P&&window.requestAnimationFrame(()=>{var D,M;return s?(D=v.current)==null?void 0:D.focus():(M=b.current)==null?void 0:M.focus()})},N=P=>{j||S.length!==0&&(R(Math.min(Math.max(P,0),S.length-1)),C(!0))};p.useEffect(()=>{if(!k)return;const P=y.current,D=s?void 0:window.requestAnimationFrame(()=>{var I;(I=x.current[E])==null||I.focus()}),M=I=>{if(!P)return;const H=P.scrollTop<=0,K=P.scrollTop+P.clientHeight>=P.scrollHeight-1;(P.scrollHeight<=P.clientHeight||I.deltaY<0&&H||I.deltaY>0&&K)&&I.preventDefault(),I.stopPropagation()},L=I=>{var H;I.target instanceof Node&&!((H=g.current)!=null&&H.contains(I.target))&&T()},U=I=>{I.key==="Escape"&&T(!0)};return P==null||P.addEventListener("wheel",M,{passive:!1}),window.addEventListener("pointerdown",L),window.addEventListener("keydown",U),()=>{D!==void 0&&window.cancelAnimationFrame(D),P==null||P.removeEventListener("wheel",M),window.removeEventListener("pointerdown",L),window.removeEventListener("keydown",U)}},[E,s,k]);const A=P=>{var M;if(S.length===0)return;const D=(P+S.length)%S.length;R(D),(M=x.current[D])==null||M.focus()};return a.jsxs("div",{ref:g,className:`skill-config-select${k?" is-open":""}`,onBlur:P=>{var D;(!P.relatedTarget||!((D=g.current)!=null&&D.contains(P.relatedTarget)))&&T()},children:[a.jsxs("span",{id:h,className:"skill-config-select__label",children:[e,o?a.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"}):null]}),s?a.jsxs("div",{className:`skill-config-select__trigger is-editable${r?" is-disabled":""}`,"aria-expanded":k,children:[a.jsx("input",{ref:v,value:t,disabled:r,role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":k?f:void 0,"aria-labelledby":h,"aria-required":o,"aria-invalid":!!c,"aria-describedby":c?m:void 0,placeholder:d,onChange:P=>{i(P.target.value),R(0),n.length>0&&C(!0)},onClick:()=>{!k&&S.length>0&&N(0)},onKeyDown:P=>{var D,M;if(!(P.nativeEvent.isComposing||P.keyCode===229))if(P.key==="ArrowDown")P.preventDefault(),k?(D=x.current[E])==null||D.focus():N(0);else if(P.key==="ArrowUp")P.preventDefault(),k?(M=x.current[S.length-1])==null||M.focus():N(S.length-1);else if(P.key==="Enter"&&k){P.preventDefault();const L=S[E];L&&i(L.value),T()}else P.key==="Escape"&&(P.preventDefault(),T())}}),a.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:r||n.length===0,"aria-label":u(k?"configSelect.collapseOptions":"configSelect.expandOptions"),onClick:()=>{k?T():N(0)},children:a.jsx(Kte,{})})]}):a.jsxs("button",{ref:b,type:"button",className:"skill-config-select__trigger",disabled:j,"aria-haspopup":"listbox","aria-expanded":k,"aria-controls":k?f:void 0,"aria-labelledby":h,"aria-required":o,onClick:()=>{k?T():N(w>=0?w:0)},onKeyDown:P=>{P.key==="ArrowDown"?(P.preventDefault(),N(w>=0?w:0)):P.key==="ArrowUp"&&(P.preventDefault(),N(w>=0?w:n.length-1))},children:[a.jsx("span",{className:_?void 0:"is-placeholder",title:_==null?void 0:_.label,children:(_==null?void 0:_.label)||(n.length===0?u("configSelect.noOptions"):d)}),a.jsx(Kte,{})]}),k?a.jsxs("div",{ref:y,id:f,className:"skill-config-select__menu",role:"listbox","aria-labelledby":h,children:[S.length===0?a.jsx("div",{className:"skill-config-select__empty",role:"status",children:u("configSelect.noMatches")}):null,S.map((P,D)=>{const M=P.value===t;return a.jsx("button",{ref:L=>{x.current[D]=L},type:"button",role:"option","aria-selected":M,tabIndex:D===E?0:-1,className:`skill-config-select__option${M?" is-selected":""}`,title:P.label,onFocus:()=>R(D),onClick:()=>{i(P.value),T(!0)},onKeyDown:L=>{L.key==="Enter"||L.key===" "?(L.preventDefault(),i(P.value),T(!0)):L.key==="ArrowDown"?(L.preventDefault(),A(D+1)):L.key==="ArrowUp"?(L.preventDefault(),A(D-1)):L.key==="Home"?(L.preventDefault(),A(0)):L.key==="End"&&(L.preventDefault(),A(n.length-1))},children:P.label},P.value)})]}):null,c?a.jsx("span",{id:m,className:"skill-config-select__error",role:"alert",children:c}):null]})}function vr(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function ms({error:e}){var s,o,l,c,u;const{t}=Ae("skills"),n=e,i=(o=(s=n.originalError)==null?void 0:s.message)==null?void 0:o.trim(),r=[typeof n.status=="number"?`HTTP ${n.status}${n.statusText?` ${n.statusText}`:""}`:"",n.code?t("errorDetails.code",{code:n.code}):"",(l=n.originalError)!=null&&l.type?t("errorDetails.type",{type:n.originalError.type}):"",(c=n.originalError)!=null&&c.repr&&n.originalError.repr!==i?t("errorDetails.representation",{value:n.originalError.repr}):"",(u=n.rawResponse)!=null&&u.trim()?t("errorDetails.rawResponse",{value:n.rawResponse.trim()}):""].filter(Boolean);return a.jsxs("div",{className:"skill-error-details",children:[a.jsx("div",{className:"skill-error-details__summary",children:e.message}),i?a.jsx("div",{className:"skill-error-details__original",children:t("errorDetails.original",{message:i})}):null,r.length>0?a.jsxs("details",{children:[a.jsx("summary",{children:t("errorDetails.details")}),a.jsx("pre",{children:r.join(` +`)})]}):null]})}const pV=Symbol.for("yaml.alias"),k8=Symbol.for("yaml.document"),Hm=Symbol.for("yaml.map"),LMe=Symbol.for("yaml.pair"),Lf=Symbol.for("yaml.scalar"),s1=Symbol.for("yaml.seq"),Zu=Symbol.for("yaml.node.type"),o1=e=>!!e&&typeof e=="object"&&e[Zu]===pV,XC=e=>!!e&&typeof e=="object"&&e[Zu]===k8,YC=e=>!!e&&typeof e=="object"&&e[Zu]===Hm,bo=e=>!!e&&typeof e=="object"&&e[Zu]===LMe,ns=e=>!!e&&typeof e=="object"&&e[Zu]===Lf,ZC=e=>!!e&&typeof e=="object"&&e[Zu]===s1;function po(e){if(e&&typeof e=="object")switch(e[Zu]){case Hm:case s1:return!0}return!1}function go(e){if(e&&typeof e=="object")switch(e[Zu]){case pV:case Hm:case Lf:case s1:return!0}return!1}const $Me=e=>(ns(e)||po(e))&&!!e.anchor,vb=Symbol("break visit"),SLt=Symbol("skip children"),Yk=Symbol("remove node");function a1(e,t){const n=ELt(t);XC(e)?Mv(null,e.contents,n,Object.freeze([e]))===Yk&&(e.contents=null):Mv(null,e,n,Object.freeze([]))}a1.BREAK=vb;a1.SKIP=SLt;a1.REMOVE=Yk;function Mv(e,t,n,i){const r=CLt(e,t,n,i);if(go(r)||bo(r))return TLt(e,i,r),Mv(e,r,n,i);if(typeof r!="symbol"){if(po(t)){i=Object.freeze(i.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>ALt[t]);class xl{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},xl.defaultYaml,t),this.tags=Object.assign({},xl.defaultTags,n)}clone(){const t=new xl(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new xl(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:xl.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},xl.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:xl.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},xl.defaultTags),this.atNextDocument=!1);const i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;const[s,o]=i;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=i;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);const s=this.tags[i];if(s)try{return s+decodeURIComponent(r)}catch(o){return n(String(o)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+_Lt(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags);let r;if(t&&i.length>0&&go(t.contents)){const s={};a1(t.contents,(o,l)=>{go(l)&&l.tag&&(s[l.tag]=!0)}),r=Object.keys(s)}else r=[];for(const[s,o]of i)s==="!!"&&o==="tag:yaml.org,2002:"||(!t||r.some(l=>l.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(` +`)}}xl.defaultYaml={explicit:!1,version:"1.2"};xl.defaultTags={"!!":"tag:yaml.org,2002:"};function FMe(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function BMe(e){const t=new Set;return a1(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function UMe(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function jLt(e,t){const n=[],i=new Map;let r=null;return{onAnchor:s=>{n.push(s),r??(r=BMe(e));const o=UMe(t,r);return r.add(o),o},setAnchors:()=>{for(const s of n){const o=i.get(s);if(typeof o=="object"&&o.anchor&&(ns(o.node)||po(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:i}}function Lv(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,s=i.length;rqu(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!$Me(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=s=>{i.res=s,delete n.onCreate};const r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class mV{constructor(t){Object.defineProperty(this,Zu,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:s}={}){if(!XC(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=qu(this,"",o);if(typeof r=="function")for(const{count:c,res:u}of o.anchors.values())r(u,c);return typeof s=="function"?Lv(s,{"":l},"",l):l}}let gV=class extends mV{constructor(t){super(pV),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let i;n!=null&&n.aliasResolveCache?i=n.aliasResolveCache:(i=[],a1(t,{Node:(s,o)=>{(o1(o)||$Me(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let r;for(const s of i){if(s===this)break;s.anchor===this.source&&(r=s)}return r}toJSON(t,n){if(!n)return{source:this.source};const{anchors:i,doc:r,maxAliasCount:s}=n,o=this.resolve(r,n);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=i.get(o);if(l||(qu(o,null,n),l=i.get(o)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Z_(r,o,i)),l.count*l.aliasCount>s)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,i){const r=`*${this.source}`;if(t){if(FMe(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${r} `}return r}};function Z_(e,t,n){if(o1(t)){const i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(po(t)){let i=0;for(const r of t.items){const s=Z_(e,r,n);s>i&&(i=s)}return i}else if(bo(t)){const i=Z_(e,t.key,n),r=Z_(e,t.value,n);return Math.max(i,r)}return 1}const QMe=e=>!e||typeof e!="function"&&typeof e!="object";class ii extends mV{constructor(t){super(Lf),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:qu(this.value,t,n)}toString(){return String(this.value)}}ii.BLOCK_FOLDED="BLOCK_FOLDED";ii.BLOCK_LITERAL="BLOCK_LITERAL";ii.PLAIN="PLAIN";ii.QUOTE_DOUBLE="QUOTE_DOUBLE";ii.QUOTE_SINGLE="QUOTE_SINGLE";const NLt="tag:yaml.org,2002:";function RLt(e,t,n){if(t){const i=n.filter(s=>s.tag===t),r=i.find(s=>!s.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>{var r;return((r=i.identify)==null?void 0:r.call(i,e))&&!i.format})}function pE(e,t,n){var f,h,m;if(XC(e)&&(e=e.contents),go(e))return e;if(bo(e)){const g=(h=(f=n.schema[Hm]).createNode)==null?void 0:h.call(f,n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:r,onTagObj:s,schema:o,sourceObjects:l}=n;let c;if(i&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=r(e)),new gV(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=NLt+t.slice(2));let u=RLt(e,t,o.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const g=new ii(e);return c&&(c.node=g),g}u=e instanceof Map?o[Hm]:Symbol.iterator in Object(e)?o[s1]:o[Hm]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((m=u==null?void 0:u.nodeClass)==null?void 0:m.from)=="function"?u.nodeClass.from(n.schema,e,n):new ii(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function JN(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){const s=t[r];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const o=[];o[s]=i,i=o}else i=new Map([[s,i]])}return pE(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const ek=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class zMe extends mV{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>go(i)||bo(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(ek(t))this.add(n);else{const[i,...r]=t,s=this.get(i,!0);if(po(s))s.addIn(r,n);else if(s===void 0&&this.schema)this.set(i,JN(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){const[n,...i]=t;if(i.length===0)return this.delete(n);const r=this.get(n,!0);if(po(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){const[i,...r]=t,s=this.get(i,!0);return r.length===0?!n&&ns(s)?s.value:s:po(s)?s.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!bo(n))return!1;const i=n.value;return i==null||t&&ns(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){const[n,...i]=t;if(i.length===0)return this.has(n);const r=this.get(n,!0);return po(r)?r.hasIn(i):!1}setIn(t,n){const[i,...r]=t;if(r.length===0)this.set(i,n);else{const s=this.get(i,!0);if(po(s))s.setIn(r,n);else if(s===void 0&&this.schema)this.set(i,JN(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}}const ILt=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Fh(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Mb=(e,t,n)=>e.endsWith(` `)?Fh(n,t):n.includes(` `)?` `+Fh(n,t):(e.endsWith(" ")?"":" ")+n,VMe="flow",S8="block",J_="quoted";function nD(e,t,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:s=20,onFold:o,onOverflow:l}={}){if(!r||r<0)return e;rr-Math.max(2,s)?u.push(0):f=r-i);let h,m,g=!1,b=-1,v=-1,y=-1;n===S8&&(b=Gte(e,b,t.length),b!==-1&&(f=b+c));for(let w;w=e[b+=1];){if(n===J_&&w==="\\"){switch(v=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}y=b}if(w===` @@ -587,7 +587,7 @@ ${h("blocks.truncated")}`:_;return a.jsxs(dr.div,{className:`block-tool${v?" blo `&&O!==" "&&(h=b)}if(b>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===J_){for(;m===" "||m===" ";)m=w,w=e[b+=1],g=!0;const O=b>y+1?b-2:v-1;if(d[O])return e;u.push(O),d[O]=!0,f=O+c,h=void 0}else g=!0}m=w}if(g&&l&&l(),u.length===0)return e;o&&o();let x=e.slice(0,u[0]);for(let w=0;w({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),rD=e=>/^(%|---|\.\.\.)/m.test(e);function RLt(e,t,n){if(!t||t<0)return!1;const i=t-n,r=e.length;if(r<=i)return!1;for(let s=0,o=0;s({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),rD=e=>/^(%|---|\.\.\.)/m.test(e);function PLt(e,t,n){if(!t||t<0)return!1;const i=t-n,r=e.length;if(r<=i)return!1;for(let s=0,o=0;si)return!0;if(o=s+1,r-o<=i)return!1}return!0}function Zk(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(rD(e)?" ":"");let o="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{o+=n.slice(l,c);const d=n.substr(c+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=n.substr(c,6)}c+=5,l=c+1}break;case"n":if(i||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const S=n[h-1];if(S!==` `&&S!==" "&&S!==" ")break}let m=n.substring(h);const g=m.indexOf(` @@ -605,12 +605,12 @@ ${n}`)+"'";return t.implicitKey?i:nD(i,n,VMe,iD(t,!1))}function $v(e,t){const{si `)y=v;else break}let x=n.substring(0,y{k=!0});const E=nD(`${x}${S}${m}`,u,S8,C);if(!k)return`>${O} ${u}${E}`}return n=n.replace(/\n+/g,`$&${u}`),`|${O} -${u}${x}${n}${m}`}function ILt(e,t,n,i){const{type:r,value:s}=e,{actualString:o,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&s.includes(` +${u}${x}${n}${m}`}function DLt(e,t,n,i){const{type:r,value:s}=e,{actualString:o,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&s.includes(` `)||d&&/[[\]{},]/.test(s))return $v(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||d||!s.includes(` `)?$v(s,t):ej(e,t,n,i);if(!l&&!d&&r!==ii.PLAIN&&s.includes(` `))return ej(e,t,n,i);if(rD(s)){if(c==="")return t.forceBlockIndent=!0,ej(e,t,n,i);if(l&&c===u)return $v(s,t)}const f=s.replace(/\n+/g,`$& -${c}`);if(o){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:m,tags:g}=t.doc.schema;if(g.some(h)||m!=null&&m.some(h))return $v(s,t)}return l?f:nD(f,c,VMe,iD(t,!1))}function bV(e,t,n,i){const{implicitKey:r,inFlow:s}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==ii.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=ii.QUOTE_DOUBLE);const c=d=>{switch(d){case ii.BLOCK_FOLDED:case ii.BLOCK_LITERAL:return r||s?$v(o.value,t):ej(o,t,n,i);case ii.QUOTE_DOUBLE:return Zk(o.value,t);case ii.QUOTE_SINGLE:return E8(o.value,t);case ii.PLAIN:return ILt(o,t,n,i);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=r&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function HMe(e,t){const n=Object.assign({blockQuote:!0,commentString:NLt,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function PLt(e,t){var r;if(t.tag){const s=e.filter(o=>o.tag===t.tag);if(s.length>0)return s.find(o=>o.format===t.format)??s[0]}let n,i;if(ns(t)){i=t.value;let s=e.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,i)});if(s.length>1){const o=s.filter(l=>l.test);o.length>0&&(s=o)}n=s.find(o=>o.format===t.format)??s.find(o=>!o.format)}else i=t,n=e.find(s=>s.nodeClass&&i instanceof s.nodeClass);if(!n){const s=((r=i==null?void 0:i.constructor)==null?void 0:r.name)??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${s} value`)}return n}function DLt(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const r=[],s=(ns(e)||po(e))&&e.anchor;s&&FMe(s)&&(n.add(s),r.push(`&${s}`));const o=e.tag??(t.default?null:t.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function fw(e,t,n,i){var c;if(bo(e))return e.toString(t,n,i);if(o1(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r;const s=go(e)?e:t.doc.createNode(e,{onTagObj:u=>r=u});r??(r=PLt(t.doc.schema.tags,s));const o=DLt(s,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const l=typeof r.stringify=="function"?r.stringify(s,t,n,i):ns(s)?bV(s,t,n,i):s.toString(t,n,i);return o?ns(s)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o} -${t.indent}${l}`:l}function MLt({key:e,value:t},n,i,r){const{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=go(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(po(e)||!go(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!e||h&&t==null&&!n.inFlow||po(e)||(ns(e)?e.type===ii.BLOCK_FOLDED||e.type===ii.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!s),indent:l+c});let g=!1,b=!1,v=fw(e,n,()=>g=!0,()=>b=!0);if(!m&&!n.inFlow&&v.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||t==null)return g&&i&&i(),v===""?"?":m?`? ${v}`:v}else if(s&&!f||t==null&&m)return v=`? ${v}`,h&&!g?v+=Mb(v,n.indent,u(h)):b&&r&&r(),v;g&&(h=null),m?(h&&(v+=Mb(v,n.indent,u(h))),v=`? ${v} +${c}`);if(o){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:m,tags:g}=t.doc.schema;if(g.some(h)||m!=null&&m.some(h))return $v(s,t)}return l?f:nD(f,c,VMe,iD(t,!1))}function bV(e,t,n,i){const{implicitKey:r,inFlow:s}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==ii.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=ii.QUOTE_DOUBLE);const c=d=>{switch(d){case ii.BLOCK_FOLDED:case ii.BLOCK_LITERAL:return r||s?$v(o.value,t):ej(o,t,n,i);case ii.QUOTE_DOUBLE:return Zk(o.value,t);case ii.QUOTE_SINGLE:return E8(o.value,t);case ii.PLAIN:return DLt(o,t,n,i);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=r&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function HMe(e,t){const n=Object.assign({blockQuote:!0,commentString:ILt,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function MLt(e,t){var r;if(t.tag){const s=e.filter(o=>o.tag===t.tag);if(s.length>0)return s.find(o=>o.format===t.format)??s[0]}let n,i;if(ns(t)){i=t.value;let s=e.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,i)});if(s.length>1){const o=s.filter(l=>l.test);o.length>0&&(s=o)}n=s.find(o=>o.format===t.format)??s.find(o=>!o.format)}else i=t,n=e.find(s=>s.nodeClass&&i instanceof s.nodeClass);if(!n){const s=((r=i==null?void 0:i.constructor)==null?void 0:r.name)??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${s} value`)}return n}function LLt(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const r=[],s=(ns(e)||po(e))&&e.anchor;s&&FMe(s)&&(n.add(s),r.push(`&${s}`));const o=e.tag??(t.default?null:t.tag);return o&&r.push(i.directives.tagString(o)),r.join(" ")}function fw(e,t,n,i){var c;if(bo(e))return e.toString(t,n,i);if(o1(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r;const s=go(e)?e:t.doc.createNode(e,{onTagObj:u=>r=u});r??(r=MLt(t.doc.schema.tags,s));const o=LLt(s,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const l=typeof r.stringify=="function"?r.stringify(s,t,n,i):ns(s)?bV(s,t,n,i):s.toString(t,n,i);return o?ns(s)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o} +${t.indent}${l}`:l}function $Lt({key:e,value:t},n,i,r){const{allNullValues:s,doc:o,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=go(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(po(e)||!go(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let m=!f&&(!e||h&&t==null&&!n.inFlow||po(e)||(ns(e)?e.type===ii.BLOCK_FOLDED||e.type===ii.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!s),indent:l+c});let g=!1,b=!1,v=fw(e,n,()=>g=!0,()=>b=!0);if(!m&&!n.inFlow&&v.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||t==null)return g&&i&&i(),v===""?"?":m?`? ${v}`:v}else if(s&&!f||t==null&&m)return v=`? ${v}`,h&&!g?v+=Mb(v,n.indent,u(h)):b&&r&&r(),v;g&&(h=null),m?(h&&(v+=Mb(v,n.indent,u(h))),v=`? ${v} ${l}:`):(v=`${v}:`,h&&(v+=Mb(v,n.indent,u(h))));let y,x,w;go(t)?(y=!!t.spaceBefore,x=t.commentBefore,w=t.comment):(y=!1,x=null,w=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!m&&!h&&ns(t)&&(n.indentAtStart=v.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!m&&ZC(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let O=!1;const S=fw(t,n,()=>O=!0,()=>b=!0);let k=" ";if(h||y||x){if(k=y?` `:"",x){const C=u(x);k+=` ${Fh(C,n.indent)}`}S===""&&!n.inFlow?k===` @@ -620,32 +620,32 @@ ${Fh(C,n.indent)}`}S===""&&!n.inFlow?k===` ${n.indent}`}else if(!m&&po(t)){const C=S[0],E=S.indexOf(` `),R=E!==-1,_=n.inFlow??t.flow??t.items.length===0;if(R||!_){let j=!1;if(R&&(C==="&"||C==="!")){let T=S.indexOf(" ");C==="&"&&T!==-1&&Te===s2||typeof e=="symbol"&&e.description===s2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ii(Symbol(s2)),{addToJSMap:WMe}),stringify:()=>s2},LLt=(e,t)=>(Zh.identify(t)||ns(t)&&(!t.type||t.type===ii.PLAIN)&&Zh.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Zh.tag&&n.default));function WMe(e,t,n){const i=KMe(e,n);if(ZC(i))for(const r of i.items)t3(e,t,r);else if(Array.isArray(i))for(const r of i)t3(e,t,r);else t3(e,t,i)}function t3(e,t,n){const i=KMe(e,n);if(!YC(i))throw new Error("Merge sources must be maps or map aliases");const r=i.toJSON(null,e,Map);for(const[s,o]of r)t instanceof Map?t.has(s)||t.set(s,o):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function KMe(e,t){return e&&o1(t)?t.resolve(e.doc,e):t}function GMe(e,t,{key:n,value:i}){if(go(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(LLt(e,n))WMe(e,t,i);else{const r=qu(n,"",e);if(t instanceof Map)t.set(r,qu(i,r,e));else if(t instanceof Set)t.add(r);else{const s=$Lt(n,r,e),o=qu(i,s,e);s in t?Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[s]=o}}return t}function $Lt(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(go(e)&&(n!=null&&n.doc)){const i=HMe(n.doc,{});i.anchors=new Set;for(const s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;const r=e.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),qMe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function yV(e,t,n){const i=pE(e,void 0,n),r=pE(t,void 0,n);return new _l(i,r)}class _l{constructor(t,n=null){Object.defineProperty(this,Zu,{value:LMe}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return go(n)&&(n=n.clone(t)),go(i)&&(i=i.clone(t)),new _l(n,i)}toJSON(t,n){const i=n!=null&&n.mapAsMap?new Map:{};return GMe(n,i,this)}toString(t,n,i){return t!=null&&t.doc?MLt(this,t,n,i):JSON.stringify(this)}}function XMe(e,t,n){return(t.inFlow??e.flow?BLt:FLt)(e,t,n)}function FLt({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let g=0;gv=null,()=>f=!0);v&&(y+=Mb(y,s,u(v))),f&&v&&(f=!1),h.push(i+y)}let m;if(h.length===0)m=r.start+r.end;else{m=h[0];for(let g=1;ge===s2||typeof e=="symbol"&&e.description===s2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ii(Symbol(s2)),{addToJSMap:WMe}),stringify:()=>s2},FLt=(e,t)=>(Zh.identify(t)||ns(t)&&(!t.type||t.type===ii.PLAIN)&&Zh.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Zh.tag&&n.default));function WMe(e,t,n){const i=KMe(e,n);if(ZC(i))for(const r of i.items)t3(e,t,r);else if(Array.isArray(i))for(const r of i)t3(e,t,r);else t3(e,t,i)}function t3(e,t,n){const i=KMe(e,n);if(!YC(i))throw new Error("Merge sources must be maps or map aliases");const r=i.toJSON(null,e,Map);for(const[s,o]of r)t instanceof Map?t.has(s)||t.set(s,o):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function KMe(e,t){return e&&o1(t)?t.resolve(e.doc,e):t}function GMe(e,t,{key:n,value:i}){if(go(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(FLt(e,n))WMe(e,t,i);else{const r=qu(n,"",e);if(t instanceof Map)t.set(r,qu(i,r,e));else if(t instanceof Set)t.add(r);else{const s=BLt(n,r,e),o=qu(i,s,e);s in t?Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[s]=o}}return t}function BLt(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(go(e)&&(n!=null&&n.doc)){const i=HMe(n.doc,{});i.anchors=new Set;for(const s of n.anchors.keys())i.anchors.add(s.anchor);i.inFlow=!0,i.inStringifyKey=!0;const r=e.toString(i);if(!n.mapKeyWarned){let s=JSON.stringify(r);s.length>40&&(s=s.substring(0,36)+'..."'),qMe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function yV(e,t,n){const i=pE(e,void 0,n),r=pE(t,void 0,n);return new _l(i,r)}class _l{constructor(t,n=null){Object.defineProperty(this,Zu,{value:LMe}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return go(n)&&(n=n.clone(t)),go(i)&&(i=i.clone(t)),new _l(n,i)}toJSON(t,n){const i=n!=null&&n.mapAsMap?new Map:{};return GMe(n,i,this)}toString(t,n,i){return t!=null&&t.doc?$Lt(this,t,n,i):JSON.stringify(this)}}function XMe(e,t,n){return(t.inFlow??e.flow?QLt:ULt)(e,t,n)}function ULt({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:s,onChompKeep:o,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let g=0;gv=null,()=>f=!0);v&&(y+=Mb(y,s,u(v))),f&&v&&(f=!1),h.push(i+y)}let m;if(h.length===0)m=r.start+r.end;else{m=h[0];for(let g=1;gv=null);u||(u=f.length>d||y.includes(` +`+Fh(u(e),c),l&&l()):f&&o&&o(),m}function QLt({items:e},t,{flowChars:n,itemIndent:i}){const{indent:r,indentStep:s,flowCollectionPadding:o,options:{commentString:l}}=t;i+=s;const c=Object.assign({},t,{indent:i,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let g=0;gv=null);u||(u=f.length>d||y.includes(` `)),g0&&(u||(u=f.reduce((x,w)=>x+w.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),v&&(y+=Mb(y,i,l(v))),f.push(y),d=f.length}const{start:h,end:m}=n;if(f.length===0)return h+m;if(!u){const g=f.reduce((b,v)=>b+v.length+2,2);u=t.options.lineWidth>0&&g>t.options.lineWidth}if(u){let g=h;for(const b of f)g+=b?` ${s}${r}${b}`:` `;return`${g} -${r}${m}`}else return`${h}${o}${f.join(" ")}${o}${m}`}function eR({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){const s=Fh(t(i),e);n.push(s.trimStart())}}function Lb(e,t){const n=ns(t)?t.value:t;for(const i of e)if(bo(i)&&(i.key===t||i.key===n||ns(i.key)&&i.key.value===n))return i}class Ru extends zMe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Hm,t),this.items=[]}static from(t,n,i){const{keepUndefined:r,replacer:s}=i,o=new this(t),l=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||r)&&o.items.push(yV(c,u,i))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){var o;let i;bo(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new _l(t,t==null?void 0:t.value):i=new _l(t.key,t.value);const r=Lb(this.items,i.key),s=(o=this.schema)==null?void 0:o.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);ns(r.value)&&QMe(i.value)?r.value.value=i.value:r.value=i.value}else if(s){const l=this.items.findIndex(c=>s(i,c)<0);l===-1?this.items.push(i):this.items.splice(l,0,i)}else this.items.push(i)}delete(t){const n=Lb(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const i=Lb(this.items,t),r=i==null?void 0:i.value;return(!n&&ns(r)?r.value:r)??void 0}has(t){return!!Lb(this.items,t)}set(t,n){this.add(new _l(t,n),!0)}toJSON(t,n,i){const r=i?new i:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items)GMe(n,r,s);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(const r of this.items)if(!bo(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),XMe(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}}const l1={collection:"map",default:!0,nodeClass:Ru,tag:"tag:yaml.org,2002:map",resolve(e,t){return YC(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Ru.from(e,t,n)};class Ey extends zMe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(s1,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=o2(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const i=o2(t);if(typeof i!="number")return;const r=this.items[i];return!n&&ns(r)?r.value:r}has(t){const n=o2(t);return typeof n=="number"&&n=0?t:null}const c1={collection:"seq",default:!0,nodeClass:Ey,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ZC(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ey.from(e,t,n)},sD={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),bV(e,t,n,i)}},oD={identify:e=>e==null,createNode:()=>new ii(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ii(null),stringify:({source:e},t)=>typeof e=="string"&&oD.test.test(e)?e:t.options.nullStr},vV={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ii(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&vV.test.test(e)){const i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};function Ud({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);const r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let l=t-(s.length-o-1);for(;l-- >0;)s+="0"}return s}const YMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ud},ZMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ud(e)}},JMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ii(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ud},aD=e=>typeof e=="bigint"||Number.isInteger(e),xV=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function eLe(e,t,n){const{value:i}=e;return aD(i)&&i>=0?n+i.toString(t):Ud(e)}const tLe={identify:e=>aD(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>xV(e,2,8,n),stringify:e=>eLe(e,8,"0o")},nLe={identify:aD,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>xV(e,0,10,n),stringify:Ud},iLe={identify:e=>aD(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>xV(e,2,16,n),stringify:e=>eLe(e,16,"0x")},ULt=[l1,c1,sD,oD,vV,tLe,nLe,iLe,YMe,ZMe,JMe];function Xte(e){return typeof e=="bigint"||Number.isInteger(e)}const a2=({value:e})=>JSON.stringify(e),QLt=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:a2},{identify:e=>e==null,createNode:()=>new ii(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:a2},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:a2},{identify:Xte,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Xte(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:a2}],zLt={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},VLt=[l1,c1].concat(QLt,zLt),wV={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||r)&&o.items.push(yV(c,u,i))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){var o;let i;bo(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new _l(t,t==null?void 0:t.value):i=new _l(t.key,t.value);const r=Lb(this.items,i.key),s=(o=this.schema)==null?void 0:o.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);ns(r.value)&&QMe(i.value)?r.value.value=i.value:r.value=i.value}else if(s){const l=this.items.findIndex(c=>s(i,c)<0);l===-1?this.items.push(i):this.items.splice(l,0,i)}else this.items.push(i)}delete(t){const n=Lb(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const i=Lb(this.items,t),r=i==null?void 0:i.value;return(!n&&ns(r)?r.value:r)??void 0}has(t){return!!Lb(this.items,t)}set(t,n){this.add(new _l(t,n),!0)}toJSON(t,n,i){const r=i?new i:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items)GMe(n,r,s);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(const r of this.items)if(!bo(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),XMe(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}}const l1={collection:"map",default:!0,nodeClass:Ru,tag:"tag:yaml.org,2002:map",resolve(e,t){return YC(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Ru.from(e,t,n)};class Ey extends zMe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(s1,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=o2(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const i=o2(t);if(typeof i!="number")return;const r=this.items[i];return!n&&ns(r)?r.value:r}has(t){const n=o2(t);return typeof n=="number"&&n=0?t:null}const c1={collection:"seq",default:!0,nodeClass:Ey,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ZC(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ey.from(e,t,n)},sD={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),bV(e,t,n,i)}},oD={identify:e=>e==null,createNode:()=>new ii(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ii(null),stringify:({source:e},t)=>typeof e=="string"&&oD.test.test(e)?e:t.options.nullStr},vV={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ii(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&vV.test.test(e)){const i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};function Ud({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);const r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let s=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let l=t-(s.length-o-1);for(;l-- >0;)s+="0"}return s}const YMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ud},ZMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ud(e)}},JMe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ii(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ud},aD=e=>typeof e=="bigint"||Number.isInteger(e),xV=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function eLe(e,t,n){const{value:i}=e;return aD(i)&&i>=0?n+i.toString(t):Ud(e)}const tLe={identify:e=>aD(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>xV(e,2,8,n),stringify:e=>eLe(e,8,"0o")},nLe={identify:aD,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>xV(e,0,10,n),stringify:Ud},iLe={identify:e=>aD(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>xV(e,2,16,n),stringify:e=>eLe(e,16,"0x")},zLt=[l1,c1,sD,oD,vV,tLe,nLe,iLe,YMe,ZMe,JMe];function Xte(e){return typeof e=="bigint"||Number.isInteger(e)}const a2=({value:e})=>JSON.stringify(e),VLt=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:a2},{identify:e=>e==null,createNode:()=>new ii(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:a2},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:a2},{identify:Xte,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Xte(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:a2}],HLt={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},qLt=[l1,c1].concat(VLt,HLt),wV={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r1&&t("Each pair must have its own sequence indicator");const r=i.items[0]||new _l(new ii(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore} ${r.key.commentBefore}`:i.commentBefore),i.comment){const s=r.value??r.key;s.comment=s.comment?`${i.comment} -${s.comment}`:i.comment}i=r}e.items[n]=bo(i)?i:new _l(i)}}else t("Expected a sequence for this tag");return e}function sLe(e,t,n){const{replacer:i}=n,r=new Ey(e);r.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(s++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const u=Object.keys(o);if(u.length===1)l=u[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=o;r.items.push(yV(l,c,n))}return r}const OV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rLe,createNode:sLe};class dx extends Ey{constructor(){super(),this.add=Ru.prototype.add.bind(this),this.delete=Ru.prototype.delete.bind(this),this.get=Ru.prototype.get.bind(this),this.has=Ru.prototype.has.bind(this),this.set=Ru.prototype.set.bind(this),this.tag=dx.tag}toJSON(t,n){if(!n)return super.toJSON(t);const i=new Map;n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items){let s,o;if(bo(r)?(s=qu(r.key,"",n),o=qu(r.value,s,n)):s=qu(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(t,n,i){const r=sLe(t,n,i),s=new this;return s.items=r.items,s}}dx.tag="tag:yaml.org,2002:omap";const kV={collection:"seq",identify:e=>e instanceof Map,nodeClass:dx,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=rLe(e,t),i=[];for(const{key:r}of n.items)ns(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new dx,n)},createNode:(e,t,n)=>dx.from(e,t,n)};function oLe({value:e,source:t},n){return t&&(e?aLe:lLe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const aLe={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ii(!0),stringify:oLe},lLe={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ii(!1),stringify:oLe},HLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ud},qLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ud(e)}},WLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ii(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Ud},JC=e=>typeof e=="bigint"||Number.isInteger(e);function lD(e,t,n,{intAsBigInt:i}){const r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const o=BigInt(e);return r==="-"?BigInt(-1)*o:o}const s=parseInt(e,n);return r==="-"?-1*s:s}function SV(e,t,n){const{value:i}=e;if(JC(i)){const r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return Ud(e)}const KLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>lD(e,2,2,n),stringify:e=>SV(e,2,"0b")},GLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>lD(e,1,8,n),stringify:e=>SV(e,8,"0")},XLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>lD(e,0,10,n),stringify:Ud},YLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>lD(e,2,16,n),stringify:e=>SV(e,16,"0x")};class fx extends Ru{constructor(t){super(t),this.tag=fx.tag}add(t){let n;bo(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new _l(t.key,null):n=new _l(t,null),Lb(this.items,n.key)||this.items.push(n)}get(t,n){const i=Lb(this.items,t);return!n&&bo(i)?ns(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const i=Lb(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new _l(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){const{replacer:r}=i,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(yV(o,null,i));return s}}fx.tag="tag:yaml.org,2002:set";const EV={collection:"map",identify:e=>e instanceof Set,nodeClass:fx,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>fx.from(e,t,n),resolve(e,t){if(YC(e)){if(e.hasAllNullValues(!0))return Object.assign(new fx,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function CV(e,t){const n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,l)=>o*r(60)+r(l),r(0));return n==="-"?r(-1)*s:s}function cLe(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Ud(e);let i="";t<0&&(i="-",t*=n(-1));const r=n(60),s=[t%r];return t<60?s.unshift(0):(t=(t-s[0])/r,s.unshift(t%r),t>=60&&(t=(t-s[0])/r,s.unshift(t))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const uLe={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>CV(e,n),stringify:cLe},dLe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>CV(e,!1),stringify:cLe},cD={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(cD.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,r,s,o,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,i-1,r,s||0,o||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=CV(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},Yte=[l1,c1,sD,oD,aLe,lLe,KLt,GLt,XLt,YLt,HLt,qLt,WLt,wV,Zh,kV,OV,EV,uLe,dLe,cD],Zte=new Map([["core",ULt],["failsafe",[l1,c1,sD]],["json",VLt],["yaml11",Yte],["yaml-1.1",Yte]]),Jte={binary:wV,bool:vV,float:JMe,floatExp:ZMe,floatNaN:YMe,floatTime:dLe,int:nLe,intHex:iLe,intOct:tLe,intTime:uLe,map:l1,merge:Zh,null:oD,omap:kV,pairs:OV,seq:c1,set:EV,timestamp:cD},ZLt={"tag:yaml.org,2002:binary":wV,"tag:yaml.org,2002:merge":Zh,"tag:yaml.org,2002:omap":kV,"tag:yaml.org,2002:pairs":OV,"tag:yaml.org,2002:set":EV,"tag:yaml.org,2002:timestamp":cD};function n3(e,t,n){const i=Zte.get(t);if(i&&!e)return n&&!i.includes(Zh)?i.concat(Zh):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{const s=Array.from(Zte.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(const s of e)r=r.concat(s);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Zh)),r.reduce((s,o)=>{const l=typeof o=="string"?Jte[o]:o;if(!l){const c=JSON.stringify(o),u=Object.keys(Jte).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(l)||s.push(l),s},[])}const JLt=(e,t)=>e.keyt.key?1:0;let e5t=class fLe{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(t)?n3(t,"compat"):t?n3(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?ZLt:{},this.tags=n3(n,this.name,i),this.toStringOptions=l??null,Object.defineProperty(this,Hm,{value:l1}),Object.defineProperty(this,Lf,{value:sD}),Object.defineProperty(this,s1,{value:c1}),this.sortMapEntries=typeof o=="function"?o:o===!0?JLt:null}clone(){const t=Object.create(fLe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function t5t(e,t){var c;const n=[];let i=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const r=HMe(e,t),{commentString:s}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Fh(u,""))}let o=!1,l=null;if(e.contents){if(go(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Fh(f,""))}r.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>o=!0;let d=fw(e.contents,r,()=>l=null,u);l&&(d+=Mb(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(fw(e.contents,r));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=s(e.comment);u.includes(` +${s.comment}`:i.comment}i=r}e.items[n]=bo(i)?i:new _l(i)}}else t("Expected a sequence for this tag");return e}function sLe(e,t,n){const{replacer:i}=n,r=new Ey(e);r.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(s++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const u=Object.keys(o);if(u.length===1)l=u[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=o;r.items.push(yV(l,c,n))}return r}const OV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rLe,createNode:sLe};class dx extends Ey{constructor(){super(),this.add=Ru.prototype.add.bind(this),this.delete=Ru.prototype.delete.bind(this),this.get=Ru.prototype.get.bind(this),this.has=Ru.prototype.has.bind(this),this.set=Ru.prototype.set.bind(this),this.tag=dx.tag}toJSON(t,n){if(!n)return super.toJSON(t);const i=new Map;n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items){let s,o;if(bo(r)?(s=qu(r.key,"",n),o=qu(r.value,s,n)):s=qu(r,"",n),i.has(s))throw new Error("Ordered maps must not include duplicate keys");i.set(s,o)}return i}static from(t,n,i){const r=sLe(t,n,i),s=new this;return s.items=r.items,s}}dx.tag="tag:yaml.org,2002:omap";const kV={collection:"seq",identify:e=>e instanceof Map,nodeClass:dx,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=rLe(e,t),i=[];for(const{key:r}of n.items)ns(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new dx,n)},createNode:(e,t,n)=>dx.from(e,t,n)};function oLe({value:e,source:t},n){return t&&(e?aLe:lLe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const aLe={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ii(!0),stringify:oLe},lLe={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ii(!1),stringify:oLe},WLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ud},KLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ud(e)}},GLt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ii(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Ud},JC=e=>typeof e=="bigint"||Number.isInteger(e);function lD(e,t,n,{intAsBigInt:i}){const r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const o=BigInt(e);return r==="-"?BigInt(-1)*o:o}const s=parseInt(e,n);return r==="-"?-1*s:s}function SV(e,t,n){const{value:i}=e;if(JC(i)){const r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return Ud(e)}const XLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>lD(e,2,2,n),stringify:e=>SV(e,2,"0b")},YLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>lD(e,1,8,n),stringify:e=>SV(e,8,"0")},ZLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>lD(e,0,10,n),stringify:Ud},JLt={identify:JC,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>lD(e,2,16,n),stringify:e=>SV(e,16,"0x")};class fx extends Ru{constructor(t){super(t),this.tag=fx.tag}add(t){let n;bo(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new _l(t.key,null):n=new _l(t,null),Lb(this.items,n.key)||this.items.push(n)}get(t,n){const i=Lb(this.items,t);return!n&&bo(i)?ns(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const i=Lb(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new _l(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){const{replacer:r}=i,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),s.items.push(yV(o,null,i));return s}}fx.tag="tag:yaml.org,2002:set";const EV={collection:"map",identify:e=>e instanceof Set,nodeClass:fx,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>fx.from(e,t,n),resolve(e,t){if(YC(e)){if(e.hasAllNullValues(!0))return Object.assign(new fx,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function CV(e,t){const n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),s=i.replace(/_/g,"").split(":").reduce((o,l)=>o*r(60)+r(l),r(0));return n==="-"?r(-1)*s:s}function cLe(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Ud(e);let i="";t<0&&(i="-",t*=n(-1));const r=n(60),s=[t%r];return t<60?s.unshift(0):(t=(t-s[0])/r,s.unshift(t%r),t>=60&&(t=(t-s[0])/r,s.unshift(t))),i+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const uLe={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>CV(e,n),stringify:cLe},dLe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>CV(e,!1),stringify:cLe},cD={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(cD.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,r,s,o,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,i-1,r,s||0,o||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=CV(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},Yte=[l1,c1,sD,oD,aLe,lLe,XLt,YLt,ZLt,JLt,WLt,KLt,GLt,wV,Zh,kV,OV,EV,uLe,dLe,cD],Zte=new Map([["core",zLt],["failsafe",[l1,c1,sD]],["json",qLt],["yaml11",Yte],["yaml-1.1",Yte]]),Jte={binary:wV,bool:vV,float:JMe,floatExp:ZMe,floatNaN:YMe,floatTime:dLe,int:nLe,intHex:iLe,intOct:tLe,intTime:uLe,map:l1,merge:Zh,null:oD,omap:kV,pairs:OV,seq:c1,set:EV,timestamp:cD},e5t={"tag:yaml.org,2002:binary":wV,"tag:yaml.org,2002:merge":Zh,"tag:yaml.org,2002:omap":kV,"tag:yaml.org,2002:pairs":OV,"tag:yaml.org,2002:set":EV,"tag:yaml.org,2002:timestamp":cD};function n3(e,t,n){const i=Zte.get(t);if(i&&!e)return n&&!i.includes(Zh)?i.concat(Zh):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{const s=Array.from(Zte.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(const s of e)r=r.concat(s);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Zh)),r.reduce((s,o)=>{const l=typeof o=="string"?Jte[o]:o;if(!l){const c=JSON.stringify(o),u=Object.keys(Jte).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(l)||s.push(l),s},[])}const t5t=(e,t)=>e.keyt.key?1:0;let n5t=class fLe{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:s,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(t)?n3(t,"compat"):t?n3(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=r?e5t:{},this.tags=n3(n,this.name,i),this.toStringOptions=l??null,Object.defineProperty(this,Hm,{value:l1}),Object.defineProperty(this,Lf,{value:sD}),Object.defineProperty(this,s1,{value:c1}),this.sortMapEntries=typeof o=="function"?o:o===!0?t5t:null}clone(){const t=Object.create(fLe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function i5t(e,t){var c;const n=[];let i=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const r=HMe(e,t),{commentString:s}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Fh(u,""))}let o=!1,l=null;if(e.contents){if(go(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Fh(f,""))}r.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>o=!0;let d=fw(e.contents,r,()=>l=null,u);l&&(d+=Mb(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(fw(e.contents,r));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=s(e.comment);u.includes(` `)?(n.push("..."),n.push(Fh(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&o&&(u=u.replace(/^\n+/,"")),u&&((!o||l)&&n[n.length-1]!==""&&n.push(""),n.push(Fh(s(u),"")))}return n.join(` `)+` -`}class eT{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Zu,{value:k8});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i!=null&&i._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new xl({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){const t=Object.create(eT.prototype,{[Zu]:{value:k8}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=go(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){V0(this.contents)&&this.contents.add(t)}addIn(t,n){V0(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const i=BMe(this);t.anchor=!n||i.has(n)?UMe(n||"a",i):n}return new gV(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),r=n}else i===void 0&&n&&(i=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:u,tag:d}=i??{},{onAnchor:f,setAnchors:h,sourceObjects:m}=ALt(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:r,schema:this.schema,sourceObjects:m},b=pE(t,d,g);return l&&po(b)&&(b.flow=!0),h(),b}createPair(t,n,i={}){const r=this.createNode(t,null,i),s=this.createNode(n,null,i);return new _l(r,s)}delete(t){return V0(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ek(t)?this.contents==null?!1:(this.contents=null,!0):V0(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return po(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return ek(t)?!n&&ns(this.contents)?this.contents.value:this.contents:po(this.contents)?this.contents.getIn(t,n):void 0}has(t){return po(this.contents)?this.contents.has(t):!1}hasIn(t){return ek(t)?this.contents!==void 0:po(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=JN(this.schema,[t],n):V0(this.contents)&&this.contents.set(t,n)}setIn(t,n){ek(t)?this.contents=n:this.contents==null?this.contents=JN(this.schema,Array.from(t),n):V0(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new xl({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new xl({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{const r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new e5t(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:s,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=qu(this.contents,n??"",l);if(typeof s=="function")for(const{count:u,res:d}of l.anchors.values())s(d,u);return typeof o=="function"?Lv(o,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return t5t(this,t)}}function V0(e){if(po(e))return!0;throw new Error("Expected a YAML collection as document contents")}class hLe extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}}class tk extends hLe{constructor(t,n,i){super("YAMLParseError",t,n,i)}}class n5t extends hLe{constructor(t,n,i){super("YAMLWarning",t,n,i)}}const ene=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let s=r-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){const l=Math.min(s-39,o.length-79);o="…"+o.substring(l),s-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let l=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);l.length>80&&(l=l.substring(0,79)+`… +`}class eT{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Zu,{value:k8});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=s;let{version:o}=s;i!=null&&i._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new xl({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){const t=Object.create(eT.prototype,{[Zu]:{value:k8}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=go(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){V0(this.contents)&&this.contents.add(t)}addIn(t,n){V0(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const i=BMe(this);t.anchor=!n||i.has(n)?UMe(n||"a",i):n}return new gV(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),r=n}else i===void 0&&n&&(i=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:u,tag:d}=i??{},{onAnchor:f,setAnchors:h,sourceObjects:m}=jLt(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:r,schema:this.schema,sourceObjects:m},b=pE(t,d,g);return l&&po(b)&&(b.flow=!0),h(),b}createPair(t,n,i={}){const r=this.createNode(t,null,i),s=this.createNode(n,null,i);return new _l(r,s)}delete(t){return V0(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ek(t)?this.contents==null?!1:(this.contents=null,!0):V0(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return po(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return ek(t)?!n&&ns(this.contents)?this.contents.value:this.contents:po(this.contents)?this.contents.getIn(t,n):void 0}has(t){return po(this.contents)?this.contents.has(t):!1}hasIn(t){return ek(t)?this.contents!==void 0:po(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=JN(this.schema,[t],n):V0(this.contents)&&this.contents.set(t,n)}setIn(t,n){ek(t)?this.contents=n:this.contents==null?this.contents=JN(this.schema,Array.from(t),n):V0(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new xl({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new xl({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{const r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new n5t(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:s,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=qu(this.contents,n??"",l);if(typeof s=="function")for(const{count:u,res:d}of l.anchors.values())s(d,u);return typeof o=="function"?Lv(o,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return i5t(this,t)}}function V0(e){if(po(e))return!0;throw new Error("Expected a YAML collection as document contents")}class hLe extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}}class tk extends hLe{constructor(t,n,i){super("YAMLParseError",t,n,i)}}class r5t extends hLe{constructor(t,n,i){super("YAMLWarning",t,n,i)}}const ene=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let s=r-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){const l=Math.min(s-39,o.length-79);o="…"+o.substring(l),s-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,s))){let l=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);l.length>80&&(l=l.substring(0,79)+`… `),o=l+o}if(/[^ ]/.test(o)){let l=1;const c=n.linePos[1];(c==null?void 0:c.line)===i&&c.col>r&&(l=Math.max(1,Math.min(c.col-r,80-s)));const u=" ".repeat(s)+"^".repeat(l);n.message+=`: ${o} ${u} `}};function hw(e,{flow:t,indicator:n,next:i,offset:r,onError:s,parentIndent:o,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",m=!1,g=!1,b=null,v=null,y=null,x=null,w=null,O=null,S=null;for(const E of e)switch(g&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&s(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),b&&(u&&E.type!=="comment"&&E.type!=="newline"&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),E.type){case"space":!t&&(n!=="doc-start"||(i==null?void 0:i.type)!=="flow-collection")&&E.source.includes(" ")&&(b=E),d=!0;break;case"comment":{d||s(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const R=E.source.substring(1)||" ";f?f+=h+R:f=R,h="",u=!1;break}case"newline":u?f?f+=E.source:(!O||n!=="seq-item-ind")&&(c=!0):h+=E.source,u=!0,m=!0,(v||y)&&(x=E),d=!0;break;case"anchor":v&&s(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&s(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=E,S??(S=E.offset),u=!1,d=!1,g=!0;break;case"tag":{y&&s(E,"MULTIPLE_TAGS","A node can have at most one tag"),y=E,S??(S=E.offset),u=!1,d=!1,g=!0;break}case n:(v||y)&&s(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),O&&s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${t??"collection"}`),O=E,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){w&&s(E,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),w=E,u=!1,d=!1;break}default:s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),u=!1,d=!1}const k=e[e.length-1],C=k?k.offset+k.source.length:r;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&s(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=o||(i==null?void 0:i.type)==="block-map"||(i==null?void 0:i.type)==="block-seq")&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:O,spaceBefore:c,comment:f,hasNewline:m,anchor:v,tag:y,newlineAfterProp:x,end:C,start:S??C}}function mE(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(mE(t.key)||mE(t.value))return!0}return!1;default:return!0}}function T8(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&mE(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function pLe(e,t,n){const{uniqueKeys:i}=e.options;if(i===!1)return!1;const r=typeof i=="function"?i:(s,o)=>s===o||ns(s)&&ns(o)&&s.value===o.value;return t.some(s=>r(s.key,n))}const tne="All mapping items must start at the same column";function i5t({composeNode:e,composeEmptyNode:t},n,i,r,s){var d;const o=(s==null?void 0:s.nodeClass)??Ru,l=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,u=null;for(const f of i.items){const{start:h,key:m,sep:g,value:b}=f,v=hw(h,{indicator:"explicit-key-ind",next:m??(g==null?void 0:g[0]),offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),y=!v.found;if(y){if(m&&(m.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==i.indent&&r(c,"BAD_INDENT",tne)),!v.anchor&&!v.tag&&!g){u=v.end,v.comment&&(l.comment?l.comment+=` +`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(mE(t.key)||mE(t.value))return!0}return!1;default:return!0}}function T8(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&mE(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function pLe(e,t,n){const{uniqueKeys:i}=e.options;if(i===!1)return!1;const r=typeof i=="function"?i:(s,o)=>s===o||ns(s)&&ns(o)&&s.value===o.value;return t.some(s=>r(s.key,n))}const tne="All mapping items must start at the same column";function s5t({composeNode:e,composeEmptyNode:t},n,i,r,s){var d;const o=(s==null?void 0:s.nodeClass)??Ru,l=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,u=null;for(const f of i.items){const{start:h,key:m,sep:g,value:b}=f,v=hw(h,{indicator:"explicit-key-ind",next:m??(g==null?void 0:g[0]),offset:c,onError:r,parentIndent:i.indent,startOnNewline:!0}),y=!v.found;if(y){if(m&&(m.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==i.indent&&r(c,"BAD_INDENT",tne)),!v.anchor&&!v.tag&&!g){u=v.end,v.comment&&(l.comment?l.comment+=` `+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||mE(m))&&r(m??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=v.found)==null?void 0:d.indent)!==i.indent&&r(c,"BAD_INDENT",tne);n.atKey=!0;const x=v.end,w=m?e(n,m,v,r):t(n,x,h,null,v,r);n.schema.compat&&T8(i.indent,m,r),n.atKey=!1,pLe(n,l.items,w)&&r(x,"DUPLICATE_KEY","Map keys must be unique");const O=hw(g??[],{indicator:"map-value-ind",next:b,offset:w.range[2],onError:r,parentIndent:i.indent,startOnNewline:!m||m.type==="block-scalar"});if(c=O.end,O.found){y&&((b==null?void 0:b.type)==="block-map"&&!O.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&v.starte&&(e.type==="block-map"||e.type==="block-seq");function s5t({composeNode:e,composeEmptyNode:t},n,i,r,s){var v;const o=i.start.source==="{",l=o?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(o?Ru:Ey),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;ye&&(e.type==="block-map"||e.type==="block-seq");function a5t({composeNode:e,composeEmptyNode:t},n,i,r,s){var v;const o=i.start.source==="{",l=o?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(o?Ru:Ey),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;y0){const y=tT(g,b,n.options.strict,r);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[i.offset,b,y.offset]}else u.range=[i.offset,b,b];return u}function s3(e,t,n,i,r,s){const o=n.type==="block-map"?i5t(e,t,n,i,s):n.type==="block-seq"?r5t(e,t,n,i,s):s5t(e,t,n,i,s),l=o.constructor;return r==="!"||r===l.tagName?(o.tag=l.tagName,o):(r&&(o.tag=r),o)}function o5t(e,t,n,i,r){var h;const s=i.tag,o=s?t.directives.tagName(s.source,m=>r(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){const{anchor:m,newlineAfterProp:g}=i,b=m&&s?m.offset>s.offset?m:s:m??s;b&&(!g||g.offsetm.tag===o&&m.collection===l);if(!c){const m=t.schema.knownTags[o];if((m==null?void 0:m.collection)===l)t.schema.tags.push(Object.assign({},m,{default:!1})),c=m;else return m?r(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${l} collection, but expects ${m.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),s3(e,t,n,r,o)}const u=s3(e,t,n,r,o,c),d=((h=c.resolve)==null?void 0:h.call(c,u,m=>r(s,"TAG_RESOLVE_FAILED",m),t.options))??u,f=go(d)?d:new ii(d);return f.range=u.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function a5t(e,t,n){const i=t.offset,r=l5t(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};const s=r.mode===">"?ii.BLOCK_FOLDED:ii.BLOCK_LITERAL,o=t.source?c5t(t.source):[];let l=o.length;for(let b=o.length-1;b>=0;--b){const v=o[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=r.chomp==="+"&&o.length>0?` +`+y.comment:u.comment=y.comment),u.range=[i.offset,b,y.offset]}else u.range=[i.offset,b,b];return u}function s3(e,t,n,i,r,s){const o=n.type==="block-map"?s5t(e,t,n,i,s):n.type==="block-seq"?o5t(e,t,n,i,s):a5t(e,t,n,i,s),l=o.constructor;return r==="!"||r===l.tagName?(o.tag=l.tagName,o):(r&&(o.tag=r),o)}function l5t(e,t,n,i,r){var h;const s=i.tag,o=s?t.directives.tagName(s.source,m=>r(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){const{anchor:m,newlineAfterProp:g}=i,b=m&&s?m.offset>s.offset?m:s:m??s;b&&(!g||g.offsetm.tag===o&&m.collection===l);if(!c){const m=t.schema.knownTags[o];if((m==null?void 0:m.collection)===l)t.schema.tags.push(Object.assign({},m,{default:!1})),c=m;else return m?r(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${l} collection, but expects ${m.collection??"scalar"}`,!0):r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),s3(e,t,n,r,o)}const u=s3(e,t,n,r,o,c),d=((h=c.resolve)==null?void 0:h.call(c,u,m=>r(s,"TAG_RESOLVE_FAILED",m),t.options))??u,f=go(d)?d:new ii(d);return f.range=u.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function c5t(e,t,n){const i=t.offset,r=u5t(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};const s=r.mode===">"?ii.BLOCK_FOLDED:ii.BLOCK_LITERAL,o=t.source?d5t(t.source):[];let l=o.length;for(let b=o.length-1;b>=0;--b){const v=o[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=r.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"";let v=i+r.length;return t.source&&(v+=t.source.length),{value:b,type:s,comment:r.comment,range:[i,v,v]}}let c=t.indent+r.indent,u=t.offset+r.length,d=0;for(let b=0;bc&&(c=v.length);else{v.length=l;--b)o[b][0].length>c&&(l=b+1);let f="",h="",m=!1;for(let b=0;bc||y[0]===" "?(h===" "?h=` @@ -660,33 +660,33 @@ ${u} `+o[b][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const g=i+r.length+t.source.length;return{value:f,type:s,comment:r.comment,range:[i,g,g]}}function l5t({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=t[0],s=r[0];let o=0,l="",c=-1;for(let h=1;hn(i+h,m,g);switch(r){case"scalar":l=ii.PLAIN,c=d5t(s,u);break;case"single-quoted-scalar":l=ii.QUOTE_SINGLE,c=f5t(s,u);break;case"double-quoted-scalar":l=ii.QUOTE_DOUBLE,c=h5t(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}const d=i+s.length,f=tT(o,d,t,n);return{value:c,type:l,comment:f.comment,range:[i,d,f.offset]}}function d5t(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),mLe(e)}function f5t(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),mLe(e.slice(1,-1)).replace(/''/g,"'")}function mLe(e){let t,n;try{t=new RegExp(`(.*?)(?n(i+h,m,g);switch(r){case"scalar":l=ii.PLAIN,c=h5t(s,u);break;case"single-quoted-scalar":l=ii.QUOTE_SINGLE,c=p5t(s,u);break;case"double-quoted-scalar":l=ii.QUOTE_DOUBLE,c=m5t(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+s.length,i+s.length]}}const d=i+s.length,f=tT(o,d,t,n);return{value:c,type:l,comment:f.comment,range:[i,d,f.offset]}}function h5t(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),mLe(e)}function p5t(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),mLe(e.slice(1,-1)).replace(/''/g,"'")}function mLe(e){let t,n;try{t=new RegExp(`(.*?)(?s?e.slice(s,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function p5t(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===` +`)&&(n+=i>s?e.slice(s,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function g5t(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===` `||i==="\r")&&!(i==="\r"&&e[t+2]!==` `);)i===` `&&(n+=` -`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}const m5t={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function g5t(e,t,n,i){const r=e.substr(t,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{const l=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function gLe(e,t,n,i){const{value:r,type:s,comment:o,range:l}=t.type==="block-scalar"?a5t(e,t,i):u5t(t,e.options.strict,i),c=n?e.directives.tagName(n.source,f=>i(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Lf]:c?u=b5t(e.schema,r,c,n,i):t.type==="scalar"?u=y5t(e,r,t,i):u=e.schema[Lf];let d;try{const f=u.resolve(r,h=>i(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=ns(f)?f:new ii(f)}catch(f){const h=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",h),d=new ii(r)}return d.range=l,d.source=r,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),o&&(d.comment=o),d}function b5t(e,t,n,i,r){var l;if(n==="!")return e[Lf];const s=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(const c of s)if((l=c.test)!=null&&l.test(t))return c;const o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Lf])}function y5t({atKey:e,directives:t,schema:n},i,r,s){const o=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(i))})||n[Lf];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(i))})??n[Lf];if(o.tag!==l.tag){const c=t.tagString(o.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;s(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}function v5t(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];(r==null?void 0:r.type)==="space";)e+=r.source.length,r=t[++i];break}}return e}const x5t={composeNode:bLe,composeEmptyNode:TV};function bLe(e,t,n,i){const r=e.atKey,{spaceBefore:s,comment:o,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=w5t(e,t,i),(l||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=gLe(e,t,c,i),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=o5t(x5t,e,t,n,i),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=TV(e,t.offset,void 0,null,n,i)),l&&u.anchor===""&&i(l,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!ns(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?u.comment=o:u.commentBefore=o),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function TV(e,t,n,i,{spaceBefore:r,comment:s,anchor:o,tag:l,end:c},u){const d={type:"scalar",offset:v5t(t,n,i),indent:-1,source:""},f=gLe(e,d,l,u);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=c),f}function w5t({options:e},{offset:t,source:n,end:i},r){const s=new gV(n.substring(1));s.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+n.length,l=tT(i,o,e.strict,r);return s.range=[t,o,l.offset],l.comment&&(s.comment=l.comment),s}function O5t(e,t,{offset:n,start:i,value:r,end:s},o){const l=Object.assign({_directives:t},e),c=new eT(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=hw(i,{indicator:"doc-start",next:r??(s==null?void 0:s[0]),offset:n,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?bLe(u,r,d,o):TV(u,d.end,i,null,d,o);const f=c.contents.range[2],h=tT(s,f,!1,o);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function fO(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function nne(e){var r;let t="",n=!1,i=!1;for(let s=0;si(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Lf]:c?u=v5t(e.schema,r,c,n,i):t.type==="scalar"?u=x5t(e,r,t,i):u=e.schema[Lf];let d;try{const f=u.resolve(r,h=>i(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=ns(f)?f:new ii(f)}catch(f){const h=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",h),d=new ii(r)}return d.range=l,d.source=r,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),o&&(d.comment=o),d}function v5t(e,t,n,i,r){var l;if(n==="!")return e[Lf];const s=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(const c of s)if((l=c.test)!=null&&l.test(t))return c;const o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Lf])}function x5t({atKey:e,directives:t,schema:n},i,r,s){const o=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(i))})||n[Lf];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(i))})??n[Lf];if(o.tag!==l.tag){const c=t.tagString(o.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;s(r,"TAG_RESOLVE_FAILED",d,!0)}}return o}function w5t(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];(r==null?void 0:r.type)==="space";)e+=r.source.length,r=t[++i];break}}return e}const O5t={composeNode:bLe,composeEmptyNode:TV};function bLe(e,t,n,i){const r=e.atKey,{spaceBefore:s,comment:o,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=k5t(e,t,i),(l||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=gLe(e,t,c,i),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=l5t(O5t,e,t,n,i),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=TV(e,t.offset,void 0,null,n,i)),l&&u.anchor===""&&i(l,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!ns(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?u.comment=o:u.commentBefore=o),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function TV(e,t,n,i,{spaceBefore:r,comment:s,anchor:o,tag:l,end:c},u){const d={type:"scalar",offset:w5t(t,n,i),indent:-1,source:""},f=gLe(e,d,l,u);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=c),f}function k5t({options:e},{offset:t,source:n,end:i},r){const s=new gV(n.substring(1));s.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+n.length,l=tT(i,o,e.strict,r);return s.range=[t,o,l.offset],l.comment&&(s.comment=l.comment),s}function S5t(e,t,{offset:n,start:i,value:r,end:s},o){const l=Object.assign({_directives:t},e),c=new eT(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=hw(i,{indicator:"doc-start",next:r??(s==null?void 0:s[0]),offset:n,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?bLe(u,r,d,o):TV(u,d.end,i,null,d,o);const f=c.contents.range[2],h=tT(s,f,!1,o);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function fO(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function nne(e){var r;let t="",n=!1,i=!1;for(let s=0;s{const o=fO(n);s?this.warnings.push(new n5t(o,i,r)):this.errors.push(new tk(o,i,r))},this.directives=new xl({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:i,afterEmptyLine:r}=nne(this.prelude);if(i){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} +`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":((r=e[s+1])==null?void 0:r[0])!=="#"&&(s+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}let E5t=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,s)=>{const o=fO(n);s?this.warnings.push(new r5t(o,i,r)):this.errors.push(new tk(o,i,r))},this.directives=new xl({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:i,afterEmptyLine:r}=nne(this.prelude);if(i){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} ${i}`:i;else if(r||t.directives.docStart||!s)t.commentBefore=i;else if(po(s)&&!s.flow&&s.items.length>0){let o=s.items[0];bo(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${i} ${l}`:i}else{const o=s.commentBefore;s.commentBefore=o?`${i} -${o}`:i}}if(n){for(let s=0;s{const s=fO(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=O5t(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new tk(fO(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){const i="Unexpected doc-end without preceding document";this.errors.push(new tk(fO(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;const n=tT(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const i=this.doc.comment;this.doc.comment=i?`${i} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tk(fO(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const i=Object.assign({_directives:this.directives},this.options),r=new eT(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};const yLe="\uFEFF",vLe="",xLe="",A8="";function S5t(e){switch(e){case yLe:return"byte-order-mark";case vLe:return"doc-mode";case xLe:return"flow-error-end";case A8:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${o}`:i}}if(n){for(let s=0;s{const s=fO(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=S5t(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new tk(fO(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){const i="Unexpected doc-end without preceding document";this.errors.push(new tk(fO(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;const n=tT(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const i=this.doc.comment;this.doc.comment=i?`${i} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tk(fO(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const i=Object.assign({_directives:this.directives},this.options),r=new eT(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};const yLe="\uFEFF",vLe="",xLe="",A8="";function C5t(e){switch(e){case yLe:return"byte-order-mark";case vLe:return"doc-mode";case xLe:return"flow-error-end";case A8:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function cd(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const ine=new Set("0123456789ABCDEFabcdef"),E5t=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),l2=new Set(",[]{}"),C5t=new Set(` ,[]{} -\r `),o3=e=>!e||C5t.has(e);class T5t{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`:case"\r":case" ":return!0;default:return!1}}const ine=new Set("0123456789ABCDEFabcdef"),T5t=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),l2=new Set(",[]{}"),A5t=new Set(` ,[]{} +\r `),o3=e=>!e||A5t.has(e);class _5t{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){const r=this.buffer[i+t+1];if(r===` `||!r&&!this.atEnd)return t+i+1}return n===` @@ -701,25 +701,25 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `&&s>=this.pos&&s+1+n>l)t=s;else break}while(!0);return yield A8,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){const s=this.buffer[i+1];if(cd(s)||t&&l2.has(s))break;n=i}else if(cd(r)){let s=this.buffer[i+1];if(r==="\r"&&(s===` `?(i+=1,r=` `,s=this.buffer[i+1]):n=i),s==="#"||t&&l2.has(s))break;if(r===` -`){const o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&l2.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield A8,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(o3),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,i=this.charAt(1);if(cd(i)||n&&l2.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!cd(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(E5t.has(n))n=this.buffer[++t];else if(n==="%"&&ine.has(this.buffer[t+1])&&ine.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` +`){const o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&l2.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield A8,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(o3),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,i=this.charAt(1);if(cd(i)||n&&l2.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!cd(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(T5t.has(n))n=this.buffer[++t];else if(n==="%"&&ine.has(this.buffer[t+1])&&ine.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");const r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class A5t{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n>1;this.lineStarts[s]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function tR(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&sne(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{const r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{const r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&rne(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class j5t{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n>1;this.lineStarts[s]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function tR(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&sne(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{const r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{const r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&rne(r.start)===-1&&(n.indent===0||r.start.every(s=>s.type!=="comment"||s.indent=t.indent){const r=!this.onKeyLine&&this.indent===t.indent,s=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(s&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(o=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(am(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(wLe(n.key)&&!am(n.sep,"newline")){const l=H0(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:c,sep:u}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(am(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=H0(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?t.items.push({start:o,key:null,sep:[this.sourceToken]}):am(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);s||n.value?(t.items.push({start:o,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!am(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:o});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var i;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0,s=Array.isArray(r)?r[r.length-1]:void 0;(s==null?void 0:s.type)==="comment"?r==null||r.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const r=t.items[t.items.length-2],s=(i=r==null?void 0:r.value)==null?void 0:i.end;if(Array.isArray(s)){tR(s,n.start),s.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||am(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while((i==null?void 0:i.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{const i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){const r=c2(i),s=H0(r);sne(t);const o=t.end.splice(1,t.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` -`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=c2(t),i=H0(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=c2(t),i=H0(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function j5t(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new A5t||null,prettyErrors:t}}function OLe(e,t={}){const{lineCounter:n,prettyErrors:i}=j5t(t),r=new _5t(n==null?void 0:n.addNewLine),s=new k5t(t);let o=null;for(const l of s.compose(r.parse(e),!0,e.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new tk(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(ene(e,n)),o.warnings.forEach(ene(e,n))),o}function N5t(e,t,n){let i;const r=OLe(e,n);if(!r)return null;if(r.warnings.forEach(s=>qMe(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function uD(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){const{keepUndefined:r}=n??t??{};if(!r)return}return XC(e)&&!i?e.toString(n):new eT(e,i,n).toString(n)}const kLe=1024;let R5t=0,Du=class{constructor(t,n){this.from=t,this.to=n}};class Kn{constructor(t={}){this.id=R5t++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Po.match(t)),n=>{let i=t(n);return i===void 0?null:[this,i]}}}Kn.closedBy=new Kn({deserialize:e=>e.split(" ")});Kn.openedBy=new Kn({deserialize:e=>e.split(" ")});Kn.group=new Kn({deserialize:e=>e.split(" ")});Kn.isolate=new Kn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Kn.contextHash=new Kn({perNode:!0});Kn.lookAhead=new Kn({perNode:!0});Kn.mounted=new Kn({perNode:!0});class hx{constructor(t,n,i,r=!1){this.tree=t,this.overlay=n,this.parser=i,this.bracketed=r}static get(t){return t&&t.props&&t.props[Kn.mounted.id]}}const I5t=Object.create(null);class Po{constructor(t,n,i,r=0){this.name=t,this.props=n,this.id=i,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):I5t,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Po(t.name||"",n,t.id,i);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(Kn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let i in t)for(let r of i.split(" "))n[r]=t[i];return i=>{for(let r=i.prop(Kn.group),s=-1;s<(r?r.length:0);s++){let o=n[s<0?i.name:r[s]];if(o)return o}}}}Po.none=new Po("",Object.create(null),0,8);class u1{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(o|cr.IncludeAnonymous);;){let u=!1;if(c.from<=s&&c.to>=r&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&i&&(l||!c.type.isAnonymous)&&i(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:jV(Po.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,r)=>new Ci(this.type,n,i,r,this.propValues),t.makeTree||((n,i,r)=>new Ci(Po.none,n,i,r)))}static build(t){return L5t(t)}}Ci.empty=new Ci(Po.none,[],[],0);class AV{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new AV(this.buffer,this.index)}}class pg{constructor(t,n,i){this.buffer=t,this.length=n,this.set=i}get type(){return Po.none}toString(){let t=[];for(let n=0;n0));c=o[c+3]);return l}slice(t,n,i){let r=this.buffer,s=new Uint16Array(n-t),o=0;for(let l=t,c=0;l=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function gE(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+o.from,h;if(!(!(s&cr.EnterBracketed&&d instanceof Ci&&(h=hx.get(d))&&!h.overlay&&h.bracketed&&i>=f&&i<=f+d.length)&&!SLe(r,i,f,f+d.length))){if(d instanceof pg){if(s&cr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,i-f,r);if(m>-1)return new wf(new P5t(o,d,t,f),null,m)}else if(s&cr.IncludeAnonymous||!d.type.isAnonymous||_V(d)){let m;if(!(s&cr.IgnoreMounts)&&(m=hx.get(d))&&!m.overlay)return new ol(m.tree,f,t,o);let g=new ol(d,f,t,o);return s&cr.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,i,r,s)}}}if(s&cr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,i=0){let r;if(!(i&cr.IgnoreOverlays)&&(r=hx.get(this._tree))&&r.overlay){let s=t-this.from,o=i&cr.EnterBracketed&&r.bracketed;for(let{from:l,to:c}of r.overlay)if((n>0||o?l<=s:l=s:c>s))return new ol(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ane(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function _8(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class P5t{constructor(t,n,i,r){this.parent=t,this.buffer=n,this.index=i,this.start=r}}class wf extends ELe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,i){super(),this.context=t,this._parent=n,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,n,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,i);return s<0?null:new wf(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,i=0){if(i&cr.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new wf(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new wf(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new wf(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];t.push(i.slice(r,s,o)),n.push(0)}return new Ci(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function CLe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||o.to=t){let l=new ol(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(gE(l,t,n,!1))}}return r?CLe(r):i}class nR{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~cr.EnterBracketed,t instanceof ol)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:i,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}yield(t){return t?t instanceof ol?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,i=this.mode){return this.buffer?i&cr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&cr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&cr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,i=this.stack.length-1;if(t<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,i,{buffer:r}=this;if(r){if(t>0){if(this.index-1)for(let s=n+t,o=t<0?-1:i._tree.children.length;s!=o;s+=t){let l=i._tree.children[s];if(this.mode&cr.IncludeAnonymous||l instanceof pg||!l.type.isAnonymous||_V(l))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r=0;s--){if(s<0)return _8(this._tree,t,r);let o=i[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function _V(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||_V(t))}function L5t(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=kLe,reused:s=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(n)?new AV(n,n.length):n,c=i.types,u=0,d=0;function f(S,k,C,E,R,_){let{id:j,start:T,end:N,size:A}=l,P=d,D=u;if(A<0)if(l.next(),A==-1){let H=s[j];C.push(H),E.push(T-S);return}else if(A==-3){u=j;return}else if(A==-4){d=j;return}else throw new RangeError(`Unrecognized record size: ${A}`);let M=c[j],L,U,I=T-S;if(N-T<=r&&(U=v(l.pos-k,R))){let H=new Uint16Array(U.size-U.skip),K=l.pos-U.size,F=H.length;for(;l.pos>K;)F=y(U.start,H,F);L=new pg(H,N-U.start,i),I=U.start-S}else{let H=l.pos-A;l.next();let K=[],F=[],W=j>=o?j:-1,V=0,X=N;for(;l.pos>H;)W>=0&&l.id==W&&l.size>=0?(l.end<=X-r&&(g(K,F,T,V,l.end,X,W,P,D),V=K.length,X=l.end),l.next()):_>2500?h(T,H,K,F):f(T,H,K,F,W,_+1);if(W>=0&&V>0&&V-1&&V>0){let ie=m(M,D);L=jV(M,K,F,0,K.length,0,N-T,ie,ie)}else L=b(M,K,F,N-T,P-N,D)}C.push(L),E.push(I)}function h(S,k,C,E){let R=[],_=0,j=-1;for(;l.pos>k;){let{id:T,start:N,end:A,size:P}=l;if(P>4)l.next();else{if(j>-1&&N=0;A-=3)T[P++]=R[A],T[P++]=R[A+1]-N,T[P++]=R[A+2]-N,T[P++]=P;C.push(new pg(T,R[2]-N,i)),E.push(N-S)}}function m(S,k){return(C,E,R)=>{let _=0,j=C.length-1,T,N;if(j>=0&&(T=C[j])instanceof Ci){if(!j&&T.type==S&&T.length==R)return T;(N=T.prop(Kn.lookAhead))&&(_=E[j]+T.length+N)}return b(S,C,E,R,_,k)}}function g(S,k,C,E,R,_,j,T,N){let A=[],P=[];for(;S.length>E;)A.push(S.pop()),P.push(k.pop()+C-R);S.push(b(i.types[j],A,P,_-R,T-_,N)),k.push(R-C)}function b(S,k,C,E,R,_,j){if(_){let T=[Kn.contextHash,_];j=j?[T].concat(j):[T]}if(R>25){let T=[Kn.lookAhead,R];j=j?[T].concat(j):[T]}return new Ci(S,k,C,E,j)}function v(S,k){let C=l.fork(),E=0,R=0,_=0,j=C.end-r,T={size:0,start:0,skip:0};e:for(let N=C.pos-S;C.pos>N;){let A=C.size;if(C.id==k&&A>=0){T.size=E,T.start=R,T.skip=_,_+=4,E+=4,C.next();continue}let P=C.pos-A;if(A<0||P=o?4:0,M=C.start;for(C.next();C.pos>P;){if(C.size<0)if(C.size==-3||C.size==-4)D+=4;else break e;else C.id>=o&&(D+=4);C.next()}R=M,E+=A,_+=D}return(k<0||E==S)&&(T.size=E,T.start=R,T.skip=_),T.size>4?T:void 0}function y(S,k,C){let{id:E,start:R,end:_,size:j}=l;if(l.next(),j>=0&&E4){let N=l.pos-(j-4);for(;l.pos>N;)C=y(S,k,C)}k[--C]=T,k[--C]=_-S,k[--C]=R-S,k[--C]=E}else j==-3?u=E:j==-4&&(d=E);return C}let x=[],w=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,x,w,-1,0);let O=(t=e.length)!==null&&t!==void 0?t:x.length?w[0]+x[0].length:0;return new Ci(c[e.topID],x.reverse(),w.reverse(),O)}const lne=new WeakMap;function tj(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let n=lne.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Ci)){n=1;break}n+=tj(e,i)}lne.set(t,n)}return n}function jV(e,t,n,i,r,s,o,l,c){let u=0;for(let g=i;g=d)break;k+=C}if(w==O+1){if(k>d){let C=g[O];m(C.children,C.positions,0,C.children.length,b[O]+x);continue}f.push(g[O])}else{let C=b[w-1]+g[w-1].length-S;f.push(jV(e,g,b,O,w,S,C,null,c))}h.push(S+x-s)}}return m(t,n,i,r,0),(l||c)(f,h,o)}class NV{constructor(){this.map=new WeakMap}setBuffer(t,n,i){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(n,i)}getBuffer(t,n){let i=this.map.get(t);return i&&i.get(n)}set(t,n){t instanceof wf?this.setBuffer(t.context.buffer,t.index,n):t instanceof ol&&this.map.set(t.tree,n)}get(t){return t instanceof wf?this.getBuffer(t.context.buffer,t.index):t instanceof ol?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Jh{constructor(t,n,i,r,s=!1,o=!1){this.from=t,this.to=n,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],i=!1){let r=[new Jh(0,t.length,t,0,!1,i)];for(let s of n)s.to>t.length&&r.push(s);return r}static applyChanges(t,n,i=128){if(!n.length)return t;let r=[],s=1,o=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=i)for(;o&&o.from=h.from||f<=h.to||u){let m=Math.max(h.from,c)-u,g=Math.min(h.to,f)-u;h=m>=g?null:new Jh(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&r.push(h),o.to>f)break;o=snew Du(r.from,r.to)):[new Du(0,0)]:[new Du(0,t.length)],this.createParse(t,n||[],i)}parse(t,n,i){let r=this.startParse(t,n,i);for(;;){let s=r.advance();if(s)return s}}}class $5t{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function TLe(e){return(t,n,i,r)=>new B5t(t,e,n,i,r)}class cne{constructor(t,n,i,r,s,o){this.parser=t,this.parse=n,this.overlay=i,this.bracketed=r,this.target=s,this.from=o}}function une(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class F5t{constructor(t,n,i,r,s,o,l,c){this.parser=t,this.predicate=n,this.mounts=i,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const j8=new Kn({perNode:!0});class B5t{constructor(t,n,i,r,s){this.nest=n,this.input=i,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Ci(i.type,i.children,i.positions,i.length,i.propValues.concat([[j8,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[Kn.mounted.id]=new hx(n,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)l=!1;else if(t.hasNode(r)){if(n){let u=n.mounts.find(d=>d.frag.from<=r.from&&d.frag.to>=r.to&&d.mount.overlay);if(u)for(let d of u.mount.overlay){let f=d.from+u.pos,h=d.to+u.pos;f>=r.from&&h<=r.to&&!n.ranges.some(m=>m.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(i&&(o=U5t(i.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Du(f.from-r.from,f.to-r.from)):null,!!s.bracketed,r.tree,d.length?d[0].from:r.from)),s.overlay?d.length&&(i={ranges:d,depth:0,prev:i}):l=!1}}else if(n&&(c=n.predicate(r))&&(c===!0&&(c=new Du(r.from,r.to)),c.from=0&&n.ranges[u].to==c.from?n.ranges[u]={from:n.ranges[u].from,to:c.to}:n.ranges.push(c)}if(l&&r.firstChild())n&&n.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(n&&!--n.depth){let u=hne(this.ranges,n.ranges);u.length&&(une(u),this.inner.splice(n.index,0,new cne(n.parser,n.parser.startParse(this.input,pne(n.mounts,u),u),n.ranges.map(d=>new Du(d.from-n.start,d.to-n.start)),n.bracketed,n.target,u[0].from))),n=n.prev}i&&!--i.depth&&(i=i.prev)}}}}function U5t(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function dne(e,t,n,i,r,s){if(t=t&&n.enter(i,1,cr.IgnoreOverlays|cr.ExcludeBuffers)))if(n.to<=t)n.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Ci)n=n.children[0];else break}return!1}}let z5t=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(n=i.tree.prop(j8))!==null&&n!==void 0?n:i.to,this.inner=new fne(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(j8))!==null&&t!==void 0?t:n.to,this.inner=new fne(n.tree,-n.offset)}}findMounts(t,n){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(Kn.mounted);if(o&&o.parser==n)for(let l=this.fragI;l=s.to)break;c.tree==this.curFrag.tree&&r.push({frag:c,pos:s.from-c.offset,mount:o})}}}return r}};function hne(e,t){let n=null,i=t;for(let r=1,s=0;r=l)break;c.to<=o||(n||(i=n=t.slice()),c.froml&&n.splice(s+1,0,new Du(l,c.to))):c.to>l?n[s--]=new Du(l,c.to):n.splice(s--,1))}}return i}function V5t(e,t,n,i){let r=0,s=0,o=!1,l=!1,c=-1e9,u=[];for(;;){let d=r==e.length?1e9:o?e[r].to:e[r].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(o!=l){let h=Math.max(c,n),m=Math.min(d,f,i);hnew Du(h.from+i,h.to+i)),f=V5t(t,d,c,u);for(let h=0,m=c;;h++){let g=h==f.length,b=g?u:f[h].from;if(b>m&&n.push(new Jh(m,b,r.tree,-o,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new Jh(c,u,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return n}let N8=[],ALe=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t>1;if(e=ALe[i])t=i+1;else return!0;if(t==n)return!1}}function mne(e){return e>=127462&&e<=127487}const gne=8205;function q5t(e,t,n=!0,i=!0){return(n?_Le:W5t)(e,t,i)}function _Le(e,t,n){if(t==e.length)return t;t&&jLe(e.charCodeAt(t))&&NLe(e.charCodeAt(t-1))&&t--;let i=a3(e,t);for(t+=bne(i);t=0&&mne(a3(e,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function W5t(e,t,n){for(;t>1;){let i=_Le(e,t-2,n);if(i=56320&&e<57344}function NLe(e){return e>=55296&&e<56320}function bne(e){return e<65536?1:2}let sr=class RLe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,i){[t,n]=pw(this,t,n);let r=[];return this.decompose(0,t,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),ff.from(r,this.length-(n-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=pw(this,t,n);let i=[];return this.decompose(t,n,i,0),ff.from(i,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),r=new Jk(this),s=new Jk(t);for(let o=n,l=n;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(t=1){return new Jk(this,t)}iterRange(t,n=this.length){return new ILe(this,t,n)}iterLines(t,n){let i;if(t==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new PLe(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?RLe.empty:t.length<=32?new ao(t):ff.from(ao.split(t,[]))}};class ao extends sr{constructor(t,n=K5t(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((n?i:l)>=t)return new G5t(r,l,i,o);r=l+1,i++}}decompose(t,n,i,r){let s=t<=0&&n>=this.length?this:new ao(yne(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=i.pop(),l=nj(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ao(l,o.length+s.length));else{let c=l.length>>1;i.push(new ao(l.slice(0,c)),new ao(l.slice(c)))}}else i.push(s)}replace(t,n,i){if(!(i instanceof ao))return super.replace(t,n,i);[t,n]=pw(this,t,n);let r=nj(this.text,nj(i.text,yne(this.text,0,t)),n),s=this.length+i.length-(n-t);return r.length<=32?new ao(r,s):ff.from(ao.split(r,[]),s)}sliceString(t,n=this.length,i=` +`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=c2(t),i=H0(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=c2(t),i=H0(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function R5t(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new j5t||null,prettyErrors:t}}function OLe(e,t={}){const{lineCounter:n,prettyErrors:i}=R5t(t),r=new N5t(n==null?void 0:n.addNewLine),s=new E5t(t);let o=null;for(const l of s.compose(r.parse(e),!0,e.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new tk(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(ene(e,n)),o.warnings.forEach(ene(e,n))),o}function I5t(e,t,n){let i;const r=OLe(e,n);if(!r)return null;if(r.warnings.forEach(s=>qMe(r.options.logLevel,s)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function uD(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){const{keepUndefined:r}=n??t??{};if(!r)return}return XC(e)&&!i?e.toString(n):new eT(e,i,n).toString(n)}const kLe=1024;let P5t=0,Du=class{constructor(t,n){this.from=t,this.to=n}};class Kn{constructor(t={}){this.id=P5t++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Po.match(t)),n=>{let i=t(n);return i===void 0?null:[this,i]}}}Kn.closedBy=new Kn({deserialize:e=>e.split(" ")});Kn.openedBy=new Kn({deserialize:e=>e.split(" ")});Kn.group=new Kn({deserialize:e=>e.split(" ")});Kn.isolate=new Kn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Kn.contextHash=new Kn({perNode:!0});Kn.lookAhead=new Kn({perNode:!0});Kn.mounted=new Kn({perNode:!0});class hx{constructor(t,n,i,r=!1){this.tree=t,this.overlay=n,this.parser=i,this.bracketed=r}static get(t){return t&&t.props&&t.props[Kn.mounted.id]}}const D5t=Object.create(null);class Po{constructor(t,n,i,r=0){this.name=t,this.props=n,this.id=i,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):D5t,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new Po(t.name||"",n,t.id,i);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(Kn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let i in t)for(let r of i.split(" "))n[r]=t[i];return i=>{for(let r=i.prop(Kn.group),s=-1;s<(r?r.length:0);s++){let o=n[s<0?i.name:r[s]];if(o)return o}}}}Po.none=new Po("",Object.create(null),0,8);class u1{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(o|cr.IncludeAnonymous);;){let u=!1;if(c.from<=s&&c.to>=r&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&i&&(l||!c.type.isAnonymous)&&i(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:jV(Po.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,r)=>new Ci(this.type,n,i,r,this.propValues),t.makeTree||((n,i,r)=>new Ci(Po.none,n,i,r)))}static build(t){return F5t(t)}}Ci.empty=new Ci(Po.none,[],[],0);class AV{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new AV(this.buffer,this.index)}}class pg{constructor(t,n,i){this.buffer=t,this.length=n,this.set=i}get type(){return Po.none}toString(){let t=[];for(let n=0;n0));c=o[c+3]);return l}slice(t,n,i){let r=this.buffer,s=new Uint16Array(n-t),o=0;for(let l=t,c=0;l=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function gE(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+o.from,h;if(!(!(s&cr.EnterBracketed&&d instanceof Ci&&(h=hx.get(d))&&!h.overlay&&h.bracketed&&i>=f&&i<=f+d.length)&&!SLe(r,i,f,f+d.length))){if(d instanceof pg){if(s&cr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,i-f,r);if(m>-1)return new wf(new M5t(o,d,t,f),null,m)}else if(s&cr.IncludeAnonymous||!d.type.isAnonymous||_V(d)){let m;if(!(s&cr.IgnoreMounts)&&(m=hx.get(d))&&!m.overlay)return new ol(m.tree,f,t,o);let g=new ol(d,f,t,o);return s&cr.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,i,r,s)}}}if(s&cr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,i=0){let r;if(!(i&cr.IgnoreOverlays)&&(r=hx.get(this._tree))&&r.overlay){let s=t-this.from,o=i&cr.EnterBracketed&&r.bracketed;for(let{from:l,to:c}of r.overlay)if((n>0||o?l<=s:l=s:c>s))return new ol(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ane(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function _8(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class M5t{constructor(t,n,i,r){this.parent=t,this.buffer=n,this.index=i,this.start=r}}class wf extends ELe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,i){super(),this.context=t,this._parent=n,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,n,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,i);return s<0?null:new wf(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,i=0){if(i&cr.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new wf(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new wf(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new wf(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];t.push(i.slice(r,s,o)),n.push(0)}return new Ci(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function CLe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||o.to=t){let l=new ol(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(gE(l,t,n,!1))}}return r?CLe(r):i}class nR{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~cr.EnterBracketed,t instanceof ol)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:i,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}yield(t){return t?t instanceof ol?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,i=this.mode){return this.buffer?i&cr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&cr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&cr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,i=this.stack.length-1;if(t<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,i,{buffer:r}=this;if(r){if(t>0){if(this.index-1)for(let s=n+t,o=t<0?-1:i._tree.children.length;s!=o;s+=t){let l=i._tree.children[s];if(this.mode&cr.IncludeAnonymous||l instanceof pg||!l.type.isAnonymous||_V(l))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r=0;s--){if(s<0)return _8(this._tree,t,r);let o=i[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function _V(e){return e.children.some(t=>t instanceof pg||!t.type.isAnonymous||_V(t))}function F5t(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=kLe,reused:s=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(n)?new AV(n,n.length):n,c=i.types,u=0,d=0;function f(S,k,C,E,R,_){let{id:j,start:T,end:N,size:A}=l,P=d,D=u;if(A<0)if(l.next(),A==-1){let H=s[j];C.push(H),E.push(T-S);return}else if(A==-3){u=j;return}else if(A==-4){d=j;return}else throw new RangeError(`Unrecognized record size: ${A}`);let M=c[j],L,U,I=T-S;if(N-T<=r&&(U=v(l.pos-k,R))){let H=new Uint16Array(U.size-U.skip),K=l.pos-U.size,F=H.length;for(;l.pos>K;)F=y(U.start,H,F);L=new pg(H,N-U.start,i),I=U.start-S}else{let H=l.pos-A;l.next();let K=[],F=[],W=j>=o?j:-1,V=0,X=N;for(;l.pos>H;)W>=0&&l.id==W&&l.size>=0?(l.end<=X-r&&(g(K,F,T,V,l.end,X,W,P,D),V=K.length,X=l.end),l.next()):_>2500?h(T,H,K,F):f(T,H,K,F,W,_+1);if(W>=0&&V>0&&V-1&&V>0){let ie=m(M,D);L=jV(M,K,F,0,K.length,0,N-T,ie,ie)}else L=b(M,K,F,N-T,P-N,D)}C.push(L),E.push(I)}function h(S,k,C,E){let R=[],_=0,j=-1;for(;l.pos>k;){let{id:T,start:N,end:A,size:P}=l;if(P>4)l.next();else{if(j>-1&&N=0;A-=3)T[P++]=R[A],T[P++]=R[A+1]-N,T[P++]=R[A+2]-N,T[P++]=P;C.push(new pg(T,R[2]-N,i)),E.push(N-S)}}function m(S,k){return(C,E,R)=>{let _=0,j=C.length-1,T,N;if(j>=0&&(T=C[j])instanceof Ci){if(!j&&T.type==S&&T.length==R)return T;(N=T.prop(Kn.lookAhead))&&(_=E[j]+T.length+N)}return b(S,C,E,R,_,k)}}function g(S,k,C,E,R,_,j,T,N){let A=[],P=[];for(;S.length>E;)A.push(S.pop()),P.push(k.pop()+C-R);S.push(b(i.types[j],A,P,_-R,T-_,N)),k.push(R-C)}function b(S,k,C,E,R,_,j){if(_){let T=[Kn.contextHash,_];j=j?[T].concat(j):[T]}if(R>25){let T=[Kn.lookAhead,R];j=j?[T].concat(j):[T]}return new Ci(S,k,C,E,j)}function v(S,k){let C=l.fork(),E=0,R=0,_=0,j=C.end-r,T={size:0,start:0,skip:0};e:for(let N=C.pos-S;C.pos>N;){let A=C.size;if(C.id==k&&A>=0){T.size=E,T.start=R,T.skip=_,_+=4,E+=4,C.next();continue}let P=C.pos-A;if(A<0||P=o?4:0,M=C.start;for(C.next();C.pos>P;){if(C.size<0)if(C.size==-3||C.size==-4)D+=4;else break e;else C.id>=o&&(D+=4);C.next()}R=M,E+=A,_+=D}return(k<0||E==S)&&(T.size=E,T.start=R,T.skip=_),T.size>4?T:void 0}function y(S,k,C){let{id:E,start:R,end:_,size:j}=l;if(l.next(),j>=0&&E4){let N=l.pos-(j-4);for(;l.pos>N;)C=y(S,k,C)}k[--C]=T,k[--C]=_-S,k[--C]=R-S,k[--C]=E}else j==-3?u=E:j==-4&&(d=E);return C}let x=[],w=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,x,w,-1,0);let O=(t=e.length)!==null&&t!==void 0?t:x.length?w[0]+x[0].length:0;return new Ci(c[e.topID],x.reverse(),w.reverse(),O)}const lne=new WeakMap;function tj(e,t){if(!e.isAnonymous||t instanceof pg||t.type!=e)return 1;let n=lne.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Ci)){n=1;break}n+=tj(e,i)}lne.set(t,n)}return n}function jV(e,t,n,i,r,s,o,l,c){let u=0;for(let g=i;g=d)break;k+=C}if(w==O+1){if(k>d){let C=g[O];m(C.children,C.positions,0,C.children.length,b[O]+x);continue}f.push(g[O])}else{let C=b[w-1]+g[w-1].length-S;f.push(jV(e,g,b,O,w,S,C,null,c))}h.push(S+x-s)}}return m(t,n,i,r,0),(l||c)(f,h,o)}class NV{constructor(){this.map=new WeakMap}setBuffer(t,n,i){let r=this.map.get(t);r||this.map.set(t,r=new Map),r.set(n,i)}getBuffer(t,n){let i=this.map.get(t);return i&&i.get(n)}set(t,n){t instanceof wf?this.setBuffer(t.context.buffer,t.index,n):t instanceof ol&&this.map.set(t.tree,n)}get(t){return t instanceof wf?this.getBuffer(t.context.buffer,t.index):t instanceof ol?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Jh{constructor(t,n,i,r,s=!1,o=!1){this.from=t,this.to=n,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],i=!1){let r=[new Jh(0,t.length,t,0,!1,i)];for(let s of n)s.to>t.length&&r.push(s);return r}static applyChanges(t,n,i=128){if(!n.length)return t;let r=[],s=1,o=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=i)for(;o&&o.from=h.from||f<=h.to||u){let m=Math.max(h.from,c)-u,g=Math.min(h.to,f)-u;h=m>=g?null:new Jh(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&r.push(h),o.to>f)break;o=snew Du(r.from,r.to)):[new Du(0,0)]:[new Du(0,t.length)],this.createParse(t,n||[],i)}parse(t,n,i){let r=this.startParse(t,n,i);for(;;){let s=r.advance();if(s)return s}}}class B5t{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function TLe(e){return(t,n,i,r)=>new Q5t(t,e,n,i,r)}class cne{constructor(t,n,i,r,s,o){this.parser=t,this.parse=n,this.overlay=i,this.bracketed=r,this.target=s,this.from=o}}function une(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class U5t{constructor(t,n,i,r,s,o,l,c){this.parser=t,this.predicate=n,this.mounts=i,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const j8=new Kn({perNode:!0});class Q5t{constructor(t,n,i,r,s){this.nest=n,this.input=i,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Ci(i.type,i.children,i.positions,i.length,i.propValues.concat([[j8,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[Kn.mounted.id]=new hx(n,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)l=!1;else if(t.hasNode(r)){if(n){let u=n.mounts.find(d=>d.frag.from<=r.from&&d.frag.to>=r.to&&d.mount.overlay);if(u)for(let d of u.mount.overlay){let f=d.from+u.pos,h=d.to+u.pos;f>=r.from&&h<=r.to&&!n.ranges.some(m=>m.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(i&&(o=z5t(i.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Du(f.from-r.from,f.to-r.from)):null,!!s.bracketed,r.tree,d.length?d[0].from:r.from)),s.overlay?d.length&&(i={ranges:d,depth:0,prev:i}):l=!1}}else if(n&&(c=n.predicate(r))&&(c===!0&&(c=new Du(r.from,r.to)),c.from=0&&n.ranges[u].to==c.from?n.ranges[u]={from:n.ranges[u].from,to:c.to}:n.ranges.push(c)}if(l&&r.firstChild())n&&n.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(n&&!--n.depth){let u=hne(this.ranges,n.ranges);u.length&&(une(u),this.inner.splice(n.index,0,new cne(n.parser,n.parser.startParse(this.input,pne(n.mounts,u),u),n.ranges.map(d=>new Du(d.from-n.start,d.to-n.start)),n.bracketed,n.target,u[0].from))),n=n.prev}i&&!--i.depth&&(i=i.prev)}}}}function z5t(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function dne(e,t,n,i,r,s){if(t=t&&n.enter(i,1,cr.IgnoreOverlays|cr.ExcludeBuffers)))if(n.to<=t)n.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Ci)n=n.children[0];else break}return!1}}let H5t=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(n=i.tree.prop(j8))!==null&&n!==void 0?n:i.to,this.inner=new fne(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(j8))!==null&&t!==void 0?t:n.to,this.inner=new fne(n.tree,-n.offset)}}findMounts(t,n){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(Kn.mounted);if(o&&o.parser==n)for(let l=this.fragI;l=s.to)break;c.tree==this.curFrag.tree&&r.push({frag:c,pos:s.from-c.offset,mount:o})}}}return r}};function hne(e,t){let n=null,i=t;for(let r=1,s=0;r=l)break;c.to<=o||(n||(i=n=t.slice()),c.froml&&n.splice(s+1,0,new Du(l,c.to))):c.to>l?n[s--]=new Du(l,c.to):n.splice(s--,1))}}return i}function q5t(e,t,n,i){let r=0,s=0,o=!1,l=!1,c=-1e9,u=[];for(;;){let d=r==e.length?1e9:o?e[r].to:e[r].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(o!=l){let h=Math.max(c,n),m=Math.min(d,f,i);hnew Du(h.from+i,h.to+i)),f=q5t(t,d,c,u);for(let h=0,m=c;;h++){let g=h==f.length,b=g?u:f[h].from;if(b>m&&n.push(new Jh(m,b,r.tree,-o,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new Jh(c,u,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return n}let N8=[],ALe=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t>1;if(e=ALe[i])t=i+1;else return!0;if(t==n)return!1}}function mne(e){return e>=127462&&e<=127487}const gne=8205;function K5t(e,t,n=!0,i=!0){return(n?_Le:G5t)(e,t,i)}function _Le(e,t,n){if(t==e.length)return t;t&&jLe(e.charCodeAt(t))&&NLe(e.charCodeAt(t-1))&&t--;let i=a3(e,t);for(t+=bne(i);t=0&&mne(a3(e,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function G5t(e,t,n){for(;t>1;){let i=_Le(e,t-2,n);if(i=56320&&e<57344}function NLe(e){return e>=55296&&e<56320}function bne(e){return e<65536?1:2}let sr=class RLe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,i){[t,n]=pw(this,t,n);let r=[];return this.decompose(0,t,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),ff.from(r,this.length-(n-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=pw(this,t,n);let i=[];return this.decompose(t,n,i,0),ff.from(i,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),r=new Jk(this),s=new Jk(t);for(let o=n,l=n;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(t=1){return new Jk(this,t)}iterRange(t,n=this.length){return new ILe(this,t,n)}iterLines(t,n){let i;if(t==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new PLe(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?RLe.empty:t.length<=32?new ao(t):ff.from(ao.split(t,[]))}};class ao extends sr{constructor(t,n=X5t(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((n?i:l)>=t)return new Y5t(r,l,i,o);r=l+1,i++}}decompose(t,n,i,r){let s=t<=0&&n>=this.length?this:new ao(yne(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=i.pop(),l=nj(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ao(l,o.length+s.length));else{let c=l.length>>1;i.push(new ao(l.slice(0,c)),new ao(l.slice(c)))}}else i.push(s)}replace(t,n,i){if(!(i instanceof ao))return super.replace(t,n,i);[t,n]=pw(this,t,n);let r=nj(this.text,nj(i.text,yne(this.text,0,t)),n),s=this.length+i.length-(n-t);return r.length<=32?new ao(r,s):ff.from(ao.split(r,[]),s)}sliceString(t,n=this.length,i=` `){[t,n]=pw(this,t,n);let r="";for(let s=0,o=0;s<=n&&ot&&o&&(r+=i),ts&&(r+=l.slice(Math.max(0,t-s),n-s)),s=c+1}return r}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let i=[],r=-1;for(let s of t)i.push(s),r+=s.length+1,i.length==32&&(n.push(new ao(i,r)),i=[],r=-1);return r>-1&&n.push(new ao(i,r)),n}}class ff extends sr{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,n,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,c=i+o.lines-1;if((n?c:l)>=t)return o.lineInner(t,n,i,r);r=l+1,i=c+1}}decompose(t,n,i,r){for(let s=0,o=0;o<=n&&s=o){let u=r&((o<=t?1:0)|(c>=n?2:0));o>=t&&c<=n&&!u?i.push(l):l.decompose(t-o,n-o,i,u)}o=c+1}}replace(t,n,i){if([t,n]=pw(this,t,n),i.lines=s&&n<=l){let c=o.replace(t-s,n-s,i),u=this.lines-o.lines+c.lines;if(c.lines>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new ff(d,this.length-(n-t)+i.length)}return super.replace(s,l,c)}s=l+1}return super.replace(t,n,i)}sliceString(t,n=this.length,i=` -`){[t,n]=pw(this,t,n);let r="";for(let s=0,o=0;st&&s&&(r+=i),to&&(r+=l.sliceString(t-o,n-o,i)),o=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof ff))return 0;let i=0,[r,s,o,l]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,s+=n){if(r==o||s==l)return i;let c=this.children[r],u=t.children[s];if(c!=u)return i+c.scanIdentical(u,n);i+=c.length+1}}static from(t,n=t.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let m of t)i+=m.lines;if(i<32){let m=[];for(let g of t)g.flatten(m);return new ao(m,n)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],c=0,u=-1,d=[];function f(m){let g;if(m.lines>s&&m instanceof ff)for(let b of m.children)f(b);else m.lines>o&&(c>o||!c)?(h(),l.push(m)):m instanceof ao&&c&&(g=d[d.length-1])instanceof ao&&m.lines+g.lines<=32?(c+=m.lines,u+=m.length+1,d[d.length-1]=new ao(g.text.concat(m.text),g.length+1+m.length)):(c+m.lines>r&&h(),c+=m.lines,u+=m.length+1,d.push(m))}function h(){c!=0&&(l.push(d.length==1?d[0]:ff.from(d,u)),u=-1,c=d.length=0)}for(let m of t)f(m);return h(),l.length==1?l[0]:new ff(l,n)}}sr.empty=new ao([""],0);function K5t(e){let t=-1;for(let n of e)t+=n.length+1;return t}function nj(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s=n&&(c>i&&(l=l.slice(0,i-r)),r0?1:(t instanceof ao?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof ao?r.text.length:r.children.length;if(o==(n>0?l:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[i]+=n,t==0)return this.lineBreak=!0,this.value=` -`,this;t--}else if(r instanceof ao){let c=r.text[o+(n<0?-1:0)];if(this.offsets[i]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=r.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof ao?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class ILe{constructor(t,n,i){this.value="",this.done=!1,this.cursor=new Jk(t,n>i?-1:1),this.pos=n>i?t.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class PLe{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:i,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(sr.prototype[Symbol.iterator]=function(){return this.iter()},Jk.prototype[Symbol.iterator]=ILe.prototype[Symbol.iterator]=PLe.prototype[Symbol.iterator]=function(){return this});let G5t=class{constructor(t,n,i,r){this.from=t,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}};function pw(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ba(e,t,n=!0,i=!0){return q5t(e,t,n,i)}function X5t(e){return e>=56320&&e<57344}function Y5t(e){return e>=55296&&e<56320}function Zl(e,t){let n=e.charCodeAt(t);if(!Y5t(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return X5t(i)?(n-55296<<10)+(i-56320)+65536:n}function RV(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function hf(e){return e<65536?1:2}const R8=/\r\n?|\n/;var Pa=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Pa||(Pa={}));class Nf{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-r);s+=l}else{if(i!=Pa.Simple&&u>=t&&(i==Pa.TrackDel&&rt||i==Pa.TrackBefore&&rt))return null;if(u>t||u==t&&n<0&&!l)return t==r||n<0?s:s+c;s+=c}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return s}touchesRange(t,n=t){for(let i=0,r=0;i=0&&r<=n&&l>=t)return rn?"cover":!0;r=l}return!1}toString(){let t="";for(let n=0;n=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Nf(t)}static create(t){return new Nf(t)}}class Go extends Nf{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return I8(this,(n,i,r,s,o)=>t=t.replace(r,r+(i-n),o),!1),t}mapDesc(t,n=!1){return P8(this,t,n,!0)}invert(t){let n=this.sections.slice(),i=[];for(let r=0,s=0;r=0){n[r]=l,n[r+1]=o;let c=r>>1;for(;i.length0&&Am(i,n,s.text),s.forward(d),l+=d}let u=t[o++];for(;l>1].toJSON()))}return t}static of(t,n,i){let r=[],s=[],o=0,l=null;function c(d=!1){if(!d&&!r.length)return;oh||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let g=m?typeof m=="string"?sr.of(m.split(i||R8)):m:sr.empty,b=g.length;if(f==h&&b==0)return;fo&&tl(r,f-o,-1),tl(r,h-f,b),Am(s,r,g),o=h}}return u(t),c(!l),l}static empty(t){return new Go(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;i.length=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Am(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],c=e.sections[o++];t(r,u,s,d,f),r=u,s=d}}}function P8(e,t,n,i=!1){let r=[],s=i?[]:null,o=new bE(e),l=new bE(t);for(let c=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);tl(r,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(l.len=0&&c=0){let u=0,d=o.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.lenc||o.ins>=0&&o.len>c)&&(l||i.length>u),s.forward2(c),o.forward(c)}}}}class bE{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?sr.empty:t[n]}textBit(t){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!t?sr.empty:n[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class gm{constructor(t,n,i,r){this.from=t,this.to=n,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}map(t,n=-1){let i,r;return this.empty?i=r=t.mapPos(this.from,n):(i=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new gm(i,r,this.flags,this.goalColumn)}extend(t,n=t,i=0){if(t<=this.anchor&&n>=this.anchor)return ut.range(t,n,void 0,void 0,i);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ut.range(this.anchor,r,void 0,void 0,i)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ut.range(t.anchor,t.head)}static create(t,n,i,r){return new gm(t,n,i,r)}}class ut{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ut.create(this.ranges.map(i=>i.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;it.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ut(t.ranges.map(n=>gm.fromJSON(n)),t.main)}static single(t,n=t){return new ut([ut.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;rr.from-s.from),n=t.indexOf(i);for(let r=1;rs.head?ut.range(c,l):ut.range(l,c))}}return new ut(t,n)}}function MLe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let IV=0;class an{constructor(t,n,i,r,s){this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=IV++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new an(t.combine||(n=>n),t.compareInput||((n,i)=>n===i),t.compare||(t.combine?(n,i)=>n===i:PV),!!t.static,t.enables)}of(t){return new ij([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ij(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ij(t,this,2,n)}from(t,n){return n||(n=i=>i),this.compute([t],i=>n(i.field(t)))}}function PV(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class ij{constructor(t,n,i,r){this.dependencies=t,this.facet=n,this.type=i,this.value=r,this.id=IV++}dynamicSlot(t){var n;let i=this.value,r=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,c=!1,u=!1,d=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,h){if(c&&h.docChanged||u&&(h.docChanged||h.selection)||D8(f,d)){let m=i(f);if(l?!vne(m,f.values[o],r):!r(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,h)=>{let m,g=h.config.address[s];if(g!=null){let b=rR(h,g);if(this.dependencies.every(v=>v instanceof an?h.facet(v)===f.facet(v):v instanceof Qa?h.field(v,!1)==f.field(v,!1):!0)||(l?vne(m=i(f),b,r):r(m=i(f),b)))return f.values[o]=b,0}else m=i(f);return f.values[o]=m,1}}}get extension(){return this}}function vne(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[c.id]),r=n.map(c=>c.type),s=i.filter(c=>!(c&1)),o=e[t.id]>>1;function l(c){let u=[];for(let d=0;di===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(d2).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let s=i.values[n],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[n]=o,1)},reconfigure:(i,r)=>{let s=i.facet(d2),o=r.facet(d2),l;return(l=s.find(c=>c.field==this))&&l!=o.find(c=>c.field==this)?(i.values[n]=l.create(i),1):r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}}init(t){return[this,d2.of({field:this,create:t})]}get extension(){return this}}const Sb={lowest:4,low:3,default:2,high:1,highest:0};function hO(e){return t=>new LLe(t,e)}const Ap={highest:hO(Sb.highest),high:hO(Sb.high),default:hO(Sb.default),low:hO(Sb.low),lowest:hO(Sb.lowest)};class LLe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class fD{of(t){return new M8(this,t)}reconfigure(t){return fD.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class M8{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class iR{constructor(t,n,i,r,s,o){for(this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,i){let r=[],s=Object.create(null),o=new Map;for(let h of J5t(t,n,o))h instanceof Qa?r.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),c=[],u=[];for(let h of r)l[h.id]=u.length<<1,u.push(m=>h.slot(m));let d=i==null?void 0:i.config.facets;for(let h in s){let m=s[h],g=m[0].facet,b=d&&d[h]||[];if(m.every(v=>v.type==0))if(l[g.id]=c.length<<1|1,PV(b,m))c.push(i.facet(g));else{let v=g.combine(m.map(y=>y.value));c.push(i&&g.compare(v,i.facet(g))?i.facet(g):v)}else{for(let v of m)v.type==0?(l[v.id]=c.length<<1|1,c.push(v.value)):(l[v.id]=u.length<<1,u.push(y=>v.dynamicSlot(y)));l[g.id]=u.length<<1,u.push(v=>Z5t(v,g,m))}}let f=u.map(h=>h(l));return new iR(t,o,f,l,c,s)}}function J5t(e,t,n){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let c=r.get(o);if(c!=null){if(c<=l)return;let u=i[c].indexOf(o);u>-1&&i[c].splice(u,1),o instanceof M8&&n.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof M8){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof LLe)s(o.inner,o.prec);else if(o instanceof Qa)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof ij)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Sb.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(e,Sb.default),i.reduce((o,l)=>o.concat(l))}function eS(e,t){if(t&1)return 2;let n=t>>1,i=e.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function rR(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const $Le=an.define(),L8=an.define({combine:e=>e.some(t=>t),static:!0}),FLe=an.define({combine:e=>e.length?e[0]:void 0,static:!0}),BLe=an.define(),ULe=an.define(),QLe=an.define(),zLe=an.define({combine:e=>e.length?e[0]:!1});class qf{constructor(t,n){this.type=t,this.value=n}static define(){return new e3t}}class e3t{of(t){return new qf(this,t)}}class t3t{constructor(t){this.map=t}of(t){return new Gn(this,t)}}class Gn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new Gn(this.type,n)}is(t){return this.type==t}static define(t={}){return new t3t(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let i=[];for(let r of t){let s=r.map(n);s&&i.push(s)}return i}}Gn.reconfigure=Gn.define();Gn.appendConfig=Gn.define();class Ro{constructor(t,n,i,r,s,o){this.startState=t,this.changes=n,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&MLe(i,n.newLength),s.some(l=>l.type==Ro.time)||(this.annotations=s.concat(Ro.time.of(Date.now())))}static create(t,n,i,r,s,o){return new Ro(t,n,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Ro.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Ro.time=qf.define();Ro.userEvent=qf.define();Ro.addToHistory=qf.define();Ro.remote=qf.define();function n3t(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i=e[i]))s=e[i++],o=e[i++];else if(r=0;r--){let s=i[r](e);s instanceof Ro?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ro?e=s[0]:e=HLe(t,px(s),!1)}return e}function r3t(e){let t=e.startState,n=t.facet(QLe),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=VLe(i,$8(t,s,e.changes.newLength),!0))}return i==e?e:Ro.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}const s3t=[];function px(e){return e==null?s3t:Array.isArray(e)?e:[e]}var Ts=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Ts||(Ts={}));const o3t=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let F8;try{F8=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function a3t(e){if(F8)return F8.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||o3t.test(n)))return!0}return!1}function l3t(e){return t=>{if(!/\S/.test(t))return Ts.Space;if(a3t(t))return Ts.Word;for(let n=0;n-1)return Ts.Word;return Ts.Other}}class Ui{constructor(t,n,i,r,s,o){this.config=t,this.doc=n,this.selection=i,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(u,c)),n=null),r.set(l.value.compartment,l.value.extension)):l.is(Gn.reconfigure)?(n=null,i=l.value):l.is(Gn.appendConfig)&&(n=null,i=px(i).concat(l.value));let s;n?s=t.startState.values.slice():(n=iR.resolve(i,r,this),s=new Ui(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(L8)?t.newSelection:t.newSelection.asSingle();new Ui(n,t.newDoc,o,s,(l,c)=>c.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:ut.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,i=t(n.ranges[0]),r=this.changes(i.changes),s=[i.range],o=px(i.effects);for(let l=1;lo.spec.fromJSON(l,c)))}}return Ui.create({doc:t.doc,selection:ut.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=iR.resolve(t.extensions||[],new Map),i=t.doc instanceof sr?t.doc:sr.of((t.doc||"").split(n.staticFacet(Ui.lineSeparator)||R8)),r=t.selection?t.selection instanceof ut?t.selection:ut.single(t.selection.anchor,t.selection.head):ut.single(0);return MLe(r,i.length),n.staticFacet(L8)||(r=r.asSingle()),new Ui(n,i,r,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ui.tabSize)}get lineBreak(){return this.facet(Ui.lineSeparator)||` -`}get readOnly(){return this.facet(zLe)}phrase(t,...n){for(let i of this.facet(Ui.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>n.length?i:n[s-1]})),t}languageDataAt(t,n,i=-1){let r=[];for(let s of this.facet($Le))for(let o of s(this,n,i))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return l3t(n.length?n[0]:"")}wordAt(t){let{text:n,from:i,length:r}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let c=ba(n,o,!1);if(s(n.slice(c,o))!=Ts.Word)break;o=c}for(;le.length?e[0]:4});Ui.lineSeparator=FLe;Ui.readOnly=zLe;Ui.phrases=an.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(r=>e[r]==t[r])}});Ui.languageData=$Le;Ui.changeFilter=BLe;Ui.transactionFilter=ULe;Ui.transactionExtender=QLe;fD.reconfigure=Gn.define();function Wf(e,t,n={}){let i={};for(let r of e)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))i[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in t)i[r]===void 0&&(i[r]=t[r]);return i}class mg{eq(t){return this==t}range(t,n=t){return yE.create(t,n,this)}}mg.prototype.startSide=mg.prototype.endSide=0;mg.prototype.point=!1;mg.prototype.mapMode=Pa.TrackDel;function DV(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class yE{constructor(t,n,i){this.from=t,this.to=n,this.value=i}static create(t,n,i){return new yE(t,n,i)}}function B8(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class MV{constructor(t,n,i,r){this.from=t,this.to=n,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let c=o+l>>1,u=s[c]-t||(i?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:l;u>=0?l=c:o=c+1}}between(t,n,i,r){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(i,1e9,!1,s);sm||h==m&&u.startSide>0&&u.endSide<=0)continue;(m-h||u.endSide-u.startSide)<0||(o<0&&(o=h),u.point&&(l=Math.max(l,m-h)),i.push(u),r.push(h-o),s.push(m-o))}return{mapped:i.length?new MV(r,s,i,l):null,pos:o}}}class Di{constructor(t,n,i,r){this.chunkPos=t,this.chunk=n,this.nextLayer=i,this.maxPoint=r}static create(t,n,i,r){return new Di(t,n,i,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(i&&(n=n.slice().sort(B8)),this.isEmpty)return n.length?Di.of(n):this;let l=new qLe(this,null,-1).goto(0),c=0,u=[],d=new pp;for(;l.value||c=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,n-s,i)===!1)return}this.nextLayer.between(t,n,i)}}iter(t=0){return vE.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return vE.from(t).goto(n)}static compare(t,n,i,r,s=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),c=xne(o,l,i),u=new pO(o,c,s),d=new pO(l,c,s);i.iterGaps((f,h,m)=>wne(u,f,d,h,m,r)),i.empty&&i.length==0&&wne(u,0,d,0,0,r)}static eq(t,n,i=0,r){r==null&&(r=999999999);let s=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=xne(s,o),c=new pO(s,l,0).goto(i),u=new pO(o,l,0).goto(i);for(;;){if(c.to!=u.to||!U8(c.active,u.active)||c.point&&(!u.point||!DV(c.point,u.point)))return!1;if(c.to>r)return!0;c.next(),u.next()}}static spans(t,n,i,r,s=-1){let o=new pO(t,null,s).goto(n),l=n,c=o.openStart;for(;;){let u=Math.min(o.to,i);if(o.point){let d=o.activeForPoint(o.to),f=o.pointFroml&&(r.span(l,u,o.active,c),c=o.openEnd(u));if(o.to>i)return c+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,n=!1){let i=new pp;for(let r of t instanceof yE?[t]:n?c3t(t):t)i.add(r.from,r.to,r.value);return i.finish()}static join(t){if(!t.length)return Di.empty;let n=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let r=t[i];r!=Di.empty;r=r.nextLayer)n=new Di(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}Di.empty=new Di([],[],null,-1);function c3t(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(B8);t=i}return e}Di.empty.nextLayer=Di.empty;class pp{finishChunk(t){this.chunks.push(new MV(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,i){this.addInner(t,n,i)||(this.nextLayer||(this.nextLayer=new pp)).add(t,n,i)}addInner(t,n,i){let r=t-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+t,this.lastTo=n.to[i]+t,!0}finish(){return this.finishInner(Di.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Di.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function xne(e,t,n){let i=new Map;for(let s of e)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&r.push(new qLe(o,n,i,s));return r.length==1?r[0]:new vE(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let i of this.heap)i.goto(t,n);for(let i=this.heap.length>>1;i>=0;i--)l3(this.heap,i);return this.next(),this}forward(t,n){for(let i of this.heap)i.forward(t,n);for(let i=this.heap.length>>1;i>=0;i--)l3(this.heap,i);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),l3(this.heap,0)}}}function l3(e,t){for(let n=e[t];;){let i=(t<<1)+1;if(i>=e.length)break;let r=e[i];if(i+1=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class pO{constructor(t,n,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vE.from(t,n,i)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){f2(this.active,t),f2(this.activeTo,t),f2(this.activeRank,t),this.minActive=One(this.active,this.activeTo)}addActive(t){let n=0,{value:i,to:r,rank:s}=this.cursor;for(;n0;)n++;h2(this.active,n,i),h2(this.activeTo,n,r),h2(this.activeRank,n,s),t&&h2(t,n,this.cursor.from),this.minActive=One(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&f2(i,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&i[r]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(t){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)n++;return n}}function wne(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,l=i,c=i-t,u=!!s.boundChange;for(let d=!1;;){let f=e.to+c-n.to,h=f||e.endSide-n.endSide,m=h<0?e.to+c:n.to,g=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&DV(e.point,n.point)&&U8(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,g,e.point,n.point),d=!1):(d&&s.boundChange(l),g>l&&!U8(e.active,n.active)&&s.compareRange(l,g,e.active,n.active),u&&go)break;l=m,h<=0&&e.next(),h>=0&&n.next()}}function U8(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;i--)e[i+1]=e[i];e[t]=n}function One(e,t){let n=-1,i=1e9;for(let r=0;r=t)return r;if(r==e.length)break;s+=e.charCodeAt(r)==9?n-s%n:1,r=ba(e,r)}return i===!0?-1:e.length}const z8="ͼ",kne=typeof Symbol>"u"?"__"+z8:Symbol.for(z8),V8=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Sne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class gg{constructor(t,n){this.rules=[];let{finish:i}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,c,u){let d=[],f=/^@(\w+)\b/.exec(o[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return c.push(o[0]+";");for(let m in l){let g=l[m];if(/&/.test(m))s(m.split(/,\s*/).map(b=>o.map(v=>b.replace(/&/,v))).reduce((b,v)=>b.concat(v)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(r(m),g,d,h)}else g!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||h)&&c.push((i&&!f&&!u?o.map(i):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)s(r(o),t[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let t=Sne[kne]||1;return Sne[kne]=t+1,z8+t.toString(36)}static mount(t,n,i){let r=t[V8],s=i&&i.nonce;r?s&&r.setNonce(s):r=new u3t(t,s),r.mount(Array.isArray(n)?n:[n],t)}}let Ene=new Map;class u3t{constructor(t,n){let i=t.ownerDocument||t,r=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let s=Ene.get(i);if(s)return t[V8]=s;this.sheet=new r.CSSStyleSheet,Ene.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[V8]=this}mount(t,n){let i=this.sheet,r=0,s=0;for(let o=0;o-1&&(this.modules.splice(c,1),s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),i)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},d3t=typeof navigator<"u"&&/Mac/.test(navigator.platform),f3t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Na=0;Na<10;Na++)bg[48+Na]=bg[96+Na]=String(Na);for(var Na=1;Na<=24;Na++)bg[Na+111]="F"+Na;for(var Na=65;Na<=90;Na++)bg[Na]=String.fromCharCode(Na+32),xE[Na]=String.fromCharCode(Na);for(var c3 in bg)xE.hasOwnProperty(c3)||(xE[c3]=bg[c3]);function h3t(e){var t=d3t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||f3t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?xE:bg)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Ir(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];typeof r=="string"?e.setAttribute(i,r):r!=null&&(e[i]=r)}t++}for(;t2);var sn={mac:Ane||/Mac/.test(wl.platform),windows:/Win/.test(wl.platform),linux:/Linux|X11/.test(wl.platform),ie:hD,ie_version:KLe?H8.documentMode||6:W8?+W8[1]:q8?+q8[1]:0,gecko:Cne,gecko_version:Cne?+(/Firefox\/(\d+)/.exec(wl.userAgent)||[0,0])[1]:0,chrome:!!u3,chrome_version:u3?+u3[1]:0,ios:Ane,android:/Android\b/.test(wl.userAgent),webkit:Tne,webkit_version:Tne?+(/\bAppleWebKit\/(\d+)/.exec(wl.userAgent)||[0,0])[1]:0,safari:K8,safari_version:K8?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wl.userAgent)||[0,0])[1]:0,tabSize:H8.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function LV(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const sR=Object.create(null);function $V(e,t,n){if(e==t)return!0;e||(e=sR),t||(t=sR);let i=Object.keys(e),r=Object.keys(t);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=n&&(r.indexOf(s)==-1||e[s]!==t[s]))return!1;return!0}function p3t(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;t[i]==null&&e.removeAttribute(i)}for(let n in t){let i=t[n];n=="style"?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}function _ne(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function m3t(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Cy(t,n,n,i,t.widget||null,!1)}static replace(t){let n=!!t.block,i,r;if(t.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=GLe(t,n);i=(s?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Cy(t,i,r,n,t.widget||null,!0)}static line(t){return new iT(t)}static set(t,n=!1){return Di.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Cn.none=Di.empty;class nT extends Cn{constructor(t){let{start:n,end:i}=GLe(t);super(n?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?LV(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||sR}eq(t){return this==t||t instanceof nT&&this.tagName==t.tagName&&$V(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}nT.prototype.point=!1;class iT extends Cn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof iT&&this.spec.class==t.spec.class&&$V(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}iT.prototype.mapMode=Pa.TrackBefore;iT.prototype.point=!0;class Cy extends Cn{constructor(t,n,i,r,s,o){super(n,i,s,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Pa.TrackBefore:Pa.TrackAfter:Pa.TrackDel}get type(){return this.startSide!=this.endSide?La.WidgetRange:this.startSide<=0?La.WidgetBefore:La.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Cy&&g3t(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Cy.prototype.point=!0;function GLe(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return n==null&&(n=e.inclusive),i==null&&(i=e.inclusive),{start:n??t,end:i??t}}function g3t(e,t){return e==t||!!(e&&t&&e.compare(t))}function mx(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class wE extends mg{constructor(t,n,i){super(),this.tagName=t,this.attributes=n,this.rank=i}eq(t){return t==this||t instanceof wE&&this.tagName==t.tagName&&$V(this.attributes,t.attributes)}static create(t){return new wE(t.tagName,t.attributes||sR,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Di.of(t,n)}}wE.prototype.startSide=wE.prototype.endSide=-1;function OE(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function G8(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function tS(e,t){if(!t.anchorNode)return!1;try{return G8(e,t.anchorNode)}catch{return!1}}function nS(e){return e.nodeType==3?SE(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function iS(e,t,n,i){return n?jne(e,t,n,i,-1)||jne(e,t,n,i,1):!1}function yg(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function oR(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function jne(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:mp(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=yg(e)+(r<0?0:1),e=s}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?mp(e):0}else return!1}}function mp(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function kE(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function b3t(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function XLe(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function y3t(e,t,n,i,r,s,o,l){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let h,m=d==c.body,g=1,b=1;if(m)h=b3t(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let x=d.getBoundingClientRect();({scaleX:g,scaleY:b}=XLe(d,x)),h={left:x.left,right:x.left+d.clientWidth*g,top:x.top,bottom:x.top+d.clientHeight*b}}let v=0,y=0;if(r=="nearest")t.top0&&t.bottom>h.bottom+y&&(y=t.bottom-h.bottom+o)):t.bottom>h.bottom-o&&(y=t.bottom-h.bottom+o,n<0&&t.top-y0&&t.right>h.right+v&&(v=t.right-h.right+s)):t.right>h.right-s&&(v=t.right-h.right+s,n<0&&t.lefth.bottom||t.lefth.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function YLe(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let s=e.parentNode;s&&!(s==n.body||(!t||i)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),t&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}class v3t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:i}=t;this.set(n,Math.min(t.anchorOffset,n?mp(n):0),i,Math.min(t.focusOffset,i?mp(i):0))}set(t,n,i,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=i,this.focusOffset=r}}let xb=null;sn.safari&&sn.safari_version>=26&&(xb=!1);function ZLe(e){if(e.setActive)return e.setActive();if(xb)return e.focus(xb);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(xb==null?{get preventScroll(){return xb={preventScroll:!0},!0}}:void 0),!xb){xb=!1;for(let n=0;nMath.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function e5e(e,t){for(let n=e,i=t;;){if(n.nodeType==3&&i>0)return{node:n,offset:i};if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=mp(n)}else if(n.parentNode&&!oR(n))i=yg(n),n=n.parentNode;else return null}}function t5e(e,t){for(let n=e,i=t;;){if(n.nodeType==3&&i=n){if(l.level==i)return o;(s<0||(r!=0?r<0?l.fromn:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function r5e(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;b-=3)if(Jd[b+1]==-m){let v=Jd[b+2],y=v&2?r:v&4?v&1?s:r:0;y&&(Ur[f]=Ur[Jd[b]]=y),l=b;break}}else{if(Jd.length==189)break;Jd[l++]=f,Jd[l++]=h,Jd[l++]=c}else if((g=Ur[f])==2||g==1){let b=g==r;c=b?0:1;for(let v=l-3;v>=0;v-=3){let y=Jd[v+2];if(y&2)break;if(b)Jd[v+2]|=2;else{if(y&4)break;Jd[v+2]|=4}}}}}function T3t(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,l=rc;)g==v&&(g=n[--b].from,v=b?n[b-1].to:e),Ur[--g]=m;c=d}else s=u,c++}}}function Y8(e,t,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let c=t,u=0;cc&&o.push(new Of(c,b.from,m));let v=b.direction==Ty!=!(m%2);Z8(e,v?i+1:i,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?Ur[g]!=l:Ur[g]==l))break;g++}h?Y8(e,c,g,i+1,r,h,o):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let b=Ur[c-1];b!=l&&(d=!1,f=b==16)}let h=!d&&l==1?[]:null,m=d?i:i+1,g=c;e:for(;;)if(u&&g==s[u-1].to){if(f)break e;let b=s[--u];if(!d)for(let v=b.from,y=u;;){if(v==t)break e;if(y&&s[y-1].to==v)v=s[--y].from;else{if(Ur[v-1]==l)break e;break}}if(h)h.push(b);else{b.toUr.length;)Ur[Ur.length]=256;let i=[],r=t==Ty?0:1;return Z8(e,r,r,n,0,e.length,i),i}function s5e(e){return[new Of(0,e,0)]}let o5e="";function _3t(e,t,n,i,r){var s;let o=i.head-e.from,l=Of.find(t,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),c=t[l],u=c.side(r,n);if(o==u){let h=l+=r?1:-1;if(h<0||h>=t.length)return null;c=t[l=h],o=c.side(!r,n),u=c.side(r,n)}let d=ba(e.text,o,c.forward(r,n));(dc.to)&&(d=u),o5e=e.text.slice(Math.min(o,d),Math.max(o,d));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return f&&d==u&&f.level+(r?0:1)e.some(t=>t)}),p5e=an.define({combine:e=>e.some(t=>t)}),m5e=an.define();class bx{constructor(t,n,i,r,s,o=!1){this.range=t,this.y=n,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new bx(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new bx(ut.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const p2=Gn.define({map:(e,t)=>e.map(t)}),g5e=Gn.define();function sc(e,t,n){let i=e.facet(u5e);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Rh=an.define({combine:e=>e.length?e[0]:!0});let N3t=0;const Fv=an.define({combine(e){return e.filter((t,n)=>{for(let i=0;i{let c=[];return o&&c.push(pD.of(u=>{let d=u.plugin(l);return d?o(d):Cn.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return Zs.define((i,r)=>new t(i,r),n)}}class d3{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(sc(n.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){sc(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){sc(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const b5e=an.define(),QV=an.define(),pD=an.define(),y5e=an.define(),zV=an.define(),rT=an.define(),v5e=an.define();function Rne(e,t){let n=e.state.facet(v5e);if(!n.length)return n;let i=n.map(s=>s instanceof Function?s(e):s),r=[];return Di.spans(i,t.from,t.to,{point(){},span(s,o,l,c){let u=s-t.from,d=o-t.from,f=r;for(let h=l.length-1;h>=0;h--,c--){let m=l[h].spec.bidiIsolate,g;if(m==null&&(m=j3t(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==m)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:m,inner:[]};f.push(b),f=b.inner}}}}),r}const x5e=an.define();function VV(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(x5e)){let o=s(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const nk=an.define();class Mu{constructor(t,n,i,r){this.fromA=t,this.toA=n,this.fromB=i,this.toB=r}join(t){return new Mu(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,i=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>i.toA)){if(r.toAr.push(new Mu(s,o,l,c))),this.changedRanges=r}static create(t,n,i){return new aR(t,n,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const R3t=[];class Ys{constructor(t,n,i=0){this.dom=t,this.length=n,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return R3t}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&p3t(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let i=n;for(let r of this.children){if(r==t)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n,i){return null}domPosFor(t,n){let i=yg(this.dom),r=this.length?t>0:n>0;return new Sd(this.parent.dom,i+(r?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof gD)return t;return null}static get(t){return t.cmTile}}class mD extends Ys{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,i=null,r,s=(t==null?void 0:t.node)==n?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,r=i?i.nextSibling:n.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;r&&r!=l.dom;)r=Ine(r);else n.insertBefore(l.dom,r);i=l.dom}for(r=i?i.nextSibling:n.firstChild,s&&r&&(s.written=!0);r;)r=Ine(r);this.length=o}}function Ine(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class gD extends mD{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=Ys.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!n.length)return;i=i.parent,i.breakAfter&&s++,r=n.pop()}else{let o=i.children[r++];if(o instanceof ep)n.push(r),i=o,r=0;else{let l=s+o.length,c=t(o,s);if(c!==void 0)return c;s=l+o.breakAfter}}}resolveBlock(t,n){let i,r=-1,s,o=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ct||t==c&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=t-c)}}),!i&&!s)throw new Error("No tile at position "+t);return i&&n<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}}class ep extends mD{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let i=new ep(n||document.createElement(t.tagName),t);return n||(i.flags|=4),i}}class mw extends mD{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,i){let r=new mw(n||document.createElement("div"),t);return(!n||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,i){let r=null,s=-1,o=null,l=-1;function c(d,f){for(let h=0,m=0;h=f&&(g.isComposite()?c(g,f-m):(!o||o.isHidden&&(n>0&&!(o.flags&32)||i&&P3t(o,g)))&&(b>f||g.flags&32)?(o=g,l=f-m):(mr&&(t=r);let s=t,o=t,l=0;t==0&&n<0||t==r&&n>=0?sn.chrome||sn.gecko||(t?(s--,l=1):o=0)?0:c.length-1];return sn.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),i==null?u:kE(u,(l?l>0:n<0)==i)}static of(t,n){let i=new $b(n||document.createTextNode(t),t);return n||(i.flags|=2),i}}class Ay extends Ys{constructor(t,n,i,r){super(t,n,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,i){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(i)return kE(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?s.length-1:0;o=s[c],!(t>0?c==0:c==s.length-1||o.top0==i)}}class D3t{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,i){let{tile:r,index:s,beforeBreak:o,parents:l}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(s==r.children.length){if(!t&&!l.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let c=r.children[s],u=c.breakAfter;(n>0?c.length<=t:c.length=0;l--){let c=n.marks[l],u=r.lastChild;if(u instanceof tc&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(f3(c.dom)),r=u;else{if(this.cache.reused.get(c)){let f=Ys.get(c.dom);f&&f.setDOM(f3(c.dom))}let d=tc.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let s=Ys.get(t.text);s&&this.cache.reused.set(s,2);let o=new $b(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,i){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let s=this.ensureMarks(n,i);!r&&!(t.flags&16)&&s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,i){this.flushBuffer(),this.ensureMarks(n,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var i;t||(t=w5e);let r=mw.start(t,n||((i=this.cache.find(mw))===null||i===void 0?void 0:i.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var i;let r=this.curLine;for(let s=t.length-1;s>=0;s--){let o=t[s],l;if(n>0&&(l=r.lastChild)&&l instanceof tc&&l.mark.eq(o))r=l,n--;else{let c=tc.of(o,(i=this.cache.find(tc,u=>u.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(c),r=c,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!Pne(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(sn.ios&&Pne(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(h3,0,32)||new Ay(h3.toDOM(),0,h3,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to=this.pos){let n=t.rank*102+t.value.rank,i=new M3t(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let i of this.wrappers){let r=n.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);n.append(s),n=s}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),i=this.cache.find(lR,void 0,1);return i&&(i.flags=n),i||new lR(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class $3t{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let l=this.textOff=Math.min(t,r.length);return s?null:r.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,n);return this.textOff=n,i}}const cR=[Ay,mw,$b,tc,lR,ep,gD];for(let e=0;e[]),this.index=cR.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,i=this.buckets[n];i.length<6?i.push(t):i[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,i=2){let r=t.bucket,s=this.buckets[r],o=this.index[r];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let i=n&&this.getCompositionContext(n.text);for(let r=0,s=0,o=0;;){let l=or){let u=c-r;this.preserve(u,!o,!l),r=c,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof tc&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof tc&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let i=null,r=this.builder,s=-1,o=Di.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Cy){if(this.disallowBlockEffectsFor[h]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,f>d.length)r.continueWidget(c-l);else{let m=u.widget||(u.block?gw.block:gw.inline),g=U3t(u),b=this.cache.findWidget(m,c-l,g)||Ay.of(m,this.view,c-l,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(b)):(r.ensureLine(i),r.addInlineWidget(b,d,f))}i=null}else i=Q3t(i,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;f-1&&(this.openWidget=o>s),this.openWidget||r.addLineStartIfNotCovered(i),this.openMarks=o}forward(t,n,i=1){n-t<=10?this.old.advance(n-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let n=[],i=null;for(let r=t.parentNode;;r=r.parentNode){let s=Ys.get(r);if(r==this.view.contentDOM)break;s instanceof tc?n.push(s):s!=null&&s.isLine()?i=s:s instanceof ep||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new mw(r,w5e):i||n.push(tc.of(new nT({tagName:r.nodeName.toLowerCase(),attributes:m3t(r)}),r)))}return{line:i,marks:n}}}function Pne(e,t){let n=i=>{for(let r of i.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function U3t(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const w5e={class:"cm-line"};function Q3t(e,t){let n=t.spec.attributes,i=t.spec.class;return!n&&!i||(e||(e={class:"cm-line"}),n&&LV(n,e),i&&(e.class+=" "+i)),e}function z3t(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof tc&&t.push(i.mark)}return t}function f3(e){let t=Ys.get(e);return t&&t.setDOM(e.cloneNode()),e}class gw extends Qd{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}gw.inline=new gw("span");gw.block=new gw("div");const h3=new class extends Qd{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Dne{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Cn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new gD(t,t.contentDOM),this.updateInner([new Mu(0,0,0,t.state.doc.length)],null)}update(t){var n;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:d,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!Z3t(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let s=r>-1?H3t(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;i=new Mu(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(sn.ie||sn.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let c=K3t(o,this.decorations,t.changes);c.length&&(i=Mu.extendWithRanges(i,c));let u=X3t(l,this.blockWrappers,t.changes);return u.length&&(i=Mu.extendWithRanges(i,u)),s&&!i.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(n||t.length){let o=this.tile,l=new B3t(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Ys.get(n.text)&&l.cache.reused.set(Ys.get(n.text),2),this.tile=l.run(t,n),eB(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=sn.chrome||sn.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&tS(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),sn.gecko&&c.empty&&!this.hasComposition&&V3t(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new Sd(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!iS(u.node,u.offset,f.anchorNode,f.anchorOffset)||!iS(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{sn.android&&sn.chrome&&i.contains(f.focusNode)&&Y3t(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let h=OE(this.view.root);if(h)if(c.empty){if(sn.gecko){let m=q3t(u.node,u.offset);if(m&&m!=3){let g=(m==1?e5e:t5e)(u.node,u.offset);g&&(u=new Sd(g.node,g.offset))}}h.collapse(u.node,u.offset),c.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=c.bidiLevel)}else if(h.extend){h.collapse(u.node,u.offset);try{h.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),m.setEnd(d.node,d.offset),m.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(m)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new Sd(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new Sd(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&iS(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,i=OE(t.root),{anchorNode:r,anchorOffset:s}=t.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);i.collapse(d.node,d.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&i.collapse(r,s)}posFromDOM(t,n){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(t==i.dom)s=i.dom.childNodes[n];else{let o=mp(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?s=t:s=t.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!Ys.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,l=r;;o++){let c=i.children[o];if(c.dom==s)return l;l+=c.length+c.breakAfter}}else return i.isText()?t==i.dom?r+n:r+(n?i.length:0):r}domAtPos(t,n){let{tile:i,offset:r}=this.tile.resolveBlock(t,n);return i.isWidget()?i.domPosFor(r,n):i.domIn(r,n)}inlineDOMNearPos(t,n){let i,r=-1,s=!1,o,l=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(s=!0)}else{let f=d+u.length;if(d<=t&&(i=u,r=t-d,s=f=t&&!o&&(o=u,l=t-d,c=d>t),d>t&&o)return!0}}),!i&&!o?this.domAtPos(t,n):(s&&o?i=null:c&&i&&(o=null),i&&n<0||!o?i.domIn(r,n):o.domIn(l,n))}coordsAt(t,n,i){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof p3?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n,i)}lineAt(t,n){let{tile:i}=this.tile.resolveBlock(t,n);return i.isLine()?i:null}coordsForChar(t){let{tile:n,offset:i}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let c=r(l,o);if(c)return c}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==Qr.LTR,u=0,d=(f,h,m)=>{for(let g=0;gr);g++){let b=f.children[g],v=h+b.length,y=b.dom.getBoundingClientRect(),{height:x}=y;if(m&&!g&&(u+=y.top-m.top),b instanceof ep)v>i&&d(b,h,y);else if(h>=i&&(u>0&&n.push(-u),n.push(x+u),u=0,o)){let w=b.dom.lastChild,O=w?nS(w):[];if(O.length){let S=O[O.length-1],k=c?S.right-y.left:y.right-S.left;k>l&&(l=k,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=v)}}m&&g==f.children.length-1&&(u+=m.bottom-y.bottom),h=v+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Qr.RTL:Qr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=nS(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),i,r,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=nS(n.firstChild)[0];i=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,n.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let i=0,r=0;;r++){let s=r==n.viewports.length?null:n.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(i).top)/this.view.scaleY;t.push(Cn.replace({widget:new p3(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return Cn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(pD).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet(zV).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[t++]=i,n.push(Di.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ttypeof s=="function"?s(this.view):s)}scrollIntoView(t){if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(m5e))try{if(u(this.view,t.range,t))return!0}catch(d){sc(this.view.state,d,"scroll handler")}let{range:n}=t,i=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),r;if(!i)return;!n.empty&&(r=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=VV(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(y3t(this.view.scrollDOM,o,n.head1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){eB(this.tile)}}function eB(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let i of e.children)eB(i,t)}}function V3t(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function O5e(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=e5e(n.focusNode,n.focusOffset),r=t5e(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let l=Ys.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(e.docView.lastCompositionAfterCursor){let c=Ys.get(i.node);!c||c.isText()&&c.text!=i.node.nodeValue||(s=r)}}if(e.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function H3t(e,t,n){let i=O5e(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(i.from,i.to)!=l)return null;let c=t.invertedDesc;return{range:new Mu(c.mapPos(s),c.mapPos(o),s,o),text:r}}function q3t(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{it.from&&(n=!0)}),n}class p3 extends Qd{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function J3t(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(r.length==0)return ut.cursor(t);s==0?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=ba(r.text,s,!1):l=ba(r.text,s);let c=i(r.text.slice(o,l));for(;o>0;){let u=ba(r.text,o,!1);if(i(r.text.slice(u,o))!=c)break;o=u}for(;le.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((r-n.top-(e.defaultLineHeight-l)*.5)/l);s+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Q8(o,s,e.state.tabSize)}function tB(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>t)break;if(!(s.tot)return s;(!r||s.type==La.Text&&(r.type!=s.type||(n<0?s.fromt)))&&(r=s)}}return r||i}return i}function t4t(e,t,n,i){let r=tB(e,t.head,t.assoc||-1),s=!i||r.type!=La.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(s){let o=e.dom.getBoundingClientRect(),l=e.textDirectionAt(r.from),c=e.posAtCoords({x:n==(l==Qr.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(c!=null)return ut.cursor(c,n?-1:1)}return ut.cursor(n?r.to:r.from,n?-1:1)}function Mne(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,c=null;;){let u=_3t(r,s,o,l,n),d=o5e;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;d=` -`,r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),u=e.visualLineSide(r,!n)}if(c){if(!c(d))return l}else{if(!i)return u;c=i(d)}l=u}}function n4t(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return s=>{let o=i(s);return r==Ts.Space&&(r=o),r==o}}function i4t(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return ut.cursor(r,t.assoc);let o=t.goalColumn,l,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),l=s<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),l=(s<0?g.top:g.bottom)+d}let f=c.left+o,h=e.viewState.heightOracle.textHeight>>1,m=i??h;for(let g=0;;g+=h){let b=l+(m+g)*s,v=nB(e,{x:f,y:b},!1,s);if(n?b>c.bottom:bl:x{if(t>s&&tr(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:ut.cursor(i,ie.viewState.docHeight)return new pf(e.state.doc.length,-1);if(u=e.elementAtHeight(c),i==null)break;if(u.type==La.Text){if(i<0?u.toe.viewport.to)break;let h=e.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(h&&(i<0?h.top<=c+s:h.bottom>=c+s))break}let f=e.viewState.heightOracle.textHeight/2;c=i>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==La.Text){let f=e4t(e,r,u,o,l);return new pf(f,f==u.from?1:-1)}}if(u.type!=La.Text)return c<(u.top+u.bottom)/2?new pf(u.from,1):new pf(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new r4t(e,o,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class r4t{constructor(t,n,i,r){this.view=t,this.x=n,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from>1;t:if(o.has(b)){let y=r+Math.floor(Math.random()*g);for(let x=0;x1)){if(x.bottomthis.y)(!u||u.top>x.top)&&(u=x),w=-1;else{let O=x.left>this.x?this.x-x.left:x.right(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let m=(l?this.dirAt(t[d],1):this.baseDir)==Qr.LTR;return{i:d,after:this.x>(h.left+h.right)/2==m}}scanText(t,n){let i=[];for(let s=0;s{let o=i[s]-n,l=i[s+1]-n;return SE(t.dom,o,l).getClientRects()});return r.after?new pf(i[r.i+1],-1):new pf(i[r.i],1)}scanTile(t,n){if(!t.length)return new pf(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let i=[n];for(let l=0,c=n;l{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:SE(c.dom,0,c.length)).getClientRects()}),s=t.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new pf(i[r.i+1],-1):new pf(o,1)}}const cv="￿";class s4t{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(Ui.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=cv}readRange(t,n){if(!t)return this;let i=t.parentNode;for(let r=t;;){this.findPointBefore(i,r);let s=this.text.length;this.readNode(r);let o=Ys.get(r),l=r.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let c=Ys.get(l);(o&&c?o.breakAfter:(o?o.breakAfter:oR(r))||oR(l)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!a4t(l,n)&&this.lineBreak(),r=l}return this.findPointBefore(i,n),this}readTextNode(t){let n=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(i,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=o-1);i=s+o}}readNode(t){let n=Ys.get(t),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(t,n){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(o4t(t,i.node,i.offset)?n:0))}}function o4t(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:s,impreciseAnchor:o}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=S5e(t.docView.tile,n,i,0))){let c=s||o?[]:u4t(t),u=new s4t(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=d4t(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!G8(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!G8(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((sn.ios||sn.chrome)&&u!=d&&Math.min(u,d)<=l.main.from&&Math.max(u,d)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(ut.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let h=t.coordsAtPos(u,-1),m=0;h&&(m=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=ut.create([ut.cursor(u,m)])}else this.newSel=ut.single(d,u)}}}function S5e(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let c=0,u=i,d=i;cn)return S5e(f,t,n,u);if(h>=t&&r==-1&&(r=c,s=u),u>n&&f.dom.parentNode==e.dom){o=c,l=d;break}d=h,u=h+f.breakAfter}return{from:s,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o=0?e.children[o].dom:null}}else return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function E5e(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:c}=t.bounds,u=s.from,d=null;(o===8||sn.android&&t.text.length=l&&s.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,s.from-l)==t.text.slice(0,s.from-l)&&f.slice(s.to-l)==t.text.slice(h=t.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:sr.of(t.text.slice(s.from-l,h).split(cv))}:(m=C5e(f,t.text,u-l,d))&&(sn.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==cv+cv&&m.toB--,n={from:l+m.from,to:l+m.toA,insert:sr.of(t.text.slice(m.from,m.toB).split(cv))})}else i&&(!e.hasFocus&&r.facet(Rh)||uR(i,s))&&(i=null);if(!n&&!i)return!1;if((sn.mac||sn.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(i&&n.insert.length==2&&(i=ut.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:sr.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:r.toText(e.inputState.insertingText)}:sn.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&e.lineWrapping&&(i&&(i=ut.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:sr.of([" "])}),n)return HV(e,n,i,o);if(i&&!uR(i,s)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(i=k5e(r.facet(rT).map(u=>u(e)),i))),e.dispatch({selection:i,scrollIntoView:l,userEvent:c}),!0}else return!1}function HV(e,t,n,i=-1){if(sn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(sn.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&gx(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.lengthr.head)&&gx(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&gx(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=c4t(e,t,n));return e.state.facet(d5e).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function c4t(e,t,n){let i,r=e.state,s=r.selection.main,o=-1;if(t.from==t.to&&t.froms.to){let c=t.fromf(e)),u,c);t.from==d&&(o=d)}if(o>-1)i={changes:t,selection:ut.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=s.fromt.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=r.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let d=e.state.sliceDoc(t.from,t.to),f,h=n&&O5e(e,n.main.head);if(h){let g=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-g}}else f=e.state.doc.lineAt(s.head);let m=s.to-t.to;i=r.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:c,range:u||g.map(c)};let b=g.to-m,v=b-d.length;if(e.state.sliceDoc(v,b)!=d||b>=f.from&&v<=f.to)return{range:g};let y=r.changes({from:v,to:b,insert:t.insert}),x=g.to-s.to;return{changes:y,range:u?ut.range(Math.max(0,u.anchor+x),Math.max(0,u.head+x)):g.map(y)}})}else i={changes:c,selection:u&&r.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function C5e(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let c=Math.max(0,s-Math.min(o,l));n-=o+c-s}if(o=o?s-n:0;s-=c,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=c,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function u4t(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new Lne(n,i)),(r!=n||s!=i)&&t.push(new Lne(r,s))),t}function d4t(e,t){if(e.length==0)return null;let n=e[0].pos,i=e.length==2?e[1].pos:n;return n>-1&&i>-1?ut.single(n+t,i+t):null}function uR(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class f4t{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,sn.safari&&t.contentDOM.addEventListener("input",()=>null),sn.gecko&&A4t(t.contentDOM.ownerDocument)}handleEvent(t){!w4t(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let i=this.handlers[t];if(i){for(let r of i.observers)r(this.view,n);for(let r of i.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=p4t(t),i=this.handlers,r=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!n[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&A5e.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),sn.android&&sn.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(sn.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(T5e.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||m4t.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&sn.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&h4t(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:t.key,keyCode:t.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return t.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from0?!0:sn.safari&&!sn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function h4t(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function $ne(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){sc(n.state,r)}}}function p4t(e){let t=Object.create(null);function n(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of e){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let c=s[l];c&&n(l).handlers.push($ne(i.value,c))}if(o)for(let l in o){let c=o[l];c&&n(l).observers.push($ne(i.value,c))}}for(let i in Pd)n(i).handlers.push(Pd[i]);for(let i in Nl)n(i).observers.push(Nl[i]);return t}const T5e=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],m4t="dthko",A5e=[16,17,18,20,91,92,224,225],m2=6;function g2(e){return Math.max(0,e)*.7+8}function g4t(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class b4t{constructor(t,n,i,r){this.view=t,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=YLe(t.contentDOM),this.atoms=t.state.facet(rT).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(Ui.allowMultipleSelections)&&y4t(t,n),this.dragging=x4t(t,n)&&N5e(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&g4t(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=VV(this.view);t.clientX-c.left<=r+m2?n=-g2(r-t.clientX):t.clientX+c.right>=o-m2&&(n=g2(t.clientX-o)),t.clientY-c.top<=s+m2?i=-g2(s-t.clientY):t.clientY+c.bottom>=l-m2&&(i=g2(t.clientY-l)),this.setScrollSpeed(n,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,i=k5e(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!i.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function y4t(e,t){let n=e.state.facet(a5e);return n.length?n[0](t):sn.mac?t.metaKey:t.ctrlKey}function v4t(e,t){let n=e.state.facet(l5e);return n.length?n[0](t):sn.mac?!t.altKey:!t.ctrlKey}function x4t(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=OE(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function w4t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,i;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Ys.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const Pd=Object.create(null),Nl=Object.create(null),_5e=sn.ie&&sn.ie_version<15||sn.ios&&sn.webkit_version<604;function O4t(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),j5e(e,n.value)},50)}function bD(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function j5e(e,t){t=bD(e.state,BV,t);let{state:n}=e,i,r=1,s=n.toText(t),o=s.lines==n.selection.ranges.length;if(iB!=null&&n.selection.ranges.every(c=>c.empty)&&iB==s.toString()){let c=-1;i=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((o?s.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:ut.cursor(u.from+f.length)}})}else o?i=n.changeByRange(c=>{let u=s.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:ut.cursor(c.from+u.length)}}):i=n.replaceSelection(s);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Nl.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,sn.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Nl.wheel=Nl.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Pd.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Nl.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),i&&(n.lastTouchX=i.clientX,n.lastTouchY=i.clientY),n.setSelectionOrigin("select.pointer")};Nl.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Nl.touchend=(e,t)=>{e.inputState.touchActive=!1};Pd.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(c5e))if(n=i(e,t),n)break;if(!n&&t.button==0&&(n=S4t(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new b4t(e,t,n,i)),i&&e.observer.ignore(()=>{ZLe(e.contentDOM);let s=e.root.activeElement;s&&!s.contains(e.contentDOM)&&s.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function Fne(e,t,n,i){if(i==1)return ut.cursor(t,n);if(i==2)return J3t(e.state,t,n);{let r=e.docView.lineAt(t,n),s=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return lDate.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Une+1)%3:1}function S4t(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=N5e(t),r=e.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),r=r.map(s.changes))},get(s,o,l){let c=e.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,d=Fne(e,c.pos,c.assoc,i);if(n.pos!=c.pos&&!o){let f=Fne(e,n.pos,n.assoc,i),h=Math.min(f.from,d.from),m=Math.max(f.to,d.to);d=h1&&(u=E4t(r,c.pos))?u:l?r.addRange(d):ut.create([d])}}}function E4t(e,t){for(let n=0;n=t)return ut.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Pd.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=n.to||o<=n.from)&&(n=ut.undirectionalRange(s,o))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",bD(e.state,UV,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Pd.dragend=e=>(e.inputState.draggedContent=null,!1);function zne(e,t,n,i){if(n=bD(e.state,BV,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,o=i&&s&&v4t(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},c=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Pd.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&zne(e,t,i.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return zne(e,t,i,!0),!0}return!1};Pd.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=_5e?null:t.clipboardData;return n?(j5e(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(O4t(e),!1)};function C4t(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function T4t(e){let t=[],n=[],i=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:s}of e.selection.ranges){let o=e.doc.lineAt(s);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}i=!0}return{text:bD(e,UV,t.join(e.lineBreak)),ranges:n,linewise:i}}let iB=null;Pd.copy=Pd.cut=(e,t)=>{if(!tS(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=T4t(e.state);if(!n&&!r)return!1;iB=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=_5e?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(C4t(e,n),!1)};const R5e=qf.define();function I5e(e,t){let n=[];for(let i of e.facet(f5e)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:R5e.of(!0)}):null}function P5e(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=I5e(e.state,t);n?e.dispatch(n):e.update([])}},10)}Nl.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),P5e(e)};Nl.blur=e=>{e.observer.clearSelectionRange(),P5e(e)};Nl.compositionstart=Nl.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Nl.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,sn.chrome&&sn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Nl.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Pd.beforeinput=(e,t)=>{var n,i;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let s=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(s&&o.length){let l=o[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return HV(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let r;if(sn.chrome&&sn.android&&(r=T5e.find(s=>s.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return sn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),sn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Nl.compositionend(e,t),20),!1};const Vne=new Set;function A4t(e){Vne.has(e)||(Vne.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const Hne=["pre-wrap","normal","pre-line","break-spaces"];let bw=!1;function qne(){bw=!1}class _4t{constructor(t){this.lineWrapping=t,this.doc=sr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Hne.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let i=0;i-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=i,this.textHeight=r,this.lineLength=s,c){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>rj&&(bw=!0),this.height=t)}replace(t,n,i){return jl.of(i)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=r[l],h=s.lineAt(c,Jr.ByPosNoHeight,i.setDoc(n),0,0),m=h.to>=u?h:s.lineAt(u,Jr.ByPosNoHeight,i,0,0);for(f+=m.to-u,u=m.to;l>0&&h.from<=r[l-1].toA;)c=r[l-1].fromA,d=r[l-1].fromB,l--,cs*2){let l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r=s&&o(this.lineAt(0,Jr.ByPos,i,r,s))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,i=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Mc extends D5e{constructor(t,n,i){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,n){return new wd(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,i){let r=i[0];return i.length==1&&(r instanceof Mc||r instanceof ja&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ja?r=new Mc(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):jl.of(i)}updateHeight(t,n=0,i=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ja extends jl{constructor(t){super(t,0)}heightMetrics(t,n){let i=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,s=r-i+1,o,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*s);o=c/s,this.length>s+1&&(l=(this.height-c)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(t,n,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t0){let s=i[i.length-1];s instanceof ja?i[i.length-1]=new ja(s.length+r):i.push(null,new ja(r-1))}if(t>0){let s=i[0];s instanceof ja?i[0]=new ja(t+s.length):i.unshift(new ja(t-1),null)}return jl.of(i)}decomposeLeft(t,n){n.push(new ja(t-1),null)}decomposeRight(t,n){n.push(null,new ja(this.length-t-1))}updateHeight(t,n=0,i=!1,r){let s=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],l=Math.max(n,r.from),c=-1;for(r.from>n&&o.push(new ja(r.from-n-1).updateHeight(t,n));l<=s&&r.more;){let d=t.doc.lineAt(l).length;o.length&&o.push(null);let f=r.heights[r.index++],h=0;f<0&&(h=-f,f=r.heights[r.index++]),c==-1?c=f:Math.abs(f-c)>=rj&&(c=-2);let m=new Mc(d,f,h);m.outdated=!1,o.push(m),l+=d+1}l<=s&&o.push(null,new ja(s-l).updateHeight(t,l));let u=jl.of(o);return(c<0||Math.abs(u.height-this.height)>=rj||Math.abs(c-this.heightMetrics(t,n).perLine)>=rj)&&(bw=!0),dR(this,u)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class R4t extends jl{constructor(t,n,i){super(t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,n,i,r){let s=i+this.left.height;return tl))return u;let d=n==Jr.ByPosNoHeight?Jr.ByPosNoHeight:Jr.ByPos;return c?u.join(this.right.lineAt(l,d,i,o,l)):this.left.lineAt(l,d,i,r,s).join(u)}forEachLine(t,n,i,r,s,o){let l=r+this.left.height,c=s+this.left.length+this.break;if(this.break)t=c&&this.right.forEachLine(t,n,i,l,c,o);else{let u=this.lineAt(c,Jr.ByPos,i,r,s);t=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,i,l,c,o)}}replace(t,n,i){let r=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,i));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of i)s.push(l);if(t>0&&Wne(s,o-1),n=i&&n.push(null)),t>i&&this.right.decomposeLeft(t-i,n)}decomposeRight(t,n){let i=this.left.length,r=i+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t2*n.size||n.size>2*t.size?jl.of(this.break?[t,null,n]:[t,n]):(this.left=dR(this.left,t),this.right=dR(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,i=!1,r){let{left:s,right:o}=this,l=n+s.length+this.break,c=null;return r&&r.from<=n+s.length&&r.more?c=s=s.updateHeight(t,n,i,r):s.updateHeight(t,n,i),r&&r.from<=l+o.length&&r.more?c=o=o.updateHeight(t,l,i,r):o.updateHeight(t,l,i),c?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Wne(e,t){let n,i;e[t]==null&&(n=e[t-1])instanceof ja&&(i=e[t+1])instanceof ja&&e.splice(t-1,3,new ja(n.length+1+i.length))}const I4t=5;class qV{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Mc?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Mc(i-this.pos,-1,0)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,i){if(t=I4t)&&this.addLineDeco(r,s,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTot&&this.nodes.push(new Mc(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let i=new ja(n-t);return this.oracle.doc.lineAt(t).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Mc)return t;let n=new Mc(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Mc)&&!this.isCovered?this.nodes.push(new Mc(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),l=Math.max(l,h.top),c=Math.min(u==e.parentNode?r.innerHeight:c,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function L4t(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function $4t(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class g3{constructor(t,n,i,r){this.from=t,this.to=n,this.size=i,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let i=0;itypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new _4t(i),this.stateDeco=Xne(n),this.heightMap=jl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle.setDoc(n.doc),[new Mu(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Cn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let r=i?n.head:n.anchor;if(!t.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);t.push(new b2(s,o))}}return this.viewports=t.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Gne:new WV(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(ik(t,this.scaler))})}update(t,n=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=Xne(this.state);let r=t.changedRanges,s=Mu.extendWithRanges(r,P4t(i,this.stateDeco,t?t.changes:Go.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);qne(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||bw)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(p5e)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,i=window.getComputedStyle(n),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Qr.RTL:Qr.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:S,scaleY:k}=XLe(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=S,this.scaleY=k,u|=16,o=c=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,h=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let m=YLe(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=JLe(this.scrollParent||t.win);let b=(this.printing?$4t:M4t)(n,this.paddingTop),v=b.top-this.pixelViewport.top,y=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&!L4t(t.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let S=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(S)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:C,textHeight:E}=t.docView.measureTextSize();o=k>0&&r.refresh(s,k,C,E,Math.max(5,w/C),S),o&&(t.docView.minWidth=0,u|=16)}v>0&&y>0?d=Math.max(v,y):v<0&&y<0&&(d=Math.min(v,y)),qne();for(let k of this.viewports){let C=k.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(k);this.heightMap=(o?jl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle,[new Mu(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new j4t(k.from,C))}bw&&(u|=2)}let O=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return O&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,c=new b2(r.lineAt(o-i*1e3,Jr.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,Jr.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(uc.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(u,Jr.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s>1,o=r<<1;if(this.defaultTextDirection!=Qr.LTR&&!i)return[];let l=[],c=(d,f,h,m)=>{if(f-dd&&yy.from>=h.from&&y.to<=h.to&&Math.abs(y.from-d)y.fromx));if(!v){if(fw.from<=f&&w.to>=f)){let w=n.moveToLineBoundary(ut.cursor(f),!1,!0).head;w>d&&(f=w)}let y=this.gapSize(h,d,f,m),x=i||y<2e6?y:2e6;v=new g3(d,f,y,x)}l.push(v)},u=d=>{if(d.length2e6)for(let k of t)k.from>=d.from&&k.fromd.from&&c(d.from,m,d,f),gn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let i=[];Di.spans(n,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||ik(this.heightMap.lineAt(t,Jr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||ik(this.heightMap.lineAt(this.scaler.fromDOM(t),Jr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return ik(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class b2{constructor(t,n){this.from=t,this.to=n}}function B4t(e,t,n){let i=[],r=e,s=0;return Di.spans(n,e,t,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let r=0;;r++){let{from:s,to:o}=t[r],l=o-s;if(i<=l)return s+i;i-=l}}function v2(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}function U4t(e,t){for(let n of e)if(t(n))return n}const Gne={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Xne(e){let t=e.facet(pD).filter(i=>typeof i!="function"),n=e.facet(zV).filter(i=>typeof i!="function");return n.length&&t.push(Di.join(n)),t}class WV{constructor(t,n,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:c})=>{let u=n.lineAt(l,Jr.ByPos,t,0,0).top,d=n.lineAt(c,Jr.ByPos,t,0,0).bottom;return r+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let n=0,i=0,r=0;;n++){let s=nn.from==t.viewports[i].from&&n.to==t.viewports[i].to):!1}}function ik(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new wd(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(r=>ik(r,t)):e._content)}const x2=an.define({combine:e=>e.join(" ")}),rB=an.define({combine:e=>e.indexOf(!0)>-1}),sB=gg.newName(),M5e=gg.newName(),L5e=gg.newName(),$5e={"&light":"."+M5e,"&dark":"."+L5e};function oB(e,t,n){return new gg(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+i}})}const Q4t=oB("."+sB,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$5e),z4t={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},b3=sn.ie&&sn.ie_version<=11;class V4t{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new v3t,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let i of n)this.queue.push(i);(sn.ie&&sn.ie_version<=11||sn.ios&&t.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&sn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(sn.chrome&&sn.chrome_version<126)&&(this.editContext=new q4t(t),t.state.facet(Rh)&&(t.contentDOM.editContext=this.editContext.editContext)),b3&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,i)=>n!=t[i]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Rh)?i.root.activeElement!=this.dom:!tS(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(sn.ie&&sn.ie_version<=11||sn.android&&sn.chrome)&&!i.state.selection.main.empty&&r.focusNode&&iS(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=OE(t.root);if(!n)return!1;let i=sn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&H4t(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let r=tS(this.dom,i);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&gx(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,i=-1,r=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:i}=o:(n=Math.min(o.from,n),i=Math.max(o.to,i)))}return{from:n,to:i,typeOver:r}}readChange(){let{from:t,to:n,typeOver:i}=this.processRecords(),r=this.selectionChanged&&tS(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new l4t(this.view,t,n,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,r=E5e(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!uR(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let i=Yne(n,t.previousSibling||t.target.previousSibling,-1),r=Yne(n,t.nextSibling||t.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Rh)!=t.state.facet(Rh)&&(t.view.contentDOM.editContext=t.state.facet(Rh)?this.editContext.editContext:null))}destroy(){var t,n,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Yne(e,t,n){for(;t;){let i=Ys.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function Zne(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return iS(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}function H4t(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return Zne(e,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?Zne(e,n):null}class q4t{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let r=t.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),c=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>i.text.length;l==this.from&&sthis.to&&(c=s);let d=C5e(t.state.sliceDoc(l,c),i.text,(u?r.from:r.to)-l,u?"end":null);if(!d){let h=ut.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));uR(h,r)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:sr.of(i.text.slice(d.from,d.toB).split(` -`))};if((sn.mac||sn.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:sr.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);HV(t,f,ut.single(this.toEditorPos(i.selectionStart,h),this.toEditorPos(i.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(n.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let c=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(c{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(t.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=OE(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,i=!1,r=this.pendingContextChange;return t.changes.iterChanges((s,o,l,c,u)=>{if(i)return;let d=u.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(s+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(sthis.to||this.to-this.from+u.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),r&&!i&&this.revertPending(t.state),!i}update(t){let n=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Xt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||x3t(t.parent)||document,this.viewState=new Kne(this,t.state||Ui.create(t)),t.scrollTo&&t.scrollTo.is(p2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fv).map(r=>new d3(r));for(let r of this.plugins)r.update(this);this.observer=new V4t(this),this.inputState=new f4t(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Dne(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Ro?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,r,s=this.state;for(let h of t){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,c=null;t.some(h=>h.annotation(R5e))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=I5e(s,o),c||(l=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(Ui.phrases)!=this.state.facet(Ui.phrases))return this.setState(s);r=aR.create(this,s,t),r.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:m}=h.state.selection,{x:g,y:b}=this.state.facet(Xt.cursorScrollMargin);f=new bx(m.empty?m:ut.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",b,g)}for(let m of h.effects)m.is(p2)&&(f=m.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=fR.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(nk)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(x2)!=r.state.facet(x2)&&(this.viewState.mustMeasureContent=!0),(n||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let h of this.state.facet(J8))try{h(r)}catch(m){sc(this.state,m,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!E5e(this,d)&&u.force&&gx(this.contentDOM,u.key,u.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Kne(this,t),this.plugins=t.facet(Fv).map(i=>new d3(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Dne(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Fv),i=t.state.facet(Fv);if(n!=i){let r=[];for(let s of i){let o=n.indexOf(s);if(o<0)r.push(new d3(s));else{let l=this.plugins[o];l.mustUpdate=t,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(JLe(i||this.win))s=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(r);s=m.from,o=m.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(m=>{try{return m.read(this)}catch(g){return sc(this.state,g),Jne}}),f=aR.create(this,this.state,[]),h=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let m=0;m1||g<-1)&&!(sn.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+g,i?i.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(J8))l(n)}get themeClasses(){return sB+" "+(this.state.facet(rB)?L5e:M5e)+" "+this.state.facet(x2)}updateAttrs(){let t=eie(this,b5e,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Rh)?"true":"false",class:"cm-content",style:`${sn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),eie(this,QV,n);let i=this.observer.ignore(()=>{let r=_ne(this.contentDOM,this.contentAttrs,n),s=_ne(this.dom,this.editorAttrs,t);return r||s});return this.editorAttrs=t,this.contentAttrs=n,i}showAnnouncements(t){let n=!0;for(let i of t)for(let r of i.effects)if(r.is(Xt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(nk);let t=this.state.facet(Xt.cspNonce);gg.mount(this.root,this.styleModules.concat(Q4t).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;ni.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,i){return m3(this,t,Mne(this,t,n,i))}moveByGroup(t,n){return m3(this,t,Mne(this,t,n,i=>n4t(this,t.head,i)))}visualLineSide(t,n){let i=this.bidiSpans(t),r=this.textDirectionAt(t.from),s=i[n?i.length-1:0];return ut.cursor(s.side(n,r)+t.from,s.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,i=!0){return t4t(this,t,n,i)}moveVertically(t,n,i){return m3(this,t,i4t(this,t,n,i))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let i=nB(this,t,n);return i&&i.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),nB(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let i=this.state.doc.lineAt(t),r=this.bidiSpans(i),s=r[Of.find(r,t-i.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==Qr.RTL)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(h5e)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>W4t)return s5e(t.length);let n=this.textDirectionAt(t.from),i;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==n&&(s.fresh||r5e(s.isolates,i=Rne(this,t))))return s.order;i||(i=Rne(this,t));let r=A3t(t.text,n,i);return this.bidiCache.push(new fR(t.from,t.to,n,i,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||sn.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ZLe(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var i,r,s,o;return p2.of(new bx(typeof t=="number"?ut.cursor(t):t,(i=n.y)!==null&&i!==void 0?i:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return p2.of(new bx(ut.cursor(i.from),"start","start",i.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Zs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Zs.define(()=>({}),{eventObservers:t})}static theme(t,n){let i=gg.newName(),r=[x2.of(i),nk.of(oB(`.${i}`,t))];return n&&n.dark&&r.push(rB.of(!0)),r}static baseTheme(t){return Ap.lowest(nk.of(oB("."+sB,t,$5e)))}static findFromDOM(t){var n;let i=t.querySelector(".cm-content"),r=i&&Ys.get(i)||Ys.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Xt.styleModule=nk;Xt.inputHandler=d5e;Xt.clipboardInputFilter=BV;Xt.clipboardOutputFilter=UV;Xt.scrollHandler=m5e;Xt.focusChangeEffect=f5e;Xt.perLineTextDirection=h5e;Xt.exceptionSink=u5e;Xt.updateListener=J8;Xt.editable=Rh;Xt.mouseSelectionStyle=c5e;Xt.dragMovesSelection=l5e;Xt.clickAddsSelectionRange=a5e;Xt.decorations=pD;Xt.blockWrappers=y5e;Xt.outerDecorations=zV;Xt.atomicRanges=rT;Xt.bidiIsolatedRanges=v5e;Xt.cursorScrollMargin=an.define({combine:e=>{let t=5,n=5;for(let i of e)typeof i=="number"?t=n=i:{x:t,y:n}=i;return{x:t,y:n}}});Xt.scrollMargins=x5e;Xt.darkTheme=rB;Xt.cspNonce=an.define({combine:e=>e.length?e[0]:""});Xt.contentAttributes=QV;Xt.editorAttributes=b5e;Xt.lineWrapping=Xt.contentAttributes.of({class:"cm-lineWrapping"});Xt.announce=Gn.define();const W4t=4096,Jne={};class fR{constructor(t,n,i,r,s,o){this.from=t,this.to=n,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(t,n){if(n.empty&&!t.some(s=>s.fresh))return t;let i=[],r=t.length?t[t.length-1].dir:Qr.LTR;for(let s=Math.max(0,t.length-10);s=0;r--){let s=i[r],o=typeof s=="function"?s(e):s;o&&LV(o,n)}return n}const K4t=sn.mac?"mac":sn.windows?"win":sn.linux?"linux":"key";function G4t(e,t){const n=e.split(/-(?!$)/);let i=n[n.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let c=0;ci.concat(r),[]))),n}function Y4t(e,t,n){return B5e(F5e(e.state),t,e,n)}let bm=null;const Z4t=4e3;function J4t(e,t=K4t){let n=Object.create(null),i=Object.create(null),r=(o,l)=>{let c=i[o];if(c==null)i[o]=l;else if(c!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,c,u,d)=>{var f,h;let m=n[o]||(n[o]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>G4t(y,t));for(let y=1;y{let O=bm={view:w,prefix:x,scope:o};return setTimeout(()=>{bm==O&&(bm=null)},Z4t),!0}]})}let b=g.join(" ");r(b,!1);let v=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((h=(f=m._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&v.run.push(c),u&&(v.preventDefault=!0),d&&(v.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let h in d)d[h].run.push(m=>f(m,aB))}let c=o[t]||o.key;if(c)for(let u of l)s(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let aB=null;function B5e(e,t,n,i){aB=t;let r=h3t(t),s=Zl(r,0),o=hf(s)==r.length&&r!=" ",l="",c=!1,u=!1,d=!1;bm&&bm.view==n&&bm.scope==i&&(l=bm.prefix+" ",A5e.indexOf(t.keyCode)<0&&(u=!0,bm=null));let f=new Set,h=v=>{if(v){for(let y of v.run)if(!f.has(y)&&(f.add(y),y(n)))return v.stopPropagation&&(d=!0),!0;v.preventDefault&&(v.stopPropagation&&(d=!0),u=!0)}return!1},m=e[i],g,b;return m&&(h(m[l+w2(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(sn.windows&&t.ctrlKey&&t.altKey)&&!(sn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=bg[t.keyCode])&&g!=r?(h(m[l+w2(g,t,!0)])||t.shiftKey&&(b=xE[t.keyCode])!=r&&b!=g&&h(m[l+w2(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&h(m[l+w2(r,t,!0)])&&(c=!0),!c&&h(m._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),aB=null,c}class ny{constructor(t,n,i,r,s){this.className=t,this.left=n,this.top=i,this.width=r,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,i){if(i.empty){let r=t.coordsAtPos(i.head,i.assoc||1);if(!r)return[];let s=U5e(t);return[new ny(n,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return e$t(t,n,i)}}function U5e(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Qr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function nie(e,t,n,i){let r=e.coordsAtPos(t,n*2);if(!r)return i;let s=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=e.posAtCoords({x:s.left+1,y:o}),c=e.posAtCoords({x:s.right-1,y:o});return l==null||c==null?i:{from:Math.max(i.from,Math.min(l,c)),to:Math.min(i.to,Math.max(l,c))}}function e$t(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),s=e.textDirection==Qr.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),c=U5e(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),h=l.right-(d?parseInt(d.paddingRight):0),m=tB(e,i,1),g=tB(e,r,-1),b=m.type==La.Text?m:null,v=g.type==La.Text?g:null;if(b&&(e.lineWrapping||m.widgetLineBreaks)&&(b=nie(e,i,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=nie(e,r,-1,v)),b&&v&&b.from==v.from&&b.to==v.to)return x(w(n.from,n.to,b));{let S=b?w(n.from,null,b):O(m,!1),k=v?w(null,n.to,v):O(g,!0),C=[];return(b||m).to<(v||g).from-(b&&v?1:0)||m.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2T&&A.from=D)break;I>P&&j(Math.max(U,P),S==null&&U<=T,Math.min(I,D),k==null&&I>=N,L.dir)}if(P=M.to+1,P>=D)break}return _.length==0&&j(T,S==null,N,k==null,e.textDirection),{top:E,bottom:R,horizontal:_}}function O(S,k){let C=l.top+(k?S.top:S.bottom);return{top:C,bottom:C,horizontal:[]}}}function t$t(e,t){return e.constructor==t.constructor&&e.eq(t)}class n$t{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(sj)!=t.state.facet(sj)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,i=t.facet(sj);for(;n!t$t(n,this.drawn[i]))){let n=this.dom.firstChild,i=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[i].constructor&&r.update(n,this.drawn[i])?(n=n.nextSibling,i++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,sn.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const sj=an.define();function Q5e(e){return[Zs.define(t=>new n$t(t,e)),sj.of(e)]}const yw=an.define({combine(e){return Wf(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function i$t(e={}){return[yw.of(e),r$t,s$t,o$t,p5e.of(!0)]}function z5e(e){return e.startState.facet(yw)!=e.state.facet(yw)}const r$t=Q5e({above:!0,markers(e){let{state:t}=e,n=t.facet(yw),i=[];for(let r of t.selection.ranges){let s=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(s&&sn.ios&&n.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:ut.cursor(r.head,r.assoc);for(let c of ny.forRange(e,o,l))i.push(c)}}return i},update(e,t){e.transactions.some(i=>i.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=z5e(e);return n&&iie(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){iie(t.state,e)},class:"cm-cursorLayer"});function iie(e,t){t.style.animationDuration=e.facet(yw).cursorBlinkRate+"ms"}const s$t=Q5e({above:!1,markers(e){let t=[],{main:n,ranges:i}=e.state.selection;for(let r of i)if(!r.empty)for(let s of ny.forRange(e,"cm-selectionBackground",r))t.push(s);if(sn.ios&&!n.empty&&e.state.facet(yw).iosSelectionHandles){for(let r of ny.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ut.cursor(n.from,1)))t.push(r);for(let r of ny.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ut.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||z5e(e)},class:"cm-selectionLayer"}),o$t=Ap.highest(Xt.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),V5e=Gn.define({map(e,t){return e==null?null:t.mapPos(e)}}),rk=Qa.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,i)=>i.is(V5e)?i.value:n,e)}}),a$t=Zs.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(rk);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(rk)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(rk),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(rk)!=e&&this.view.dispatch({effects:V5e.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function l$t(){return[rk,a$t]}function rie(e,t,n,i,r){t.lastIndex=0;for(let s=e.iterRange(n,i),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=t.exec(s.value);)r(o+l.index,l)}function c$t(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:r,to:s}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}class u$t{constructor(t){const{regexp:n,decoration:i,decorate:r,boundary:s,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(l,c,u,d)=>r(d,u,u+l[0].length,l,c);else if(typeof i=="function")this.addMatch=(l,c,u,d)=>{let f=i(l,c,u);f&&d(u,u+l[0].length,f)};else if(i)this.addMatch=(l,c,u,d)=>d(u,u+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(t){let n=new pp,i=n.add.bind(n);for(let{from:r,to:s}of c$t(t,this.maxLength))rie(t.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,t,o,i));return n.finish()}updateDeco(t,n){let i=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((s,o,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(i=Math.min(l,i),r=Math.max(c,r))}),t.viewportMoved||r-i>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),i,r):n}updateRange(t,n,i,r){for(let s of t.visibleRanges){let o=Math.max(s.from,i),l=Math.min(s.to,r);if(l>=o){let c=t.state.doc.lineAt(o),u=c.toc.from;o--)if(this.boundary.test(c.text[o-1-c.from])){d=o;break}for(;lh.push(y.range(b,v));if(c==u)for(this.regexp.lastIndex=d-c.from;(m=this.regexp.exec(c.text))&&m.indexthis.addMatch(v,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,v)=>bf,add:h})}}return n}}const lB=/x/.unicode!=null?"gu":"g",d$t=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,lB),f$t={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let y3=null;function h$t(){var e;if(y3==null&&typeof document<"u"&&document.body){let t=document.body.style;y3=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return y3||!1}const oj=an.define({combine(e){let t=Wf(e,{render:null,specialChars:d$t,addSpecialChars:null});return(t.replaceTabs=!h$t())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,lB)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,lB)),t}});function p$t(e={}){return[oj.of(e),m$t()]}let sie=null;function m$t(){return sie||(sie=Zs.fromClass(class{constructor(e){this.view=e,this.decorations=Cn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(oj)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new u$t({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=Zl(t[0],0);if(s==9){let o=r.lineAt(i),l=n.state.tabSize,c=Id(o.text,l,i-o.from);return Cn.replace({widget:new v$t((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Cn.replace({widget:new y$t(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(oj);e.startState.facet(oj)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const g$t="•";function b$t(e){return e>=32?g$t:e==10?"␤":String.fromCharCode(9216+e)}class y$t extends Qd{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=b$t(this.code),i=t.state.phrase("Control character")+" "+(f$t[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,n);if(r)return r;let s=document.createElement("span");return s.textContent=n,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class v$t extends Qd{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function x$t(){return O$t}const w$t=Cn.line({class:"cm-activeLine"}),O$t=Zs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let r=e.lineBlockAt(i.head);r.from>t&&(n.push(w$t.range(r.from)),t=r.from)}return Cn.set(n)}},{decorations:e=>e.decorations});class k$t extends Qd{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?nS(t.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(t.parentNode),r=kE(n[0],i.direction!="rtl"),s=parseInt(i.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}}function S$t(e){let t=Zs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Cn.set([Cn.widget({widget:new k$t(e),side:1}).range(0)]):Cn.none}get decorations(){return this.view.state.doc.length?Cn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Xt.contentAttributes.of({"aria-placeholder":e})]:t}const cB=2e3;function E$t(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>cB||n.off>cB||t.col<0||n.col<0){let o=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=i;c<=r;c++){let u=e.doc.line(c);u.length<=l&&s.push(ut.range(u.from+o,u.to+l))}}else{let o=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=i;c<=r;c++){let u=e.doc.line(c),d=Q8(u.text,o,e.tabSize,!0);if(d<0)s.push(ut.cursor(u.to));else{let f=Q8(u.text,l,e.tabSize);s.push(ut.range(u.from+d,u.from+f))}}}return s}function C$t(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function oie(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(n),r=n-i.from,s=r>cB?-1:r==i.length?C$t(e,t.clientX):Id(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function T$t(e,t){let n=oie(e,t),i=e.state.selection;return n?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},i=i.map(r.changes)}},get(r,s,o){let l=oie(e,r);if(!l)return i;let c=E$t(e.state,n,l);return c.length?o?ut.create(c.concat(i.ranges)):ut.create(c):i}}:null}function A$t(e){let t=n=>n.altKey&&n.button==0;return Xt.mouseSelectionStyle.of((n,i)=>t(i)?T$t(n,i):null)}const _$t={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},j$t={style:"cursor: crosshair"};function N$t(e={}){let[t,n]=_$t[e.key||"Alt"],i=Zs.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||n(r))},keyup(r){(r.keyCode==t||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[i,Xt.contentAttributes.of(r=>{var s;return!((s=r.plugin(i))===null||s===void 0)&&s.isDown?j$t:null})]}const O2="-10000px";class H5e{constructor(t,n,i,r){this.facet=n,this.createTooltipView=i,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=i(o,s))}update(t,n){var i;let r=t.state.facet(this.facet),s=r.filter(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function R$t(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const v3=an.define({combine:e=>{var t,n,i;return{position:sn.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=e.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||R$t}}}),aie=new WeakMap,KV=Zs.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(v3);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new H5e(e,GV,(n,i)=>this.createTooltip(n,i),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(v3);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=O2,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(sn.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=VV(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(v3).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let l=0;l=Math.min(n.bottom,i.bottom)||f.rightMath.min(n.right,i.right)+.1)){d.style.top=O2;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,v=(t=aie.get(u))!==null&&t!==void 0?t:h.bottom-h.top,y=u.offset||P$t,x=this.view.textDirection==Qr.LTR,w=h.width>i.right-i.left?x?i.left:i.right-h.width:x?Math.max(i.left,Math.min(f.left-(m?14:0)+y.x,i.right-b)):Math.min(Math.max(i.left,f.left-b+(m?14:0)-y.x),i.right-b),O=this.above[l];!c.strictSide&&(O?f.top-v-g-y.yi.bottom)&&O==i.bottom-f.bottom>f.top-i.top&&(O=this.above[l]=!O);let S=(O?f.top-i.top:i.bottom-f.bottom)-g;if(Sw&&E.topk&&(k=O?E.top-v-2-g:E.bottom+g+2);if(this.position=="absolute"?(d.style.top=(k-e.parent.top)/s+"px",lie(d,(w-e.parent.left)/r)):(d.style.top=k/s+"px",lie(d,w/r)),m){let E=f.left+(x?y.x:-y.x)-(w+14-7);m.style.left=E/r+"px"}u.overlap!==!0&&o.push({left:w,top:k,right:C,bottom:k+v}),d.classList.toggle("cm-tooltip-above",O),d.classList.toggle("cm-tooltip-below",!O),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=O2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lie(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const I$t=Xt.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),P$t={x:0,y:0},GV=an.define({enables:[KV,I$t]}),hR=an.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class yD{static create(t){return new yD(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new H5e(t,hR,(n,i)=>this.createHostedView(n,i),n=>n.dom.remove())}createHostedView(t,n){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let i of this.manager.tooltipViews){let r=i[t];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const D$t=GV.compute([hR],e=>{let t=e.facet(hR);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var i;return(i=n.end)!==null&&i!==void 0?i:n.pos})),create:yD.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),q5e=an.define();class M$t{constructor(t,n,i,r,s,o){this.view=t,this.source=n,this.field=i,this.locked=r,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;to.bottom||n.xo.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=l&&l.dir==Qr.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(c=>{this.pending==l&&(this.pending=null,o(c))},c=>sc(t.state,c,"hover tooltip"))}else o(s)}get tooltip(){let t=this.view.plugin(KV),n=t?t.manager.tooltips.findIndex(i=>i.create==yD.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:s}=this;if(r.length&&!this.locked.has(r)&&s&&!L$t(s.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,l=(i=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!$$t(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:i}=this;i&&i.dom.contains(t.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=i=>{t.removeEventListener("mouseleave",n);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const k2=4;function L$t(e,t){let{left:n,right:i,top:r,bottom:s}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return t.clientX>=n-k2&&t.clientX<=i+k2&&t.clientY>=r-k2&&t.clientY<=s+k2}function $$t(e,t,n,i,r,s){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,l)=t&&c<=n}function F$t(e,t={}){let n=Gn.define(),i=new WeakMap,r=Qa.define({create(){return[]},update(o,l){let c=i.get(o);if(o.length&&(t.hideOnChange&&(l.docChanged||l.selection)?o=[]:c&&c(l)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let d of o){let f=l.changes.mapPos(d.pos,-1,Pa.TrackDel);if(f!=null){let h=Object.assign(Object.create(null),d);h.pos=f,h.end!=null&&(h.end=l.changes.mapPos(h.end)),u.push(h)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(U$t)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&i.set(o,c),o},provide:o=>hR.from(o)});const s=Zs.define(o=>new M$t(o,e,r,i,n,t.hoverTime||300));return{active:r,extension:[r,s,q5e.of(s),D$t]}}function B$t(e,t,n,i={}){var r;let s=e.state.facet(q5e).map(o=>e.plugin(o)).filter(o=>!!o);if(i.tooltip&&i.tooltip.active){let o=s.find(l=>l.field==i.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(e,t,n,(r=i.until)!==null&&r!==void 0?r:()=>!1)}function W5e(e,t){let n=e.plugin(KV);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const U$t=Gn.define(),cie=an.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function XV(e,t){let n=e.plugin(K5e),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const K5e=Zs.fromClass(class{constructor(e){this.input=e.state.facet(EE),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(cie);this.top=new S2(e,!0,t.topContainer),this.bottom=new S2(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(cie);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new S2(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new S2(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(EE);if(n!=this.input){let i=n.filter(c=>c),r=[],s=[],o=[],l=[];for(let c of i){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.push(d)):(d=this.panels[u],d.update&&d.update(e)),r.push(d),(d.top?s:o).push(d)}this.specs=i,this.panels=r,this.top.sync(s),this.bottom.sync(o);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let i of this.panels)i.update&&i.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Xt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class S2{constructor(t,n,i){this.view=t,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=uie(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=uie(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function uie(e){let t=e.nextSibling;return e.remove(),t}const EE=an.define({enables:K5e});function Q$t(e,t){let n,i=new Promise(o=>n=o),r=o=>z$t(o,t,n);e.state.field(x3,!1)?e.dispatch({effects:G5e.of(r)}):e.dispatch({effects:Gn.appendConfig.of(x3.init(()=>[r]))});let s=X5e.of(r);return{close:s,result:i.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(x3).indexOf(r)>-1&&e.dispatch({effects:s})}),o))}}const x3=Qa.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(G5e)?e=[n.value].concat(e):n.is(X5e)&&(e=e.filter(i=>i!=n.value));return e},provide:e=>EE.computeN([e],t=>t.field(e))}),G5e=Gn.define(),X5e=Gn.define();function z$t(e,t,n){let i=t.content?t.content(e,()=>o(null)):null;if(!i){if(i=Ir("form"),t.input){let l=Ir("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(Ir("label",(t.label||"")+": ",l))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Ir("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(c))}),c.addEventListener("submit",u=>{u.preventDefault(),o(c)})}let s=Ir("div",i,Ir("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(s.className=t.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:s,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=i.querySelector(t.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class gp extends mg{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}gp.prototype.elementClass="";gp.prototype.toDOM=void 0;gp.prototype.mapMode=Pa.TrackBefore;gp.prototype.startSide=gp.prototype.endSide=-1;gp.prototype.point=!0;const aj=an.define(),V$t=an.define(),H$t={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Di.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},sS=an.define();function q$t(e){return[Y5e(),sS.of({...H$t,...e})]}const die=an.define({combine:e=>e.some(t=>t)});function Y5e(e){return[W$t]}const W$t=Zs.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(sS).map(t=>new hie(e,t)),this.fixed=!e.state.facet(die);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(die)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Di.iter(this.view.state.facet(aj),this.view.viewport.from),i=[],r=this.gutters.map(s=>new K$t(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==La.Text&&o){uB(n,i,l.from);for(let c of r)c.line(this.view,l,i);o=!1}else if(l.widget)for(let c of r)c.widget(this.view,l)}else if(s.type==La.Text){uB(n,i,s.from);for(let o of r)o.line(this.view,s,i)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(sS),n=e.state.facet(sS),i=e.docChanged||e.heightChanged||e.viewportChanged||!Di.eq(e.startState.facet(aj),e.state.facet(aj),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let r of this.gutters)r.update(e)&&(i=!0);else{i=!0;let r=[];for(let s of n){let o=t.indexOf(s);o<0?r.push(new hie(this.view,s)):(this.gutters[o].update(e),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Xt.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Qr.LTR?{left:i,right:r}:{right:i,left:r}})});function fie(e){return Array.isArray(e)?e:[e]}function uB(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class K$t{constructor(t,n,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Di.iter(t.markers,n.from)}addElement(t,n,i){let{gutter:r}=this,s=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==r.elements.length){let l=new Z5e(t,o,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(t,o,s,i);this.height=n.bottom,this.i++}line(t,n,i){let r=[];uB(this.cursor,r,n.from),i.length&&(r=r.concat(i));let s=this.gutter.config.lineMarker(t,n,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,r)}widget(t,n){let i=this.gutter.config.widgetMarker(t,n.widget,n),r=i?[i]:null;for(let s of t.state.facet(V$t)){let o=s(t,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(t,n,r)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class hie{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in n.domEventHandlers)this.dom.addEventListener(i,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=r.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[i](t,l,r)&&r.preventDefault()});this.markers=fie(n.markers(t)),n.initialSpacer&&(this.spacer=new Z5e(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=fie(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let i=t.view.viewport;return!Di.eq(this.markers,n,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Z5e{constructor(t,n,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,i,r)}update(t,n,i,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),G$t(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,c=ss(l,c,u)||o(l,c,u):o}return i}})}});class w3 extends gp{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function O3(e,t){return e.state.facet(Bv).formatNumber(t,e.state)}const Z$t=sS.compute([Bv],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(X$t)},lineMarker(t,n,i){return i.some(r=>r.toDOM)?null:new w3(O3(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,i)=>{for(let r of t.state.facet(Y$t)){let s=r(t,n,i);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Bv)!=t.state.facet(Bv),initialSpacer(t){return new w3(O3(t,pie(t.state.doc.lines)))},updateSpacer(t,n){let i=O3(n.view,pie(n.view.state.doc.lines));return i==t.number?t:new w3(i)},domEventHandlers:e.facet(Bv).domEventHandlers,side:"before"}));function J5e(e={}){return[Bv.of(e),Y5e(),Z$t]}function pie(e){let t=9;for(;t{let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.head).from;r>n&&(n=r,t.push(J$t.range(r)))}return Di.of(t)});function t6t(){return e6t}let n6t=0,uf=class dB{constructor(t,n,i,r){this.name=t,this.set=n,this.base=i,this.modified=r,this.id=n6t++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let i=typeof t=="string"?t:"?";if(t instanceof dB&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new dB(i,[],null,[]);if(r.set.push(r),n)for(let s of n.set)r.set.push(s);return r}static defineModifier(t){let n=new pR(t);return i=>i.modified.indexOf(n)>-1?i:pR.get(i.base||i,i.modified.concat(n).sort((r,s)=>r.id-s.id))}},i6t=0;class pR{constructor(t){this.name=t,this.instances=[],this.id=i6t++}static get(t,n){if(!n.length)return t;let i=n[0].instances.find(l=>l.base==t&&r6t(n,l.modified));if(i)return i;let r=[],s=new uf(t.name,r,t,n);for(let l of n)l.instances.push(s);let o=s6t(n);for(let l of t.set)if(!l.modified.length)for(let c of o)r.push(pR.get(l,c));return s}}function r6t(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function s6t(e){let t=[[]];for(let n=0;ni.length-n.length)}function _p(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let r of n.split(" "))if(r){let s=[],o=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+r);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==r.length)break;let m=r[f++];if(f==r.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+r);l=r.slice(f)}let c=s.length-1,u=s[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new CE(i,o,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return e3e.add(t)}const e3e=new Kn({combine(e,t){let n,i,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new CE(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});let CE=class{constructor(t,n,i,r){this.tags=t,this.mode=n,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=r;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:i}}function o6t(e,t){let n=null;for(let i of e){let r=i.style(t);r&&(n=n?n+" "+r:r)}return n}function a6t(e,t,n,i=0,r=e.length){let s=new l6t(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}class l6t{constructor(t,n,i){this.at=t,this.highlighters=n,this.span=i,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,i,r,s){let{type:o,from:l,to:c}=t;if(l>=i||c<=n)return;o.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(o)));let u=r,d=c6t(t)||CE.empty,f=o6t(s,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let h=t.tree&&t.tree.prop(Kn.mounted);if(h&&h.overlay){let m=t.node.enter(h.overlay[0].from+l,1),g=this.highlighters.filter(v=>!v.scope||v.scope(h.tree.type)),b=t.firstChild();for(let v=0,y=l;;v++){let x=v=w||!t.nextSibling())););if(!x||w>i)break;y=x.to+l,y>n&&(this.highlightRange(m.cursor(),Math.max(n,x.from+l),Math.min(i,y),"",g),this.startSpan(Math.min(i,y),u))}b&&t.parent()}else if(t.firstChild()){h&&(r="");do if(!(t.to<=n)){if(t.from>=i)break;this.highlightRange(t,n,i,r,s),this.startSpan(Math.min(i,t.to),u)}while(t.nextSibling());t.parent()}}}function c6t(e){let t=e.type.prop(e3e);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const tn=uf.define,E2=tn(),lm=tn(),mie=tn(lm),gie=tn(lm),cm=tn(),C2=tn(cm),k3=tn(cm),of=tn(),ib=tn(of),ef=tn(),tf=tn(),fB=tn(),mO=tn(fB),T2=tn(),oe={comment:E2,lineComment:tn(E2),blockComment:tn(E2),docComment:tn(E2),name:lm,variableName:tn(lm),typeName:mie,tagName:tn(mie),propertyName:gie,attributeName:tn(gie),className:tn(lm),labelName:tn(lm),namespace:tn(lm),macroName:tn(lm),literal:cm,string:C2,docString:tn(C2),character:tn(C2),attributeValue:tn(C2),number:k3,integer:tn(k3),float:tn(k3),bool:tn(cm),regexp:tn(cm),escape:tn(cm),color:tn(cm),url:tn(cm),keyword:ef,self:tn(ef),null:tn(ef),atom:tn(ef),unit:tn(ef),modifier:tn(ef),operatorKeyword:tn(ef),controlKeyword:tn(ef),definitionKeyword:tn(ef),moduleKeyword:tn(ef),operator:tf,derefOperator:tn(tf),arithmeticOperator:tn(tf),logicOperator:tn(tf),bitwiseOperator:tn(tf),compareOperator:tn(tf),updateOperator:tn(tf),definitionOperator:tn(tf),typeOperator:tn(tf),controlOperator:tn(tf),punctuation:fB,separator:tn(fB),bracket:mO,angleBracket:tn(mO),squareBracket:tn(mO),paren:tn(mO),brace:tn(mO),content:of,heading:ib,heading1:tn(ib),heading2:tn(ib),heading3:tn(ib),heading4:tn(ib),heading5:tn(ib),heading6:tn(ib),contentSeparator:tn(of),list:tn(of),quote:tn(of),emphasis:tn(of),strong:tn(of),link:tn(of),monospace:tn(of),strikethrough:tn(of),inserted:tn(),deleted:tn(),changed:tn(),invalid:tn(),meta:T2,documentMeta:tn(T2),annotation:tn(T2),processingInstruction:tn(T2),definition:uf.defineModifier("definition"),constant:uf.defineModifier("constant"),function:uf.defineModifier("function"),standard:uf.defineModifier("standard"),local:uf.defineModifier("local"),special:uf.defineModifier("special")};for(let e in oe){let t=oe[e];t instanceof uf&&(t.name=e)}t3e([{tag:oe.link,class:"tok-link"},{tag:oe.heading,class:"tok-heading"},{tag:oe.emphasis,class:"tok-emphasis"},{tag:oe.strong,class:"tok-strong"},{tag:oe.keyword,class:"tok-keyword"},{tag:oe.atom,class:"tok-atom"},{tag:oe.bool,class:"tok-bool"},{tag:oe.url,class:"tok-url"},{tag:oe.labelName,class:"tok-labelName"},{tag:oe.inserted,class:"tok-inserted"},{tag:oe.deleted,class:"tok-deleted"},{tag:oe.literal,class:"tok-literal"},{tag:oe.string,class:"tok-string"},{tag:oe.number,class:"tok-number"},{tag:[oe.regexp,oe.escape,oe.special(oe.string)],class:"tok-string2"},{tag:oe.variableName,class:"tok-variableName"},{tag:oe.local(oe.variableName),class:"tok-variableName tok-local"},{tag:oe.definition(oe.variableName),class:"tok-variableName tok-definition"},{tag:oe.special(oe.variableName),class:"tok-variableName2"},{tag:oe.definition(oe.propertyName),class:"tok-propertyName tok-definition"},{tag:oe.typeName,class:"tok-typeName"},{tag:oe.namespace,class:"tok-namespace"},{tag:oe.className,class:"tok-className"},{tag:oe.macroName,class:"tok-macroName"},{tag:oe.propertyName,class:"tok-propertyName"},{tag:oe.operator,class:"tok-operator"},{tag:oe.comment,class:"tok-comment"},{tag:oe.meta,class:"tok-meta"},{tag:oe.invalid,class:"tok-invalid"},{tag:oe.punctuation,class:"tok-punctuation"}]);var S3;const _m=new Kn;function vD(e){return an.define({combine:e?t=>t.concat(e):void 0})}const YV=new Kn;class qc{constructor(t,n,i=[],r=""){this.data=t,this.name=r,Ui.prototype.hasOwnProperty("tree")||Object.defineProperty(Ui.prototype,"tree",{get(){return Lr(this)}}),this.parser=n,this.extension=[vg.of(this),Ui.languageData.of((s,o,l)=>{let c=bie(s,o,l),u=c.type.prop(_m);if(!u)return[];let d=s.facet(u),f=c.type.prop(YV);if(f){let h=c.resolve(o-c.from,l);for(let m of f)if(m.test(h,s)){let g=s.facet(m.facet);return m.type=="replace"?g:g.concat(d)}}return d})].concat(i)}isActiveAt(t,n,i=-1){return bie(t,n,i).type.prop(_m)==this.data}findRegions(t){let n=t.facet(vg);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(_m)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(Kn.mounted);if(l){if(l.tree.prop(_m)==this.data){if(l.overlay)for(let c of l.overlay)i.push({from:c.from+o,to:c.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let c=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>c)return}}for(let c=0;ci.isTop?n:void 0)]}),t.name)}configure(t,n){return new bp(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(e){let t=e.field(qc.state,!1);return t?t.tree:Ci.empty}class u6t{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-i,n-i)}}let gO=null;class _y{constructor(t,n,i=[],r,s,o,l,c){this.parser=t,this.state=n,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,i){return new _y(t,n,[],Ci.empty,0,i,[],null)}startParse(){return this.parser.startParse(new u6t(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ci.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Jh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=gO;gO=this;try{return t()}finally{gO=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=yie(t,n.from,n.to);return t}changes(t,n){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,f,h)=>c.push({fromA:u,toA:d,fromB:f,toB:h})),i=Jh.applyChanges(i,c),r=Ci.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);dt.from&&(this.fragments=yie(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends dD{createParse(n,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let c=gO;if(c){for(let u of r)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new Ci(Po.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return gO}}function yie(e,t,n){return Jh.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class vw{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new vw(n)}static init(t){let n=Math.min(3e3,t.doc.length),i=_y.create(t.facet(vg).parser,t,{from:0,to:n});return i.work(20,n)||i.takeTree(),new vw(i)}}qc.state=Qa.define({create:vw.init,update(e,t){for(let n of t.effects)if(n.is(qc.setState))return n.value;return t.startState.facet(vg)!=t.state.facet(vg)?vw.init(t.state):e.apply(t)}});let n3e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(n3e=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const E3=typeof navigator<"u"&&(!((S3=navigator.scheduling)===null||S3===void 0)&&S3.isInputPending)?()=>navigator.scheduling.isInputPending():null,d6t=Zs.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(qc.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(qc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=n3e(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndr+1e3,c=s.context.work(()=>E3&&E3()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:qc.setState.of(new vw(s.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>sc(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),vg=an.define({combine(e){return e.length?e[0]:null},enables:e=>[qc.state,d6t,Xt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class xg{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class mR{constructor(t,n,i,r,s,o=void 0){this.name=t,this.alias=n,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:n,support:i}=t;if(!n){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(i)}return new mR(t.name,(t.alias||[]).concat(t.name).map(r=>r.toLowerCase()),t.extensions||[],t.filename,n,i)}static matchFilename(t,n){for(let r of t)if(r.filename&&r.filename.test(n))return r;let i=/\.([^.]+)$/.exec(n);if(i){for(let r of t)if(r.extensions.indexOf(i[1])>-1)return r}return null}static matchLanguageName(t,n,i=!0){n=n.toLowerCase();for(let r of t)if(r.alias.some(s=>s==n))return r;if(i)for(let r of t)for(let s of r.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return r}return null}}const f6t=an.define(),f1=an.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function jy(e){let t=e.facet(f1);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function TE(e,t){let n="",i=e.tabSize,r=e.facet(f1)[0];if(r==" "){for(;t>=i;)n+=" ",t-=i;r=" "}for(let s=0;s=t?h6t(e,n,t):null}class xD{constructor(t,n={}){this.state=t,this.options=n,this.unit=jy(t)}lineAt(t,n=1){let i=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==t?{text:"",from:t}:(n<0?r-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,n=t.length){return Id(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:i,from:r}=this.lineAt(t,n),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const jp=new Kn;function h6t(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let s=[];for(let o=r;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return i3e(i,e,n)}function i3e(e,t,n){for(let i=e;i;i=i.next){let r=m6t(i.node);if(r)return r(JV.create(t,n,i))}return 0}function p6t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function m6t(e){let t=e.type.prop(jp);if(t)return t;let n=e.firstChild,i;if(n&&(i=n.type.prop(Kn.closedBy))){let r=e.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>r3e(o,!0,1,void 0,s&&!p6t(o)?r.from:void 0)}return e.parent==null?g6t:null}function g6t(){return 0}class JV extends xD{constructor(t,n,i){super(t.state,t.options),this.base=t,this.pos=n,this.context=i}get node(){return this.context.node}static create(t,n,i){return new JV(t,n,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(n.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(b6t(i,t))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return i3e(this.context.next,this.base,this.pos)}}function b6t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function y6t(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=n.to;;){let c=t.childAfter(l);if(!c||c==i)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=c.to}}function yx({closing:e,align:t=!0,units:n=1}){return i=>r3e(i,t,n,e)}function r3e(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==e.pos+o,c=t?y6t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const v6t=e=>e.baseIndent;function vx({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const x6t=200;function w6t(){return Ui.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+x6t)return e;let s=n.sliceString(r.from,i);if(!t.some(u=>u.test(s)))return e;let{state:o}=e,l=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=ZV(o,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=TE(o,f);h!=m&&c.push({from:d.from,to:d.from+h.length,insert:m})}return c.length?[e,{changes:c,sequential:!0}]:e})}const s3e=an.define(),Np=new Kn;function sT(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&l.from=t&&u.to>n&&(s=u)}}return s}function k6t(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function gR(e,t,n){for(let i of e.facet(s3e)){let r=i(e,t,n);if(r)return r}return O6t(e,t,n)}function o3e(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const wD=Gn.define({map:o3e}),oT=Gn.define({map:o3e});function a3e(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(i=>i.from<=n&&i.to>=n)||t.push(e.lineBlockAt(n));return t}const Ny=Qa.define({create(){return Cn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((i,r)=>e=vie(e,i,r)),e=e.map(t.changes);let n=[];for(let i of t.effects)i.is(wD)&&!S6t(e,i.value.from,i.value.to)?n.push(i.value):i.is(oT)&&(e=e.update({filter:(r,s)=>i.value.from!=r||i.value.to!=s,filterFrom:i.value.from,filterTo:i.value.to}));if(n.length){let{preparePlaceholder:i}=t.state.facet(u3e),r=n.map(s=>(i?Cn.replace({widget:new N6t(i(t.state,s))}):xie).range(s.from,s.to));e=e.update({add:r})}return t.selection&&(e=vie(e,t.selection.main.head)),e},provide:e=>Xt.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(i,r)=>{n.push(i,r)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{rt&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(r,s)=>r>=n||s<=t}):e}function bR(e,t,n){var i;let r=null;return(i=e.field(Ny,!1))===null||i===void 0||i.between(t,n,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function S6t(e,t,n){let i=!1;return e.between(t,t,(r,s)=>{r==t&&s==n&&(i=!0)}),i}function l3e(e,t){return e.field(Ny,!1)?t:t.concat(Gn.appendConfig.of(d3e()))}const E6t=e=>{for(let t of a3e(e)){let n=gR(e.state,t.from,t.to);if(n)return e.dispatch({effects:l3e(e.state,[wD.of(n),c3e(e,n)])}),!0}return!1},C6t=e=>{if(!e.state.field(Ny,!1))return!1;let t=[];for(let n of a3e(e)){let i=bR(e.state,n.from,n.to);i&&t.push(oT.of(i),c3e(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function c3e(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Xt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const T6t=e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(Ny,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(i,r)=>{n.push(oT.of({from:i,to:r}))}),e.dispatch({effects:n}),!0},_6t=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:E6t},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:C6t},{key:"Ctrl-Alt-[",run:T6t},{key:"Ctrl-Alt-]",run:A6t}],j6t={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},u3e=an.define({combine(e){return Wf(e,j6t)}});function d3e(e){return[Ny,P6t]}function f3e(e,t){let{state:n}=e,i=n.facet(u3e),r=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),c=bR(e.state,l.from,l.to);c&&e.dispatch({effects:oT.of(c)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const xie=Cn.replace({widget:new class extends Qd{toDOM(e){return f3e(e,null)}}});class N6t extends Qd{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return f3e(t,this.value)}}const R6t={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class C3 extends gp{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function I6t(e={}){let t={...R6t,...e},n=new C3(t,!0),i=new C3(t,!1),r=Zs.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(vg)!=o.state.facet(vg)||o.startState.field(Ny,!1)!=o.state.field(Ny,!1)||Lr(o.startState)!=Lr(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new pp;for(let c of o.viewportLineBlocks){let u=bR(o.state,c.from,c.to)?i:gR(o.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[r,q$t({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||Di.empty},initialSpacer(){return new C3(t,!1)},domEventHandlers:{...s,click:(o,l,c)=>{if(s.click&&s.click(o,l,c))return!0;let u=bR(o.state,l.from,l.to);if(u)return o.dispatch({effects:oT.of(u)}),!0;let d=gR(o.state,l.from,l.to);return d?(o.dispatch({effects:wD.of(d)}),!0):!1}}}),d3e()]}const P6t=Xt.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class aT{constructor(t,n){this.specs=t;let i;function r(l){let c=gg.newName();return(i||(i=Object.create(null)))["."+c]=l,c}const s=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof qc?l=>l.prop(_m)==o.data:o?l=>l==o:void 0,this.style=t3e(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new gg(i):null,this.themeType=n.themeType}static define(t,n){return new aT(t,n||{})}}const hB=an.define(),h3e=an.define({combine(e){return e.length?[e[0]]:null}});function lj(e){let t=e.facet(hB);return t.length?t:e.facet(h3e)}function p3e(e,t){let n=[M6t],i;return e instanceof aT&&(e.module&&n.push(Xt.styleModule.of(e.module)),i=e.themeType),t!=null&&t.fallback?n.push(h3e.of(e)):i?n.push(hB.computeN([Xt.darkTheme],r=>r.facet(Xt.darkTheme)==(i=="dark")?[e]:[])):n.push(hB.of(e)),n}function Ban(e,t,n){let i=lj(e),r=null;if(i){for(let s of i)if(!s.scope||n){let o=s.style(t);o&&(r=r?r+" "+o:o)}}return r}class D6t{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,lj(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Lr(t.state),i=lj(t.state),r=i!=lj(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=s.to)}buildDeco(t,n){if(!n||!this.tree.length)return Cn.none;let i=new pp;for(let{from:r,to:s}of t.visibleRanges)a6t(this.tree,n,(o,l,c)=>{i.add(o,l,this.markCache[c]||(this.markCache[c]=Cn.mark({class:c})))},r,s);return i.finish()}}const M6t=Ap.high(Zs.fromClass(D6t,{decorations:e=>e.decorations})),L6t=aT.define([{tag:oe.meta,color:"#404740"},{tag:oe.link,textDecoration:"underline"},{tag:oe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:oe.emphasis,fontStyle:"italic"},{tag:oe.strong,fontWeight:"bold"},{tag:oe.strikethrough,textDecoration:"line-through"},{tag:oe.keyword,color:"#708"},{tag:[oe.atom,oe.bool,oe.url,oe.contentSeparator,oe.labelName],color:"#219"},{tag:[oe.literal,oe.inserted],color:"#164"},{tag:[oe.string,oe.deleted],color:"#a11"},{tag:[oe.regexp,oe.escape,oe.special(oe.string)],color:"#e40"},{tag:oe.definition(oe.variableName),color:"#00f"},{tag:oe.local(oe.variableName),color:"#30a"},{tag:[oe.typeName,oe.namespace],color:"#085"},{tag:oe.className,color:"#167"},{tag:[oe.special(oe.variableName),oe.macroName],color:"#256"},{tag:oe.definition(oe.propertyName),color:"#00c"},{tag:oe.comment,color:"#940"},{tag:oe.invalid,color:"#f00"}]),$6t=Xt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),m3e=1e4,g3e="()[]{}",b3e=an.define({combine(e){return Wf(e,{afterCursor:!0,brackets:g3e,maxScanDistance:m3e,renderMatch:U6t})}}),F6t=Cn.mark({class:"cm-matchingBracket"}),B6t=Cn.mark({class:"cm-nonmatchingBracket"});function U6t(e){let t=[],n=e.matched?F6t:B6t;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function wie(e){let t=[],n=e.facet(b3e);for(let i of e.selection.ranges){if(!i.empty)continue;let r=kf(e,i.head,-1,n)||i.head>0&&kf(e,i.head-1,1,n)||n.afterCursor&&(kf(e,i.head,1,n)||i.heade.decorations}),z6t=[Q6t,$6t];function V6t(e={}){return[b3e.of(e),z6t]}const y3e=new Kn;function pB(e,t,n){let i=e.prop(t<0?Kn.openedBy:Kn.closedBy);if(i)return i;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function mB(e){let t=e.type.prop(y3e);return t?t(e.node):e}function kf(e,t,n,i={}){let r=i.maxScanDistance||m3e,s=i.brackets||g3e,o=Lr(e),l=o.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=pB(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return H6t(e,t,n,c,d,u,s)}}return q6t(e,t,n,o,l.type,r,s)}function H6t(e,t,n,i,r,s,o){let l=i.parent,c={from:r.from,to:r.to},u=0,d=l==null?void 0:l.cursor();if(d&&(n<0?d.childBefore(i.from):d.childAfter(i.to)))do if(n<0?d.to<=i.from:d.from>=i.to){if(u==0&&s.indexOf(d.type.name)>-1&&d.from0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let h=0;!d.next().done&&h<=s;){let m=d.value;n<0&&(h+=m.length);let g=t+h*n;for(let b=n>0?0:m.length-1,v=n>0?m.length:-1;b!=v;b+=n){let y=o.indexOf(m[b]);if(!(y<0||i.resolveInner(g+b,1).type!=r))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:y>>1==c>>1};f--}}n>0&&(h+=m.length)}return d.done?{start:u,matched:!1}:null}function Oie(e,t,n,i=0,r=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=r;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?o.toLowerCase():o,s=this.string.substr(this.pos,t.length);return r(s)==r(t)?(n!==!1&&(this.pos+=t.length),!0):null}else{let r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&n!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}function W6t(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||K6t,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||nH,mergeTokens:e.mergeTokens!==!1}}function K6t(e){if(typeof e!="object")return e;let t={};for(let n in e){let i=e[n];t[n]=i instanceof Array?i.slice():i}return t}const kie=new WeakMap;class eH extends qc{constructor(t){let n=vD(t.languageData),i=W6t(t),r,s=new class extends dD{createParse(o,l,c){return new X6t(r,o,l,c)}};super(n,s,[],t.name),this.topNode=J6t(n,this),r=this,this.streamParser=i,this.stateAfter=new Kn({perNode:!0}),this.tokenTable=t.tokenTable?new k3e(i.tokenTable):Z6t}static define(t){return new eH(t)}getIndent(t){let n,{overrideIndentation:i}=t.options;i&&(n=kie.get(t.state),n!=null&&n1e4)return null;for(;s=i&&n+t.length<=r&&t.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let l=t.children[o],c=n+t.positions[o],u=l instanceof Ci&&c=t.length)return t;!r&&n==0&&t.type==e.topNode&&(r=!0);for(let s=t.children.length-1;s>=0;s--){let o=t.positions[s],l=t.children[s],c;if(on&&tH(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=i&&(u=x3e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(r?jy(r):4),tree:Ci.empty}}let X6t=class{constructor(t,n,i,r){this.lang=t,this.input=n,this.fragments=i,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let s=_y.get(),o=r[0].from,{state:l,tree:c}=G6t(t,i,o,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=o+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(jy(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=_y.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(n,this.chunkStart+512);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos=n?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let n=this.input.chunk(t);if(this.input.lineChunks)n==` +`){[t,n]=pw(this,t,n);let r="";for(let s=0,o=0;st&&s&&(r+=i),to&&(r+=l.sliceString(t-o,n-o,i)),o=c+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof ff))return 0;let i=0,[r,s,o,l]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,s+=n){if(r==o||s==l)return i;let c=this.children[r],u=t.children[s];if(c!=u)return i+c.scanIdentical(u,n);i+=c.length+1}}static from(t,n=t.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let m of t)i+=m.lines;if(i<32){let m=[];for(let g of t)g.flatten(m);return new ao(m,n)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],c=0,u=-1,d=[];function f(m){let g;if(m.lines>s&&m instanceof ff)for(let b of m.children)f(b);else m.lines>o&&(c>o||!c)?(h(),l.push(m)):m instanceof ao&&c&&(g=d[d.length-1])instanceof ao&&m.lines+g.lines<=32?(c+=m.lines,u+=m.length+1,d[d.length-1]=new ao(g.text.concat(m.text),g.length+1+m.length)):(c+m.lines>r&&h(),c+=m.lines,u+=m.length+1,d.push(m))}function h(){c!=0&&(l.push(d.length==1?d[0]:ff.from(d,u)),u=-1,c=d.length=0)}for(let m of t)f(m);return h(),l.length==1?l[0]:new ff(l,n)}}sr.empty=new ao([""],0);function X5t(e){let t=-1;for(let n of e)t+=n.length+1;return t}function nj(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s=n&&(c>i&&(l=l.slice(0,i-r)),r0?1:(t instanceof ao?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof ao?r.text.length:r.children.length;if(o==(n>0?l:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[i]+=n,t==0)return this.lineBreak=!0,this.value=` +`,this;t--}else if(r instanceof ao){let c=r.text[o+(n<0?-1:0)];if(this.offsets[i]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=r.children[o+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof ao?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class ILe{constructor(t,n,i){this.value="",this.done=!1,this.cursor=new Jk(t,n>i?-1:1),this.pos=n>i?t.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class PLe{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:i,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(sr.prototype[Symbol.iterator]=function(){return this.iter()},Jk.prototype[Symbol.iterator]=ILe.prototype[Symbol.iterator]=PLe.prototype[Symbol.iterator]=function(){return this});let Y5t=class{constructor(t,n,i,r){this.from=t,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}};function pw(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ba(e,t,n=!0,i=!0){return K5t(e,t,n,i)}function Z5t(e){return e>=56320&&e<57344}function J5t(e){return e>=55296&&e<56320}function Zl(e,t){let n=e.charCodeAt(t);if(!J5t(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return Z5t(i)?(n-55296<<10)+(i-56320)+65536:n}function RV(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function hf(e){return e<65536?1:2}const R8=/\r\n?|\n/;var Pa=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Pa||(Pa={}));class Nf{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-r);s+=l}else{if(i!=Pa.Simple&&u>=t&&(i==Pa.TrackDel&&rt||i==Pa.TrackBefore&&rt))return null;if(u>t||u==t&&n<0&&!l)return t==r||n<0?s:s+c;s+=c}r=u}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return s}touchesRange(t,n=t){for(let i=0,r=0;i=0&&r<=n&&l>=t)return rn?"cover":!0;r=l}return!1}toString(){let t="";for(let n=0;n=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Nf(t)}static create(t){return new Nf(t)}}class Go extends Nf{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return I8(this,(n,i,r,s,o)=>t=t.replace(r,r+(i-n),o),!1),t}mapDesc(t,n=!1){return P8(this,t,n,!0)}invert(t){let n=this.sections.slice(),i=[];for(let r=0,s=0;r=0){n[r]=l,n[r+1]=o;let c=r>>1;for(;i.length0&&Am(i,n,s.text),s.forward(d),l+=d}let u=t[o++];for(;l>1].toJSON()))}return t}static of(t,n,i){let r=[],s=[],o=0,l=null;function c(d=!1){if(!d&&!r.length)return;oh||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let g=m?typeof m=="string"?sr.of(m.split(i||R8)):m:sr.empty,b=g.length;if(f==h&&b==0)return;fo&&tl(r,f-o,-1),tl(r,h-f,b),Am(s,r,g),o=h}}return u(t),c(!l),l}static empty(t){return new Go(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;i.length=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Am(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],c=e.sections[o++];t(r,u,s,d,f),r=u,s=d}}}function P8(e,t,n,i=!1){let r=[],s=i?[]:null,o=new bE(e),l=new bE(t);for(let c=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);tl(r,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(l.len=0&&c=0){let u=0,d=o.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.lenc||o.ins>=0&&o.len>c)&&(l||i.length>u),s.forward2(c),o.forward(c)}}}}class bE{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?sr.empty:t[n]}textBit(t){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!t?sr.empty:n[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class gm{constructor(t,n,i,r){this.from=t,this.to=n,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}map(t,n=-1){let i,r;return this.empty?i=r=t.mapPos(this.from,n):(i=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new gm(i,r,this.flags,this.goalColumn)}extend(t,n=t,i=0){if(t<=this.anchor&&n>=this.anchor)return ut.range(t,n,void 0,void 0,i);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ut.range(this.anchor,r,void 0,void 0,i)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ut.range(t.anchor,t.head)}static create(t,n,i,r){return new gm(t,n,i,r)}}class ut{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ut.create(this.ranges.map(i=>i.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;it.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ut(t.ranges.map(n=>gm.fromJSON(n)),t.main)}static single(t,n=t){return new ut([ut.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;rr.from-s.from),n=t.indexOf(i);for(let r=1;rs.head?ut.range(c,l):ut.range(l,c))}}return new ut(t,n)}}function MLe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let IV=0;class an{constructor(t,n,i,r,s){this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=IV++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new an(t.combine||(n=>n),t.compareInput||((n,i)=>n===i),t.compare||(t.combine?(n,i)=>n===i:PV),!!t.static,t.enables)}of(t){return new ij([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ij(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ij(t,this,2,n)}from(t,n){return n||(n=i=>i),this.compute([t],i=>n(i.field(t)))}}function PV(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class ij{constructor(t,n,i,r){this.dependencies=t,this.facet=n,this.type=i,this.value=r,this.id=IV++}dynamicSlot(t){var n;let i=this.value,r=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,c=!1,u=!1,d=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,h){if(c&&h.docChanged||u&&(h.docChanged||h.selection)||D8(f,d)){let m=i(f);if(l?!vne(m,f.values[o],r):!r(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,h)=>{let m,g=h.config.address[s];if(g!=null){let b=rR(h,g);if(this.dependencies.every(v=>v instanceof an?h.facet(v)===f.facet(v):v instanceof Qa?h.field(v,!1)==f.field(v,!1):!0)||(l?vne(m=i(f),b,r):r(m=i(f),b)))return f.values[o]=b,0}else m=i(f);return f.values[o]=m,1}}}get extension(){return this}}function vne(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[c.id]),r=n.map(c=>c.type),s=i.filter(c=>!(c&1)),o=e[t.id]>>1;function l(c){let u=[];for(let d=0;di===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(d2).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let s=i.values[n],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[n]=o,1)},reconfigure:(i,r)=>{let s=i.facet(d2),o=r.facet(d2),l;return(l=s.find(c=>c.field==this))&&l!=o.find(c=>c.field==this)?(i.values[n]=l.create(i),1):r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}}init(t){return[this,d2.of({field:this,create:t})]}get extension(){return this}}const Sb={lowest:4,low:3,default:2,high:1,highest:0};function hO(e){return t=>new LLe(t,e)}const Ap={highest:hO(Sb.highest),high:hO(Sb.high),default:hO(Sb.default),low:hO(Sb.low),lowest:hO(Sb.lowest)};class LLe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class fD{of(t){return new M8(this,t)}reconfigure(t){return fD.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class M8{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class iR{constructor(t,n,i,r,s,o){for(this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,i){let r=[],s=Object.create(null),o=new Map;for(let h of t3t(t,n,o))h instanceof Qa?r.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),c=[],u=[];for(let h of r)l[h.id]=u.length<<1,u.push(m=>h.slot(m));let d=i==null?void 0:i.config.facets;for(let h in s){let m=s[h],g=m[0].facet,b=d&&d[h]||[];if(m.every(v=>v.type==0))if(l[g.id]=c.length<<1|1,PV(b,m))c.push(i.facet(g));else{let v=g.combine(m.map(y=>y.value));c.push(i&&g.compare(v,i.facet(g))?i.facet(g):v)}else{for(let v of m)v.type==0?(l[v.id]=c.length<<1|1,c.push(v.value)):(l[v.id]=u.length<<1,u.push(y=>v.dynamicSlot(y)));l[g.id]=u.length<<1,u.push(v=>e3t(v,g,m))}}let f=u.map(h=>h(l));return new iR(t,o,f,l,c,s)}}function t3t(e,t,n){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let c=r.get(o);if(c!=null){if(c<=l)return;let u=i[c].indexOf(o);u>-1&&i[c].splice(u,1),o instanceof M8&&n.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof M8){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof LLe)s(o.inner,o.prec);else if(o instanceof Qa)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof ij)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Sb.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(e,Sb.default),i.reduce((o,l)=>o.concat(l))}function eS(e,t){if(t&1)return 2;let n=t>>1,i=e.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function rR(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const $Le=an.define(),L8=an.define({combine:e=>e.some(t=>t),static:!0}),FLe=an.define({combine:e=>e.length?e[0]:void 0,static:!0}),BLe=an.define(),ULe=an.define(),QLe=an.define(),zLe=an.define({combine:e=>e.length?e[0]:!1});class qf{constructor(t,n){this.type=t,this.value=n}static define(){return new n3t}}class n3t{of(t){return new qf(this,t)}}class i3t{constructor(t){this.map=t}of(t){return new Gn(this,t)}}class Gn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new Gn(this.type,n)}is(t){return this.type==t}static define(t={}){return new i3t(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let i=[];for(let r of t){let s=r.map(n);s&&i.push(s)}return i}}Gn.reconfigure=Gn.define();Gn.appendConfig=Gn.define();class Ro{constructor(t,n,i,r,s,o){this.startState=t,this.changes=n,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&MLe(i,n.newLength),s.some(l=>l.type==Ro.time)||(this.annotations=s.concat(Ro.time.of(Date.now())))}static create(t,n,i,r,s,o){return new Ro(t,n,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Ro.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Ro.time=qf.define();Ro.userEvent=qf.define();Ro.addToHistory=qf.define();Ro.remote=qf.define();function r3t(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i=e[i]))s=e[i++],o=e[i++];else if(r=0;r--){let s=i[r](e);s instanceof Ro?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ro?e=s[0]:e=HLe(t,px(s),!1)}return e}function o3t(e){let t=e.startState,n=t.facet(QLe),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=VLe(i,$8(t,s,e.changes.newLength),!0))}return i==e?e:Ro.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}const a3t=[];function px(e){return e==null?a3t:Array.isArray(e)?e:[e]}var Ts=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Ts||(Ts={}));const l3t=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let F8;try{F8=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function c3t(e){if(F8)return F8.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||l3t.test(n)))return!0}return!1}function u3t(e){return t=>{if(!/\S/.test(t))return Ts.Space;if(c3t(t))return Ts.Word;for(let n=0;n-1)return Ts.Word;return Ts.Other}}class Ui{constructor(t,n,i,r,s,o){this.config=t,this.doc=n,this.selection=i,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(u,c)),n=null),r.set(l.value.compartment,l.value.extension)):l.is(Gn.reconfigure)?(n=null,i=l.value):l.is(Gn.appendConfig)&&(n=null,i=px(i).concat(l.value));let s;n?s=t.startState.values.slice():(n=iR.resolve(i,r,this),s=new Ui(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let o=t.startState.facet(L8)?t.newSelection:t.newSelection.asSingle();new Ui(n,t.newDoc,o,s,(l,c)=>c.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:ut.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,i=t(n.ranges[0]),r=this.changes(i.changes),s=[i.range],o=px(i.effects);for(let l=1;lo.spec.fromJSON(l,c)))}}return Ui.create({doc:t.doc,selection:ut.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=iR.resolve(t.extensions||[],new Map),i=t.doc instanceof sr?t.doc:sr.of((t.doc||"").split(n.staticFacet(Ui.lineSeparator)||R8)),r=t.selection?t.selection instanceof ut?t.selection:ut.single(t.selection.anchor,t.selection.head):ut.single(0);return MLe(r,i.length),n.staticFacet(L8)||(r=r.asSingle()),new Ui(n,i,r,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ui.tabSize)}get lineBreak(){return this.facet(Ui.lineSeparator)||` +`}get readOnly(){return this.facet(zLe)}phrase(t,...n){for(let i of this.facet(Ui.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>n.length?i:n[s-1]})),t}languageDataAt(t,n,i=-1){let r=[];for(let s of this.facet($Le))for(let o of s(this,n,i))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return u3t(n.length?n[0]:"")}wordAt(t){let{text:n,from:i,length:r}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let c=ba(n,o,!1);if(s(n.slice(c,o))!=Ts.Word)break;o=c}for(;le.length?e[0]:4});Ui.lineSeparator=FLe;Ui.readOnly=zLe;Ui.phrases=an.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(r=>e[r]==t[r])}});Ui.languageData=$Le;Ui.changeFilter=BLe;Ui.transactionFilter=ULe;Ui.transactionExtender=QLe;fD.reconfigure=Gn.define();function Wf(e,t,n={}){let i={};for(let r of e)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))i[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in t)i[r]===void 0&&(i[r]=t[r]);return i}class mg{eq(t){return this==t}range(t,n=t){return yE.create(t,n,this)}}mg.prototype.startSide=mg.prototype.endSide=0;mg.prototype.point=!1;mg.prototype.mapMode=Pa.TrackDel;function DV(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class yE{constructor(t,n,i){this.from=t,this.to=n,this.value=i}static create(t,n,i){return new yE(t,n,i)}}function B8(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class MV{constructor(t,n,i,r){this.from=t,this.to=n,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let c=o+l>>1,u=s[c]-t||(i?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:l;u>=0?l=c:o=c+1}}between(t,n,i,r){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(i,1e9,!1,s);sm||h==m&&u.startSide>0&&u.endSide<=0)continue;(m-h||u.endSide-u.startSide)<0||(o<0&&(o=h),u.point&&(l=Math.max(l,m-h)),i.push(u),r.push(h-o),s.push(m-o))}return{mapped:i.length?new MV(r,s,i,l):null,pos:o}}}class Di{constructor(t,n,i,r){this.chunkPos=t,this.chunk=n,this.nextLayer=i,this.maxPoint=r}static create(t,n,i,r){return new Di(t,n,i,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(i&&(n=n.slice().sort(B8)),this.isEmpty)return n.length?Di.of(n):this;let l=new qLe(this,null,-1).goto(0),c=0,u=[],d=new pp;for(;l.value||c=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,n-s,i)===!1)return}this.nextLayer.between(t,n,i)}}iter(t=0){return vE.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return vE.from(t).goto(n)}static compare(t,n,i,r,s=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),c=xne(o,l,i),u=new pO(o,c,s),d=new pO(l,c,s);i.iterGaps((f,h,m)=>wne(u,f,d,h,m,r)),i.empty&&i.length==0&&wne(u,0,d,0,0,r)}static eq(t,n,i=0,r){r==null&&(r=999999999);let s=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=xne(s,o),c=new pO(s,l,0).goto(i),u=new pO(o,l,0).goto(i);for(;;){if(c.to!=u.to||!U8(c.active,u.active)||c.point&&(!u.point||!DV(c.point,u.point)))return!1;if(c.to>r)return!0;c.next(),u.next()}}static spans(t,n,i,r,s=-1){let o=new pO(t,null,s).goto(n),l=n,c=o.openStart;for(;;){let u=Math.min(o.to,i);if(o.point){let d=o.activeForPoint(o.to),f=o.pointFroml&&(r.span(l,u,o.active,c),c=o.openEnd(u));if(o.to>i)return c+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,n=!1){let i=new pp;for(let r of t instanceof yE?[t]:n?d3t(t):t)i.add(r.from,r.to,r.value);return i.finish()}static join(t){if(!t.length)return Di.empty;let n=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let r=t[i];r!=Di.empty;r=r.nextLayer)n=new Di(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}Di.empty=new Di([],[],null,-1);function d3t(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(B8);t=i}return e}Di.empty.nextLayer=Di.empty;class pp{finishChunk(t){this.chunks.push(new MV(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,i){this.addInner(t,n,i)||(this.nextLayer||(this.nextLayer=new pp)).add(t,n,i)}addInner(t,n,i){let r=t-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+t,this.lastTo=n.to[i]+t,!0}finish(){return this.finishInner(Di.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Di.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function xne(e,t,n){let i=new Map;for(let s of e)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&r.push(new qLe(o,n,i,s));return r.length==1?r[0]:new vE(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let i of this.heap)i.goto(t,n);for(let i=this.heap.length>>1;i>=0;i--)l3(this.heap,i);return this.next(),this}forward(t,n){for(let i of this.heap)i.forward(t,n);for(let i=this.heap.length>>1;i>=0;i--)l3(this.heap,i);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),l3(this.heap,0)}}}function l3(e,t){for(let n=e[t];;){let i=(t<<1)+1;if(i>=e.length)break;let r=e[i];if(i+1=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class pO{constructor(t,n,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=vE.from(t,n,i)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){f2(this.active,t),f2(this.activeTo,t),f2(this.activeRank,t),this.minActive=One(this.active,this.activeTo)}addActive(t){let n=0,{value:i,to:r,rank:s}=this.cursor;for(;n0;)n++;h2(this.active,n,i),h2(this.activeTo,n,r),h2(this.activeRank,n,s),t&&h2(t,n,this.cursor.from),this.minActive=One(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&f2(i,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&i[r]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(t){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)n++;return n}}function wne(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,l=i,c=i-t,u=!!s.boundChange;for(let d=!1;;){let f=e.to+c-n.to,h=f||e.endSide-n.endSide,m=h<0?e.to+c:n.to,g=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&DV(e.point,n.point)&&U8(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,g,e.point,n.point),d=!1):(d&&s.boundChange(l),g>l&&!U8(e.active,n.active)&&s.compareRange(l,g,e.active,n.active),u&&go)break;l=m,h<=0&&e.next(),h>=0&&n.next()}}function U8(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;i--)e[i+1]=e[i];e[t]=n}function One(e,t){let n=-1,i=1e9;for(let r=0;r=t)return r;if(r==e.length)break;s+=e.charCodeAt(r)==9?n-s%n:1,r=ba(e,r)}return i===!0?-1:e.length}const z8="ͼ",kne=typeof Symbol>"u"?"__"+z8:Symbol.for(z8),V8=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Sne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class gg{constructor(t,n){this.rules=[];let{finish:i}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,c,u){let d=[],f=/^@(\w+)\b/.exec(o[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return c.push(o[0]+";");for(let m in l){let g=l[m];if(/&/.test(m))s(m.split(/,\s*/).map(b=>o.map(v=>b.replace(/&/,v))).reduce((b,v)=>b.concat(v)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(r(m),g,d,h)}else g!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||h)&&c.push((i&&!f&&!u?o.map(i):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)s(r(o),t[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let t=Sne[kne]||1;return Sne[kne]=t+1,z8+t.toString(36)}static mount(t,n,i){let r=t[V8],s=i&&i.nonce;r?s&&r.setNonce(s):r=new f3t(t,s),r.mount(Array.isArray(n)?n:[n],t)}}let Ene=new Map;class f3t{constructor(t,n){let i=t.ownerDocument||t,r=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let s=Ene.get(i);if(s)return t[V8]=s;this.sheet=new r.CSSStyleSheet,Ene.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[V8]=this}mount(t,n){let i=this.sheet,r=0,s=0;for(let o=0;o-1&&(this.modules.splice(c,1),s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),i)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},h3t=typeof navigator<"u"&&/Mac/.test(navigator.platform),p3t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Na=0;Na<10;Na++)bg[48+Na]=bg[96+Na]=String(Na);for(var Na=1;Na<=24;Na++)bg[Na+111]="F"+Na;for(var Na=65;Na<=90;Na++)bg[Na]=String.fromCharCode(Na+32),xE[Na]=String.fromCharCode(Na);for(var c3 in bg)xE.hasOwnProperty(c3)||(xE[c3]=bg[c3]);function m3t(e){var t=h3t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||p3t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?xE:bg)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Ir(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];typeof r=="string"?e.setAttribute(i,r):r!=null&&(e[i]=r)}t++}for(;t2);var sn={mac:Ane||/Mac/.test(wl.platform),windows:/Win/.test(wl.platform),linux:/Linux|X11/.test(wl.platform),ie:hD,ie_version:KLe?H8.documentMode||6:W8?+W8[1]:q8?+q8[1]:0,gecko:Cne,gecko_version:Cne?+(/Firefox\/(\d+)/.exec(wl.userAgent)||[0,0])[1]:0,chrome:!!u3,chrome_version:u3?+u3[1]:0,ios:Ane,android:/Android\b/.test(wl.userAgent),webkit:Tne,webkit_version:Tne?+(/\bAppleWebKit\/(\d+)/.exec(wl.userAgent)||[0,0])[1]:0,safari:K8,safari_version:K8?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wl.userAgent)||[0,0])[1]:0,tabSize:H8.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function LV(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const sR=Object.create(null);function $V(e,t,n){if(e==t)return!0;e||(e=sR),t||(t=sR);let i=Object.keys(e),r=Object.keys(t);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=n&&(r.indexOf(s)==-1||e[s]!==t[s]))return!1;return!0}function g3t(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;t[i]==null&&e.removeAttribute(i)}for(let n in t){let i=t[n];n=="style"?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}function _ne(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function b3t(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Cy(t,n,n,i,t.widget||null,!1)}static replace(t){let n=!!t.block,i,r;if(t.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=GLe(t,n);i=(s?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Cy(t,i,r,n,t.widget||null,!0)}static line(t){return new iT(t)}static set(t,n=!1){return Di.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Cn.none=Di.empty;class nT extends Cn{constructor(t){let{start:n,end:i}=GLe(t);super(n?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?LV(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||sR}eq(t){return this==t||t instanceof nT&&this.tagName==t.tagName&&$V(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}nT.prototype.point=!1;class iT extends Cn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof iT&&this.spec.class==t.spec.class&&$V(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}iT.prototype.mapMode=Pa.TrackBefore;iT.prototype.point=!0;class Cy extends Cn{constructor(t,n,i,r,s,o){super(n,i,s,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?Pa.TrackBefore:Pa.TrackAfter:Pa.TrackDel}get type(){return this.startSide!=this.endSide?La.WidgetRange:this.startSide<=0?La.WidgetBefore:La.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Cy&&y3t(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Cy.prototype.point=!0;function GLe(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return n==null&&(n=e.inclusive),i==null&&(i=e.inclusive),{start:n??t,end:i??t}}function y3t(e,t){return e==t||!!(e&&t&&e.compare(t))}function mx(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class wE extends mg{constructor(t,n,i){super(),this.tagName=t,this.attributes=n,this.rank=i}eq(t){return t==this||t instanceof wE&&this.tagName==t.tagName&&$V(this.attributes,t.attributes)}static create(t){return new wE(t.tagName,t.attributes||sR,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Di.of(t,n)}}wE.prototype.startSide=wE.prototype.endSide=-1;function OE(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function G8(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function tS(e,t){if(!t.anchorNode)return!1;try{return G8(e,t.anchorNode)}catch{return!1}}function nS(e){return e.nodeType==3?SE(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function iS(e,t,n,i){return n?jne(e,t,n,i,-1)||jne(e,t,n,i,1):!1}function yg(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function oR(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function jne(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:mp(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=yg(e)+(r<0?0:1),e=s}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?mp(e):0}else return!1}}function mp(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function kE(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function v3t(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function XLe(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function x3t(e,t,n,i,r,s,o,l){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let h,m=d==c.body,g=1,b=1;if(m)h=v3t(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let x=d.getBoundingClientRect();({scaleX:g,scaleY:b}=XLe(d,x)),h={left:x.left,right:x.left+d.clientWidth*g,top:x.top,bottom:x.top+d.clientHeight*b}}let v=0,y=0;if(r=="nearest")t.top0&&t.bottom>h.bottom+y&&(y=t.bottom-h.bottom+o)):t.bottom>h.bottom-o&&(y=t.bottom-h.bottom+o,n<0&&t.top-y0&&t.right>h.right+v&&(v=t.right-h.right+s)):t.right>h.right-s&&(v=t.right-h.right+s,n<0&&t.lefth.bottom||t.lefth.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function YLe(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let s=e.parentNode;s&&!(s==n.body||(!t||i)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),t&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}class w3t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:i}=t;this.set(n,Math.min(t.anchorOffset,n?mp(n):0),i,Math.min(t.focusOffset,i?mp(i):0))}set(t,n,i,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=i,this.focusOffset=r}}let xb=null;sn.safari&&sn.safari_version>=26&&(xb=!1);function ZLe(e){if(e.setActive)return e.setActive();if(xb)return e.focus(xb);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(xb==null?{get preventScroll(){return xb={preventScroll:!0},!0}}:void 0),!xb){xb=!1;for(let n=0;nMath.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function e5e(e,t){for(let n=e,i=t;;){if(n.nodeType==3&&i>0)return{node:n,offset:i};if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=mp(n)}else if(n.parentNode&&!oR(n))i=yg(n),n=n.parentNode;else return null}}function t5e(e,t){for(let n=e,i=t;;){if(n.nodeType==3&&i=n){if(l.level==i)return o;(s<0||(r!=0?r<0?l.fromn:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function r5e(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;b-=3)if(Jd[b+1]==-m){let v=Jd[b+2],y=v&2?r:v&4?v&1?s:r:0;y&&(Ur[f]=Ur[Jd[b]]=y),l=b;break}}else{if(Jd.length==189)break;Jd[l++]=f,Jd[l++]=h,Jd[l++]=c}else if((g=Ur[f])==2||g==1){let b=g==r;c=b?0:1;for(let v=l-3;v>=0;v-=3){let y=Jd[v+2];if(y&2)break;if(b)Jd[v+2]|=2;else{if(y&4)break;Jd[v+2]|=4}}}}}function _3t(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,l=rc;)g==v&&(g=n[--b].from,v=b?n[b-1].to:e),Ur[--g]=m;c=d}else s=u,c++}}}function Y8(e,t,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let c=t,u=0;cc&&o.push(new Of(c,b.from,m));let v=b.direction==Ty!=!(m%2);Z8(e,v?i+1:i,r,b.inner,b.from,b.to,o),c=b.to}g=b.to}else{if(g==n||(d?Ur[g]!=l:Ur[g]==l))break;g++}h?Y8(e,c,g,i+1,r,h,o):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let b=Ur[c-1];b!=l&&(d=!1,f=b==16)}let h=!d&&l==1?[]:null,m=d?i:i+1,g=c;e:for(;;)if(u&&g==s[u-1].to){if(f)break e;let b=s[--u];if(!d)for(let v=b.from,y=u;;){if(v==t)break e;if(y&&s[y-1].to==v)v=s[--y].from;else{if(Ur[v-1]==l)break e;break}}if(h)h.push(b);else{b.toUr.length;)Ur[Ur.length]=256;let i=[],r=t==Ty?0:1;return Z8(e,r,r,n,0,e.length,i),i}function s5e(e){return[new Of(0,e,0)]}let o5e="";function N3t(e,t,n,i,r){var s;let o=i.head-e.from,l=Of.find(t,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),c=t[l],u=c.side(r,n);if(o==u){let h=l+=r?1:-1;if(h<0||h>=t.length)return null;c=t[l=h],o=c.side(!r,n),u=c.side(r,n)}let d=ba(e.text,o,c.forward(r,n));(dc.to)&&(d=u),o5e=e.text.slice(Math.min(o,d),Math.max(o,d));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return f&&d==u&&f.level+(r?0:1)e.some(t=>t)}),p5e=an.define({combine:e=>e.some(t=>t)}),m5e=an.define();class bx{constructor(t,n,i,r,s,o=!1){this.range=t,this.y=n,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new bx(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new bx(ut.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const p2=Gn.define({map:(e,t)=>e.map(t)}),g5e=Gn.define();function sc(e,t,n){let i=e.facet(u5e);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Rh=an.define({combine:e=>e.length?e[0]:!0});let I3t=0;const Fv=an.define({combine(e){return e.filter((t,n)=>{for(let i=0;i{let c=[];return o&&c.push(pD.of(u=>{let d=u.plugin(l);return d?o(d):Cn.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return Zs.define((i,r)=>new t(i,r),n)}}class d3{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(sc(n.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){sc(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){sc(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const b5e=an.define(),QV=an.define(),pD=an.define(),y5e=an.define(),zV=an.define(),rT=an.define(),v5e=an.define();function Rne(e,t){let n=e.state.facet(v5e);if(!n.length)return n;let i=n.map(s=>s instanceof Function?s(e):s),r=[];return Di.spans(i,t.from,t.to,{point(){},span(s,o,l,c){let u=s-t.from,d=o-t.from,f=r;for(let h=l.length-1;h>=0;h--,c--){let m=l[h].spec.bidiIsolate,g;if(m==null&&(m=R3t(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==m)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:m,inner:[]};f.push(b),f=b.inner}}}}),r}const x5e=an.define();function VV(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(x5e)){let o=s(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const nk=an.define();class Mu{constructor(t,n,i,r){this.fromA=t,this.toA=n,this.fromB=i,this.toB=r}join(t){return new Mu(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,i=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>i.toA)){if(r.toAr.push(new Mu(s,o,l,c))),this.changedRanges=r}static create(t,n,i){return new aR(t,n,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const P3t=[];class Ys{constructor(t,n,i=0){this.dom=t,this.length=n,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return P3t}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&g3t(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let i=n;for(let r of this.children){if(r==t)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n,i){return null}domPosFor(t,n){let i=yg(this.dom),r=this.length?t>0:n>0;return new Sd(this.parent.dom,i+(r?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof gD)return t;return null}static get(t){return t.cmTile}}class mD extends Ys{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,i=null,r,s=(t==null?void 0:t.node)==n?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,r=i?i.nextSibling:n.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;r&&r!=l.dom;)r=Ine(r);else n.insertBefore(l.dom,r);i=l.dom}for(r=i?i.nextSibling:n.firstChild,s&&r&&(s.written=!0);r;)r=Ine(r);this.length=o}}function Ine(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class gD extends mD{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=Ys.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!n.length)return;i=i.parent,i.breakAfter&&s++,r=n.pop()}else{let o=i.children[r++];if(o instanceof ep)n.push(r),i=o,r=0;else{let l=s+o.length,c=t(o,s);if(c!==void 0)return c;s=l+o.breakAfter}}}resolveBlock(t,n){let i,r=-1,s,o=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ct||t==c&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=t-c)}}),!i&&!s)throw new Error("No tile at position "+t);return i&&n<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}}class ep extends mD{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let i=new ep(n||document.createElement(t.tagName),t);return n||(i.flags|=4),i}}class mw extends mD{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,i){let r=new mw(n||document.createElement("div"),t);return(!n||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,i){let r=null,s=-1,o=null,l=-1;function c(d,f){for(let h=0,m=0;h=f&&(g.isComposite()?c(g,f-m):(!o||o.isHidden&&(n>0&&!(o.flags&32)||i&&M3t(o,g)))&&(b>f||g.flags&32)?(o=g,l=f-m):(mr&&(t=r);let s=t,o=t,l=0;t==0&&n<0||t==r&&n>=0?sn.chrome||sn.gecko||(t?(s--,l=1):o=0)?0:c.length-1];return sn.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),i==null?u:kE(u,(l?l>0:n<0)==i)}static of(t,n){let i=new $b(n||document.createTextNode(t),t);return n||(i.flags|=2),i}}class Ay extends Ys{constructor(t,n,i,r){super(t,n,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,i){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(i)return kE(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?s.length-1:0;o=s[c],!(t>0?c==0:c==s.length-1||o.top0==i)}}class L3t{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,i){let{tile:r,index:s,beforeBreak:o,parents:l}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(s==r.children.length){if(!t&&!l.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let c=r.children[s],u=c.breakAfter;(n>0?c.length<=t:c.length=0;l--){let c=n.marks[l],u=r.lastChild;if(u instanceof tc&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(f3(c.dom)),r=u;else{if(this.cache.reused.get(c)){let f=Ys.get(c.dom);f&&f.setDOM(f3(c.dom))}let d=tc.of(c.mark,c.dom);r.append(d),r=d}this.cache.reused.set(c,2)}let s=Ys.get(t.text);s&&this.cache.reused.set(s,2);let o=new $b(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,i){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let s=this.ensureMarks(n,i);!r&&!(t.flags&16)&&s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,i){this.flushBuffer(),this.ensureMarks(n,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var i;t||(t=w5e);let r=mw.start(t,n||((i=this.cache.find(mw))===null||i===void 0?void 0:i.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var i;let r=this.curLine;for(let s=t.length-1;s>=0;s--){let o=t[s],l;if(n>0&&(l=r.lastChild)&&l instanceof tc&&l.mark.eq(o))r=l,n--;else{let c=tc.of(o,(i=this.cache.find(tc,u=>u.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(c),r=c,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!Pne(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(sn.ios&&Pne(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(h3,0,32)||new Ay(h3.toDOM(),0,h3,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to=this.pos){let n=t.rank*102+t.value.rank,i=new $3t(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let i of this.wrappers){let r=n.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);n.append(s),n=s}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),i=this.cache.find(lR,void 0,1);return i&&(i.flags=n),i||new lR(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class B3t{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let l=this.textOff=Math.min(t,r.length);return s?null:r.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,n);return this.textOff=n,i}}const cR=[Ay,mw,$b,tc,lR,ep,gD];for(let e=0;e[]),this.index=cR.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,i=this.buckets[n];i.length<6?i.push(t):i[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,i=2){let r=t.bucket,s=this.buckets[r],o=this.index[r];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let i=n&&this.getCompositionContext(n.text);for(let r=0,s=0,o=0;;){let l=or){let u=c-r;this.preserve(u,!o,!l),r=c,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof tc&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof tc&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let i=null,r=this.builder,s=-1,o=Di.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Cy){if(this.disallowBlockEffectsFor[h]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,f>d.length)r.continueWidget(c-l);else{let m=u.widget||(u.block?gw.block:gw.inline),g=z3t(u),b=this.cache.findWidget(m,c-l,g)||Ay.of(m,this.view,c-l,g);u.block?(u.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(b)):(r.ensureLine(i),r.addInlineWidget(b,d,f))}i=null}else i=V3t(i,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;f-1&&(this.openWidget=o>s),this.openWidget||r.addLineStartIfNotCovered(i),this.openMarks=o}forward(t,n,i=1){n-t<=10?this.old.advance(n-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let n=[],i=null;for(let r=t.parentNode;;r=r.parentNode){let s=Ys.get(r);if(r==this.view.contentDOM)break;s instanceof tc?n.push(s):s!=null&&s.isLine()?i=s:s instanceof ep||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new mw(r,w5e):i||n.push(tc.of(new nT({tagName:r.nodeName.toLowerCase(),attributes:b3t(r)}),r)))}return{line:i,marks:n}}}function Pne(e,t){let n=i=>{for(let r of i.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function z3t(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const w5e={class:"cm-line"};function V3t(e,t){let n=t.spec.attributes,i=t.spec.class;return!n&&!i||(e||(e={class:"cm-line"}),n&&LV(n,e),i&&(e.class+=" "+i)),e}function H3t(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof tc&&t.push(i.mark)}return t}function f3(e){let t=Ys.get(e);return t&&t.setDOM(e.cloneNode()),e}class gw extends Qd{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}gw.inline=new gw("span");gw.block=new gw("div");const h3=new class extends Qd{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Dne{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Cn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new gD(t,t.contentDOM),this.updateInner([new Mu(0,0,0,t.state.doc.length)],null)}update(t){var n;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:d,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!e4t(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let s=r>-1?W3t(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;i=new Mu(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(sn.ie||sn.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let c=X3t(o,this.decorations,t.changes);c.length&&(i=Mu.extendWithRanges(i,c));let u=Z3t(l,this.blockWrappers,t.changes);return u.length&&(i=Mu.extendWithRanges(i,u)),s&&!i.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(n||t.length){let o=this.tile,l=new Q3t(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Ys.get(n.text)&&l.cache.reused.set(Ys.get(n.text),2),this.tile=l.run(t,n),eB(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=sn.chrome||sn.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&tS(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),sn.gecko&&c.empty&&!this.hasComposition&&q3t(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new Sd(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!iS(u.node,u.offset,f.anchorNode,f.anchorOffset)||!iS(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{sn.android&&sn.chrome&&i.contains(f.focusNode)&&J3t(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let h=OE(this.view.root);if(h)if(c.empty){if(sn.gecko){let m=K3t(u.node,u.offset);if(m&&m!=3){let g=(m==1?e5e:t5e)(u.node,u.offset);g&&(u=new Sd(g.node,g.offset))}}h.collapse(u.node,u.offset),c.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=c.bidiLevel)}else if(h.extend){h.collapse(u.node,u.offset);try{h.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),m.setEnd(d.node,d.offset),m.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(m)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new Sd(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new Sd(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&iS(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,i=OE(t.root),{anchorNode:r,anchorOffset:s}=t.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);i.collapse(d.node,d.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&i.collapse(r,s)}posFromDOM(t,n){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(t==i.dom)s=i.dom.childNodes[n];else{let o=mp(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?s=t:s=t.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!Ys.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,l=r;;o++){let c=i.children[o];if(c.dom==s)return l;l+=c.length+c.breakAfter}}else return i.isText()?t==i.dom?r+n:r+(n?i.length:0):r}domAtPos(t,n){let{tile:i,offset:r}=this.tile.resolveBlock(t,n);return i.isWidget()?i.domPosFor(r,n):i.domIn(r,n)}inlineDOMNearPos(t,n){let i,r=-1,s=!1,o,l=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(s=!0)}else{let f=d+u.length;if(d<=t&&(i=u,r=t-d,s=f=t&&!o&&(o=u,l=t-d,c=d>t),d>t&&o)return!0}}),!i&&!o?this.domAtPos(t,n):(s&&o?i=null:c&&i&&(o=null),i&&n<0||!o?i.domIn(r,n):o.domIn(l,n))}coordsAt(t,n,i){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof p3?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n,i)}lineAt(t,n){let{tile:i}=this.tile.resolveBlock(t,n);return i.isLine()?i:null}coordsForChar(t){let{tile:n,offset:i}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let c=r(l,o);if(c)return c}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==Qr.LTR,u=0,d=(f,h,m)=>{for(let g=0;gr);g++){let b=f.children[g],v=h+b.length,y=b.dom.getBoundingClientRect(),{height:x}=y;if(m&&!g&&(u+=y.top-m.top),b instanceof ep)v>i&&d(b,h,y);else if(h>=i&&(u>0&&n.push(-u),n.push(x+u),u=0,o)){let w=b.dom.lastChild,O=w?nS(w):[];if(O.length){let S=O[O.length-1],k=c?S.right-y.left:y.right-S.left;k>l&&(l=k,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=v)}}m&&g==f.children.length-1&&(u+=m.bottom-y.bottom),h=v+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Qr.RTL:Qr.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,c;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=nS(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),i,r,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=nS(n.firstChild)[0];i=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,n.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let i=0,r=0;;r++){let s=r==n.viewports.length?null:n.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(i).top)/this.view.scaleY;t.push(Cn.replace({widget:new p3(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return Cn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(pD).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet(zV).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[t++]=i,n.push(Di.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ttypeof s=="function"?s(this.view):s)}scrollIntoView(t){if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(m5e))try{if(u(this.view,t.range,t))return!0}catch(d){sc(this.view.state,d,"scroll handler")}let{range:n}=t,i=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),r;if(!i)return;!n.empty&&(r=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=VV(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(x3t(this.view.scrollDOM,o,n.head1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){eB(this.tile)}}function eB(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let i of e.children)eB(i,t)}}function q3t(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function O5e(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=e5e(n.focusNode,n.focusOffset),r=t5e(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let l=Ys.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(e.docView.lastCompositionAfterCursor){let c=Ys.get(i.node);!c||c.isText()&&c.text!=i.node.nodeValue||(s=r)}}if(e.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function W3t(e,t,n){let i=O5e(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(i.from,i.to)!=l)return null;let c=t.invertedDesc;return{range:new Mu(c.mapPos(s),c.mapPos(o),s,o),text:r}}function K3t(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{it.from&&(n=!0)}),n}class p3 extends Qd{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function t4t(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(r.length==0)return ut.cursor(t);s==0?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=ba(r.text,s,!1):l=ba(r.text,s);let c=i(r.text.slice(o,l));for(;o>0;){let u=ba(r.text,o,!1);if(i(r.text.slice(u,o))!=c)break;o=u}for(;le.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((r-n.top-(e.defaultLineHeight-l)*.5)/l);s+=c*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Q8(o,s,e.state.tabSize)}function tB(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>t)break;if(!(s.tot)return s;(!r||s.type==La.Text&&(r.type!=s.type||(n<0?s.fromt)))&&(r=s)}}return r||i}return i}function i4t(e,t,n,i){let r=tB(e,t.head,t.assoc||-1),s=!i||r.type!=La.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(s){let o=e.dom.getBoundingClientRect(),l=e.textDirectionAt(r.from),c=e.posAtCoords({x:n==(l==Qr.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(c!=null)return ut.cursor(c,n?-1:1)}return ut.cursor(n?r.to:r.from,n?-1:1)}function Mne(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,c=null;;){let u=N3t(r,s,o,l,n),d=o5e;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;d=` +`,r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),u=e.visualLineSide(r,!n)}if(c){if(!c(d))return l}else{if(!i)return u;c=i(d)}l=u}}function r4t(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return s=>{let o=i(s);return r==Ts.Space&&(r=o),r==o}}function s4t(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return ut.cursor(r,t.assoc);let o=t.goalColumn,l,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-c.left),l=s<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(c.right-c.left,e.defaultCharacterWidth*(r-g.from))),l=(s<0?g.top:g.bottom)+d}let f=c.left+o,h=e.viewState.heightOracle.textHeight>>1,m=i??h;for(let g=0;;g+=h){let b=l+(m+g)*s,v=nB(e,{x:f,y:b},!1,s);if(n?b>c.bottom:bl:x{if(t>s&&tr(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:ut.cursor(i,ie.viewState.docHeight)return new pf(e.state.doc.length,-1);if(u=e.elementAtHeight(c),i==null)break;if(u.type==La.Text){if(i<0?u.toe.viewport.to)break;let h=e.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(h&&(i<0?h.top<=c+s:h.bottom>=c+s))break}let f=e.viewState.heightOracle.textHeight/2;c=i>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==La.Text){let f=n4t(e,r,u,o,l);return new pf(f,f==u.from?1:-1)}}if(u.type!=La.Text)return c<(u.top+u.bottom)/2?new pf(u.from,1):new pf(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new o4t(e,o,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class o4t{constructor(t,n,i,r){this.view=t,this.x=n,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from>1;t:if(o.has(b)){let y=r+Math.floor(Math.random()*g);for(let x=0;x1)){if(x.bottomthis.y)(!u||u.top>x.top)&&(u=x),w=-1;else{let O=x.left>this.x?this.x-x.left:x.right(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let m=(l?this.dirAt(t[d],1):this.baseDir)==Qr.LTR;return{i:d,after:this.x>(h.left+h.right)/2==m}}scanText(t,n){let i=[];for(let s=0;s{let o=i[s]-n,l=i[s+1]-n;return SE(t.dom,o,l).getClientRects()});return r.after?new pf(i[r.i+1],-1):new pf(i[r.i],1)}scanTile(t,n){if(!t.length)return new pf(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let i=[n];for(let l=0,c=n;l{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:SE(c.dom,0,c.length)).getClientRects()}),s=t.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new pf(i[r.i+1],-1):new pf(o,1)}}const cv="￿";class a4t{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(Ui.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=cv}readRange(t,n){if(!t)return this;let i=t.parentNode;for(let r=t;;){this.findPointBefore(i,r);let s=this.text.length;this.readNode(r);let o=Ys.get(r),l=r.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let c=Ys.get(l);(o&&c?o.breakAfter:(o?o.breakAfter:oR(r))||oR(l)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!c4t(l,n)&&this.lineBreak(),r=l}return this.findPointBefore(i,n),this}readTextNode(t){let n=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(i,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=o-1);i=s+o}}readNode(t){let n=Ys.get(t),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(t,n){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(l4t(t,i.node,i.offset)?n:0))}}function l4t(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:s,impreciseAnchor:o}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=S5e(t.docView.tile,n,i,0))){let c=s||o?[]:f4t(t),u=new a4t(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=h4t(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!G8(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!G8(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((sn.ios||sn.chrome)&&u!=d&&Math.min(u,d)<=l.main.from&&Math.max(u,d)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(ut.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let h=t.coordsAtPos(u,-1),m=0;h&&(m=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=ut.create([ut.cursor(u,m)])}else this.newSel=ut.single(d,u)}}}function S5e(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let c=0,u=i,d=i;cn)return S5e(f,t,n,u);if(h>=t&&r==-1&&(r=c,s=u),u>n&&f.dom.parentNode==e.dom){o=c,l=d;break}d=h,u=h+f.breakAfter}return{from:s,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o=0?e.children[o].dom:null}}else return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function E5e(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:c}=t.bounds,u=s.from,d=null;(o===8||sn.android&&t.text.length=l&&s.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,s.from-l)==t.text.slice(0,s.from-l)&&f.slice(s.to-l)==t.text.slice(h=t.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:sr.of(t.text.slice(s.from-l,h).split(cv))}:(m=C5e(f,t.text,u-l,d))&&(sn.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==cv+cv&&m.toB--,n={from:l+m.from,to:l+m.toA,insert:sr.of(t.text.slice(m.from,m.toB).split(cv))})}else i&&(!e.hasFocus&&r.facet(Rh)||uR(i,s))&&(i=null);if(!n&&!i)return!1;if((sn.mac||sn.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(i&&n.insert.length==2&&(i=ut.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:sr.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:r.toText(e.inputState.insertingText)}:sn.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&e.lineWrapping&&(i&&(i=ut.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:sr.of([" "])}),n)return HV(e,n,i,o);if(i&&!uR(i,s)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(i=k5e(r.facet(rT).map(u=>u(e)),i))),e.dispatch({selection:i,scrollIntoView:l,userEvent:c}),!0}else return!1}function HV(e,t,n,i=-1){if(sn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(sn.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&gx(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.lengthr.head)&&gx(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&gx(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=d4t(e,t,n));return e.state.facet(d5e).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function d4t(e,t,n){let i,r=e.state,s=r.selection.main,o=-1;if(t.from==t.to&&t.froms.to){let c=t.fromf(e)),u,c);t.from==d&&(o=d)}if(o>-1)i={changes:t,selection:ut.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=s.fromt.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=r.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let d=e.state.sliceDoc(t.from,t.to),f,h=n&&O5e(e,n.main.head);if(h){let g=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-g}}else f=e.state.doc.lineAt(s.head);let m=s.to-t.to;i=r.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:c,range:u||g.map(c)};let b=g.to-m,v=b-d.length;if(e.state.sliceDoc(v,b)!=d||b>=f.from&&v<=f.to)return{range:g};let y=r.changes({from:v,to:b,insert:t.insert}),x=g.to-s.to;return{changes:y,range:u?ut.range(Math.max(0,u.anchor+x),Math.max(0,u.head+x)):g.map(y)}})}else i={changes:c,selection:u&&r.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function C5e(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let c=Math.max(0,s-Math.min(o,l));n-=o+c-s}if(o=o?s-n:0;s-=c,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=c,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function f4t(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new Lne(n,i)),(r!=n||s!=i)&&t.push(new Lne(r,s))),t}function h4t(e,t){if(e.length==0)return null;let n=e[0].pos,i=e.length==2?e[1].pos:n;return n>-1&&i>-1?ut.single(n+t,i+t):null}function uR(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class p4t{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,sn.safari&&t.contentDOM.addEventListener("input",()=>null),sn.gecko&&j4t(t.contentDOM.ownerDocument)}handleEvent(t){!k4t(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let i=this.handlers[t];if(i){for(let r of i.observers)r(this.view,n);for(let r of i.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=g4t(t),i=this.handlers,r=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!n[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&A5e.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),sn.android&&sn.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(sn.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(T5e.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||b4t.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&sn.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&m4t(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:t.key,keyCode:t.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return t.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from0?!0:sn.safari&&!sn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function m4t(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function $ne(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){sc(n.state,r)}}}function g4t(e){let t=Object.create(null);function n(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of e){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let c=s[l];c&&n(l).handlers.push($ne(i.value,c))}if(o)for(let l in o){let c=o[l];c&&n(l).observers.push($ne(i.value,c))}}for(let i in Pd)n(i).handlers.push(Pd[i]);for(let i in Nl)n(i).observers.push(Nl[i]);return t}const T5e=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],b4t="dthko",A5e=[16,17,18,20,91,92,224,225],m2=6;function g2(e){return Math.max(0,e)*.7+8}function y4t(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class v4t{constructor(t,n,i,r){this.view=t,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=YLe(t.contentDOM),this.atoms=t.state.facet(rT).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(Ui.allowMultipleSelections)&&x4t(t,n),this.dragging=O4t(t,n)&&N5e(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&y4t(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=VV(this.view);t.clientX-c.left<=r+m2?n=-g2(r-t.clientX):t.clientX+c.right>=o-m2&&(n=g2(t.clientX-o)),t.clientY-c.top<=s+m2?i=-g2(s-t.clientY):t.clientY+c.bottom>=l-m2&&(i=g2(t.clientY-l)),this.setScrollSpeed(n,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,i=k5e(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!i.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function x4t(e,t){let n=e.state.facet(a5e);return n.length?n[0](t):sn.mac?t.metaKey:t.ctrlKey}function w4t(e,t){let n=e.state.facet(l5e);return n.length?n[0](t):sn.mac?!t.altKey:!t.ctrlKey}function O4t(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=OE(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function k4t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,i;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Ys.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const Pd=Object.create(null),Nl=Object.create(null),_5e=sn.ie&&sn.ie_version<15||sn.ios&&sn.webkit_version<604;function S4t(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),j5e(e,n.value)},50)}function bD(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function j5e(e,t){t=bD(e.state,BV,t);let{state:n}=e,i,r=1,s=n.toText(t),o=s.lines==n.selection.ranges.length;if(iB!=null&&n.selection.ranges.every(c=>c.empty)&&iB==s.toString()){let c=-1;i=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((o?s.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:ut.cursor(u.from+f.length)}})}else o?i=n.changeByRange(c=>{let u=s.line(r++);return{changes:{from:c.from,to:c.to,insert:u.text},range:ut.cursor(c.from+u.length)}}):i=n.replaceSelection(s);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Nl.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,sn.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Nl.wheel=Nl.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Pd.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Nl.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),i&&(n.lastTouchX=i.clientX,n.lastTouchY=i.clientY),n.setSelectionOrigin("select.pointer")};Nl.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Nl.touchend=(e,t)=>{e.inputState.touchActive=!1};Pd.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(c5e))if(n=i(e,t),n)break;if(!n&&t.button==0&&(n=C4t(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new v4t(e,t,n,i)),i&&e.observer.ignore(()=>{ZLe(e.contentDOM);let s=e.root.activeElement;s&&!s.contains(e.contentDOM)&&s.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function Fne(e,t,n,i){if(i==1)return ut.cursor(t,n);if(i==2)return t4t(e.state,t,n);{let r=e.docView.lineAt(t,n),s=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return lDate.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Une+1)%3:1}function C4t(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=N5e(t),r=e.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),r=r.map(s.changes))},get(s,o,l){let c=e.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,d=Fne(e,c.pos,c.assoc,i);if(n.pos!=c.pos&&!o){let f=Fne(e,n.pos,n.assoc,i),h=Math.min(f.from,d.from),m=Math.max(f.to,d.to);d=h1&&(u=T4t(r,c.pos))?u:l?r.addRange(d):ut.create([d])}}}function T4t(e,t){for(let n=0;n=t)return ut.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Pd.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=n.to||o<=n.from)&&(n=ut.undirectionalRange(s,o))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",bD(e.state,UV,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Pd.dragend=e=>(e.inputState.draggedContent=null,!1);function zne(e,t,n,i){if(n=bD(e.state,BV,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,o=i&&s&&w4t(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},c=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Pd.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&zne(e,t,i.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return zne(e,t,i,!0),!0}return!1};Pd.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=_5e?null:t.clipboardData;return n?(j5e(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(S4t(e),!1)};function A4t(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function _4t(e){let t=[],n=[],i=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:s}of e.selection.ranges){let o=e.doc.lineAt(s);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}i=!0}return{text:bD(e,UV,t.join(e.lineBreak)),ranges:n,linewise:i}}let iB=null;Pd.copy=Pd.cut=(e,t)=>{if(!tS(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=_4t(e.state);if(!n&&!r)return!1;iB=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=_5e?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(A4t(e,n),!1)};const R5e=qf.define();function I5e(e,t){let n=[];for(let i of e.facet(f5e)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:R5e.of(!0)}):null}function P5e(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=I5e(e.state,t);n?e.dispatch(n):e.update([])}},10)}Nl.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),P5e(e)};Nl.blur=e=>{e.observer.clearSelectionRange(),P5e(e)};Nl.compositionstart=Nl.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Nl.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,sn.chrome&&sn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Nl.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Pd.beforeinput=(e,t)=>{var n,i;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let s=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(s&&o.length){let l=o[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return HV(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let r;if(sn.chrome&&sn.android&&(r=T5e.find(s=>s.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return sn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),sn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Nl.compositionend(e,t),20),!1};const Vne=new Set;function j4t(e){Vne.has(e)||(Vne.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const Hne=["pre-wrap","normal","pre-line","break-spaces"];let bw=!1;function qne(){bw=!1}class N4t{constructor(t){this.lineWrapping=t,this.doc=sr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Hne.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let i=0;i-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=i,this.textHeight=r,this.lineLength=s,c){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>rj&&(bw=!0),this.height=t)}replace(t,n,i){return jl.of(i)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=r[l],h=s.lineAt(c,Jr.ByPosNoHeight,i.setDoc(n),0,0),m=h.to>=u?h:s.lineAt(u,Jr.ByPosNoHeight,i,0,0);for(f+=m.to-u,u=m.to;l>0&&h.from<=r[l-1].toA;)c=r[l-1].fromA,d=r[l-1].fromB,l--,cs*2){let l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r=s&&o(this.lineAt(0,Jr.ByPos,i,r,s))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,i=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Mc extends D5e{constructor(t,n,i){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,n){return new wd(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,i){let r=i[0];return i.length==1&&(r instanceof Mc||r instanceof ja&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ja?r=new Mc(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):jl.of(i)}updateHeight(t,n=0,i=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ja extends jl{constructor(t){super(t,0)}heightMetrics(t,n){let i=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,s=r-i+1,o,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*s);o=c/s,this.length>s+1&&(l=(this.height-c)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(t,n,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:c}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(t0){let s=i[i.length-1];s instanceof ja?i[i.length-1]=new ja(s.length+r):i.push(null,new ja(r-1))}if(t>0){let s=i[0];s instanceof ja?i[0]=new ja(t+s.length):i.unshift(new ja(t-1),null)}return jl.of(i)}decomposeLeft(t,n){n.push(new ja(t-1),null)}decomposeRight(t,n){n.push(null,new ja(this.length-t-1))}updateHeight(t,n=0,i=!1,r){let s=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],l=Math.max(n,r.from),c=-1;for(r.from>n&&o.push(new ja(r.from-n-1).updateHeight(t,n));l<=s&&r.more;){let d=t.doc.lineAt(l).length;o.length&&o.push(null);let f=r.heights[r.index++],h=0;f<0&&(h=-f,f=r.heights[r.index++]),c==-1?c=f:Math.abs(f-c)>=rj&&(c=-2);let m=new Mc(d,f,h);m.outdated=!1,o.push(m),l+=d+1}l<=s&&o.push(null,new ja(s-l).updateHeight(t,l));let u=jl.of(o);return(c<0||Math.abs(u.height-this.height)>=rj||Math.abs(c-this.heightMetrics(t,n).perLine)>=rj)&&(bw=!0),dR(this,u)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class P4t extends jl{constructor(t,n,i){super(t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,n,i,r){let s=i+this.left.height;return tl))return u;let d=n==Jr.ByPosNoHeight?Jr.ByPosNoHeight:Jr.ByPos;return c?u.join(this.right.lineAt(l,d,i,o,l)):this.left.lineAt(l,d,i,r,s).join(u)}forEachLine(t,n,i,r,s,o){let l=r+this.left.height,c=s+this.left.length+this.break;if(this.break)t=c&&this.right.forEachLine(t,n,i,l,c,o);else{let u=this.lineAt(c,Jr.ByPos,i,r,s);t=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,i,l,c,o)}}replace(t,n,i){let r=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,i));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of i)s.push(l);if(t>0&&Wne(s,o-1),n=i&&n.push(null)),t>i&&this.right.decomposeLeft(t-i,n)}decomposeRight(t,n){let i=this.left.length,r=i+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t2*n.size||n.size>2*t.size?jl.of(this.break?[t,null,n]:[t,n]):(this.left=dR(this.left,t),this.right=dR(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,i=!1,r){let{left:s,right:o}=this,l=n+s.length+this.break,c=null;return r&&r.from<=n+s.length&&r.more?c=s=s.updateHeight(t,n,i,r):s.updateHeight(t,n,i),r&&r.from<=l+o.length&&r.more?c=o=o.updateHeight(t,l,i,r):o.updateHeight(t,l,i),c?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Wne(e,t){let n,i;e[t]==null&&(n=e[t-1])instanceof ja&&(i=e[t+1])instanceof ja&&e.splice(t-1,3,new ja(n.length+1+i.length))}const D4t=5;class qV{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Mc?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Mc(i-this.pos,-1,0)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,i){if(t=D4t)&&this.addLineDeco(r,s,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTot&&this.nodes.push(new Mc(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let i=new ja(n-t);return this.oracle.doc.lineAt(t).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Mc)return t;let n=new Mc(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Mc)&&!this.isCovered?this.nodes.push(new Mc(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),l=Math.max(l,h.top),c=Math.min(u==e.parentNode?r.innerHeight:c,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function F4t(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function B4t(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class g3{constructor(t,n,i,r){this.from=t,this.to=n,this.size=i,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let i=0;itypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new N4t(i),this.stateDeco=Xne(n),this.heightMap=jl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle.setDoc(n.doc),[new Mu(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Cn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let r=i?n.head:n.anchor;if(!t.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);t.push(new b2(s,o))}}return this.viewports=t.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Gne:new WV(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(ik(t,this.scaler))})}update(t,n=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=Xne(this.state);let r=t.changedRanges,s=Mu.extendWithRanges(r,M4t(i,this.stateDeco,t?t.changes:Go.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);qne(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||bw)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let c=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(p5e)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,i=window.getComputedStyle(n),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Qr.RTL:Qr.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:S,scaleY:k}=XLe(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=S,this.scaleY=k,u|=16,o=c=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,h=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let m=YLe(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=JLe(this.scrollParent||t.win);let b=(this.printing?B4t:$4t)(n,this.paddingTop),v=b.top-this.pixelViewport.top,y=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&!F4t(t.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let S=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(S)&&(o=!0),o||r.lineWrapping&&Math.abs(w-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:C,textHeight:E}=t.docView.measureTextSize();o=k>0&&r.refresh(s,k,C,E,Math.max(5,w/C),S),o&&(t.docView.minWidth=0,u|=16)}v>0&&y>0?d=Math.max(v,y):v<0&&y<0&&(d=Math.min(v,y)),qne();for(let k of this.viewports){let C=k.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(k);this.heightMap=(o?jl.empty().applyChanges(this.stateDeco,sr.empty,this.heightOracle,[new Mu(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new R4t(k.from,C))}bw&&(u|=2)}let O=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return O&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,c=new b2(r.lineAt(o-i*1e3,Jr.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,Jr.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(uc.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(u,Jr.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s>1,o=r<<1;if(this.defaultTextDirection!=Qr.LTR&&!i)return[];let l=[],c=(d,f,h,m)=>{if(f-dd&&yy.from>=h.from&&y.to<=h.to&&Math.abs(y.from-d)y.fromx));if(!v){if(fw.from<=f&&w.to>=f)){let w=n.moveToLineBoundary(ut.cursor(f),!1,!0).head;w>d&&(f=w)}let y=this.gapSize(h,d,f,m),x=i||y<2e6?y:2e6;v=new g3(d,f,y,x)}l.push(v)},u=d=>{if(d.length2e6)for(let k of t)k.from>=d.from&&k.fromd.from&&c(d.from,m,d,f),gn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let i=[];Di.spans(n,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||ik(this.heightMap.lineAt(t,Jr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||ik(this.heightMap.lineAt(this.scaler.fromDOM(t),Jr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return ik(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class b2{constructor(t,n){this.from=t,this.to=n}}function Q4t(e,t,n){let i=[],r=e,s=0;return Di.spans(n,e,t,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let r=0;;r++){let{from:s,to:o}=t[r],l=o-s;if(i<=l)return s+i;i-=l}}function v2(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}function z4t(e,t){for(let n of e)if(t(n))return n}const Gne={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Xne(e){let t=e.facet(pD).filter(i=>typeof i!="function"),n=e.facet(zV).filter(i=>typeof i!="function");return n.length&&t.push(Di.join(n)),t}class WV{constructor(t,n,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:c})=>{let u=n.lineAt(l,Jr.ByPos,t,0,0).top,d=n.lineAt(c,Jr.ByPos,t,0,0).bottom;return r+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let n=0,i=0,r=0;;n++){let s=nn.from==t.viewports[i].from&&n.to==t.viewports[i].to):!1}}function ik(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new wd(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(r=>ik(r,t)):e._content)}const x2=an.define({combine:e=>e.join(" ")}),rB=an.define({combine:e=>e.indexOf(!0)>-1}),sB=gg.newName(),M5e=gg.newName(),L5e=gg.newName(),$5e={"&light":"."+M5e,"&dark":"."+L5e};function oB(e,t,n){return new gg(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+i}})}const V4t=oB("."+sB,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$5e),H4t={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},b3=sn.ie&&sn.ie_version<=11;class q4t{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new w3t,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let i of n)this.queue.push(i);(sn.ie&&sn.ie_version<=11||sn.ios&&t.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&sn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(sn.chrome&&sn.chrome_version<126)&&(this.editContext=new K4t(t),t.state.facet(Rh)&&(t.contentDOM.editContext=this.editContext.editContext)),b3&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,i)=>n!=t[i]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Rh)?i.root.activeElement!=this.dom:!tS(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(sn.ie&&sn.ie_version<=11||sn.android&&sn.chrome)&&!i.state.selection.main.empty&&r.focusNode&&iS(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=OE(t.root);if(!n)return!1;let i=sn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&W4t(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let r=tS(this.dom,i);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&gx(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,i=-1,r=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:i}=o:(n=Math.min(o.from,n),i=Math.max(o.to,i)))}return{from:n,to:i,typeOver:r}}readChange(){let{from:t,to:n,typeOver:i}=this.processRecords(),r=this.selectionChanged&&tS(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new u4t(this.view,t,n,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,r=E5e(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!uR(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let i=Yne(n,t.previousSibling||t.target.previousSibling,-1),r=Yne(n,t.nextSibling||t.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Rh)!=t.state.facet(Rh)&&(t.view.contentDOM.editContext=t.state.facet(Rh)?this.editContext.editContext:null))}destroy(){var t,n,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Yne(e,t,n){for(;t;){let i=Ys.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function Zne(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return iS(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}function W4t(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return Zne(e,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?Zne(e,n):null}class K4t{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let r=t.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),c=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>i.text.length;l==this.from&&sthis.to&&(c=s);let d=C5e(t.state.sliceDoc(l,c),i.text,(u?r.from:r.to)-l,u?"end":null);if(!d){let h=ut.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));uR(h,r)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:sr.of(i.text.slice(d.from,d.toB).split(` +`))};if((sn.mac||sn.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:sr.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);HV(t,f,ut.single(this.toEditorPos(i.selectionStart,h),this.toEditorPos(i.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(n.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let c=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(c{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(t.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=OE(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,i=!1,r=this.pendingContextChange;return t.changes.iterChanges((s,o,l,c,u)=>{if(i)return;let d=u.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(s+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(sthis.to||this.to-this.from+u.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),r&&!i&&this.revertPending(t.state),!i}update(t){let n=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Xt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||O3t(t.parent)||document,this.viewState=new Kne(this,t.state||Ui.create(t)),t.scrollTo&&t.scrollTo.is(p2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fv).map(r=>new d3(r));for(let r of this.plugins)r.update(this);this.observer=new q4t(this),this.inputState=new p4t(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Dne(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Ro?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,r,s=this.state;for(let h of t){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,c=null;t.some(h=>h.annotation(R5e))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=I5e(s,o),c||(l=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(Ui.phrases)!=this.state.facet(Ui.phrases))return this.setState(s);r=aR.create(this,s,t),r.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:m}=h.state.selection,{x:g,y:b}=this.state.facet(Xt.cursorScrollMargin);f=new bx(m.empty?m:ut.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",b,g)}for(let m of h.effects)m.is(p2)&&(f=m.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=fR.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(nk)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(x2)!=r.state.facet(x2)&&(this.viewState.mustMeasureContent=!0),(n||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let h of this.state.facet(J8))try{h(r)}catch(m){sc(this.state,m,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!E5e(this,d)&&u.force&&gx(this.contentDOM,u.key,u.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Kne(this,t),this.plugins=t.facet(Fv).map(i=>new d3(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Dne(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Fv),i=t.state.facet(Fv);if(n!=i){let r=[];for(let s of i){let o=n.indexOf(s);if(o<0)r.push(new d3(s));else{let l=this.plugins[o];l.mustUpdate=t,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(JLe(i||this.win))s=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(r);s=m.from,o=m.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(m=>{try{return m.read(this)}catch(g){return sc(this.state,g),Jne}}),f=aR.create(this,this.state,[]),h=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let m=0;m1||g<-1)&&!(sn.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+g,i?i.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(J8))l(n)}get themeClasses(){return sB+" "+(this.state.facet(rB)?L5e:M5e)+" "+this.state.facet(x2)}updateAttrs(){let t=eie(this,b5e,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Rh)?"true":"false",class:"cm-content",style:`${sn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),eie(this,QV,n);let i=this.observer.ignore(()=>{let r=_ne(this.contentDOM,this.contentAttrs,n),s=_ne(this.dom,this.editorAttrs,t);return r||s});return this.editorAttrs=t,this.contentAttrs=n,i}showAnnouncements(t){let n=!0;for(let i of t)for(let r of i.effects)if(r.is(Xt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(nk);let t=this.state.facet(Xt.cspNonce);gg.mount(this.root,this.styleModules.concat(V4t).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;ni.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,i){return m3(this,t,Mne(this,t,n,i))}moveByGroup(t,n){return m3(this,t,Mne(this,t,n,i=>r4t(this,t.head,i)))}visualLineSide(t,n){let i=this.bidiSpans(t),r=this.textDirectionAt(t.from),s=i[n?i.length-1:0];return ut.cursor(s.side(n,r)+t.from,s.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,i=!0){return i4t(this,t,n,i)}moveVertically(t,n,i){return m3(this,t,s4t(this,t,n,i))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let i=nB(this,t,n);return i&&i.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),nB(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let i=this.state.doc.lineAt(t),r=this.bidiSpans(i),s=r[Of.find(r,t-i.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==Qr.RTL)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(h5e)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>G4t)return s5e(t.length);let n=this.textDirectionAt(t.from),i;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==n&&(s.fresh||r5e(s.isolates,i=Rne(this,t))))return s.order;i||(i=Rne(this,t));let r=j3t(t.text,n,i);return this.bidiCache.push(new fR(t.from,t.to,n,i,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||sn.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ZLe(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var i,r,s,o;return p2.of(new bx(typeof t=="number"?ut.cursor(t):t,(i=n.y)!==null&&i!==void 0?i:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return p2.of(new bx(ut.cursor(i.from),"start","start",i.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Zs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Zs.define(()=>({}),{eventObservers:t})}static theme(t,n){let i=gg.newName(),r=[x2.of(i),nk.of(oB(`.${i}`,t))];return n&&n.dark&&r.push(rB.of(!0)),r}static baseTheme(t){return Ap.lowest(nk.of(oB("."+sB,t,$5e)))}static findFromDOM(t){var n;let i=t.querySelector(".cm-content"),r=i&&Ys.get(i)||Ys.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Xt.styleModule=nk;Xt.inputHandler=d5e;Xt.clipboardInputFilter=BV;Xt.clipboardOutputFilter=UV;Xt.scrollHandler=m5e;Xt.focusChangeEffect=f5e;Xt.perLineTextDirection=h5e;Xt.exceptionSink=u5e;Xt.updateListener=J8;Xt.editable=Rh;Xt.mouseSelectionStyle=c5e;Xt.dragMovesSelection=l5e;Xt.clickAddsSelectionRange=a5e;Xt.decorations=pD;Xt.blockWrappers=y5e;Xt.outerDecorations=zV;Xt.atomicRanges=rT;Xt.bidiIsolatedRanges=v5e;Xt.cursorScrollMargin=an.define({combine:e=>{let t=5,n=5;for(let i of e)typeof i=="number"?t=n=i:{x:t,y:n}=i;return{x:t,y:n}}});Xt.scrollMargins=x5e;Xt.darkTheme=rB;Xt.cspNonce=an.define({combine:e=>e.length?e[0]:""});Xt.contentAttributes=QV;Xt.editorAttributes=b5e;Xt.lineWrapping=Xt.contentAttributes.of({class:"cm-lineWrapping"});Xt.announce=Gn.define();const G4t=4096,Jne={};class fR{constructor(t,n,i,r,s,o){this.from=t,this.to=n,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(t,n){if(n.empty&&!t.some(s=>s.fresh))return t;let i=[],r=t.length?t[t.length-1].dir:Qr.LTR;for(let s=Math.max(0,t.length-10);s=0;r--){let s=i[r],o=typeof s=="function"?s(e):s;o&&LV(o,n)}return n}const X4t=sn.mac?"mac":sn.windows?"win":sn.linux?"linux":"key";function Y4t(e,t){const n=e.split(/-(?!$)/);let i=n[n.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let c=0;ci.concat(r),[]))),n}function J4t(e,t,n){return B5e(F5e(e.state),t,e,n)}let bm=null;const e$t=4e3;function t$t(e,t=X4t){let n=Object.create(null),i=Object.create(null),r=(o,l)=>{let c=i[o];if(c==null)i[o]=l;else if(c!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,c,u,d)=>{var f,h;let m=n[o]||(n[o]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>Y4t(y,t));for(let y=1;y{let O=bm={view:w,prefix:x,scope:o};return setTimeout(()=>{bm==O&&(bm=null)},e$t),!0}]})}let b=g.join(" ");r(b,!1);let v=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((h=(f=m._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&v.run.push(c),u&&(v.preventDefault=!0),d&&(v.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let h in d)d[h].run.push(m=>f(m,aB))}let c=o[t]||o.key;if(c)for(let u of l)s(u,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return n}let aB=null;function B5e(e,t,n,i){aB=t;let r=m3t(t),s=Zl(r,0),o=hf(s)==r.length&&r!=" ",l="",c=!1,u=!1,d=!1;bm&&bm.view==n&&bm.scope==i&&(l=bm.prefix+" ",A5e.indexOf(t.keyCode)<0&&(u=!0,bm=null));let f=new Set,h=v=>{if(v){for(let y of v.run)if(!f.has(y)&&(f.add(y),y(n)))return v.stopPropagation&&(d=!0),!0;v.preventDefault&&(v.stopPropagation&&(d=!0),u=!0)}return!1},m=e[i],g,b;return m&&(h(m[l+w2(r,t,!o)])?c=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(sn.windows&&t.ctrlKey&&t.altKey)&&!(sn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=bg[t.keyCode])&&g!=r?(h(m[l+w2(g,t,!0)])||t.shiftKey&&(b=xE[t.keyCode])!=r&&b!=g&&h(m[l+w2(b,t,!1)]))&&(c=!0):o&&t.shiftKey&&h(m[l+w2(r,t,!0)])&&(c=!0),!c&&h(m._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),aB=null,c}class ny{constructor(t,n,i,r,s){this.className=t,this.left=n,this.top=i,this.width=r,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,i){if(i.empty){let r=t.coordsAtPos(i.head,i.assoc||1);if(!r)return[];let s=U5e(t);return[new ny(n,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return n$t(t,n,i)}}function U5e(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Qr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function nie(e,t,n,i){let r=e.coordsAtPos(t,n*2);if(!r)return i;let s=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=e.posAtCoords({x:s.left+1,y:o}),c=e.posAtCoords({x:s.right-1,y:o});return l==null||c==null?i:{from:Math.max(i.from,Math.min(l,c)),to:Math.min(i.to,Math.max(l,c))}}function n$t(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),s=e.textDirection==Qr.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),c=U5e(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),h=l.right-(d?parseInt(d.paddingRight):0),m=tB(e,i,1),g=tB(e,r,-1),b=m.type==La.Text?m:null,v=g.type==La.Text?g:null;if(b&&(e.lineWrapping||m.widgetLineBreaks)&&(b=nie(e,i,1,b)),v&&(e.lineWrapping||g.widgetLineBreaks)&&(v=nie(e,r,-1,v)),b&&v&&b.from==v.from&&b.to==v.to)return x(w(n.from,n.to,b));{let S=b?w(n.from,null,b):O(m,!1),k=v?w(null,n.to,v):O(g,!0),C=[];return(b||m).to<(v||g).from-(b&&v?1:0)||m.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2T&&A.from=D)break;I>P&&j(Math.max(U,P),S==null&&U<=T,Math.min(I,D),k==null&&I>=N,L.dir)}if(P=M.to+1,P>=D)break}return _.length==0&&j(T,S==null,N,k==null,e.textDirection),{top:E,bottom:R,horizontal:_}}function O(S,k){let C=l.top+(k?S.top:S.bottom);return{top:C,bottom:C,horizontal:[]}}}function i$t(e,t){return e.constructor==t.constructor&&e.eq(t)}class r$t{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(sj)!=t.state.facet(sj)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,i=t.facet(sj);for(;n!i$t(n,this.drawn[i]))){let n=this.dom.firstChild,i=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[i].constructor&&r.update(n,this.drawn[i])?(n=n.nextSibling,i++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,sn.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const sj=an.define();function Q5e(e){return[Zs.define(t=>new r$t(t,e)),sj.of(e)]}const yw=an.define({combine(e){return Wf(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function s$t(e={}){return[yw.of(e),o$t,a$t,l$t,p5e.of(!0)]}function z5e(e){return e.startState.facet(yw)!=e.state.facet(yw)}const o$t=Q5e({above:!0,markers(e){let{state:t}=e,n=t.facet(yw),i=[];for(let r of t.selection.ranges){let s=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(s&&sn.ios&&n.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:ut.cursor(r.head,r.assoc);for(let c of ny.forRange(e,o,l))i.push(c)}}return i},update(e,t){e.transactions.some(i=>i.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=z5e(e);return n&&iie(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){iie(t.state,e)},class:"cm-cursorLayer"});function iie(e,t){t.style.animationDuration=e.facet(yw).cursorBlinkRate+"ms"}const a$t=Q5e({above:!1,markers(e){let t=[],{main:n,ranges:i}=e.state.selection;for(let r of i)if(!r.empty)for(let s of ny.forRange(e,"cm-selectionBackground",r))t.push(s);if(sn.ios&&!n.empty&&e.state.facet(yw).iosSelectionHandles){for(let r of ny.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ut.cursor(n.from,1)))t.push(r);for(let r of ny.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ut.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||z5e(e)},class:"cm-selectionLayer"}),l$t=Ap.highest(Xt.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),V5e=Gn.define({map(e,t){return e==null?null:t.mapPos(e)}}),rk=Qa.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,i)=>i.is(V5e)?i.value:n,e)}}),c$t=Zs.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(rk);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(rk)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(rk),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(rk)!=e&&this.view.dispatch({effects:V5e.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function u$t(){return[rk,c$t]}function rie(e,t,n,i,r){t.lastIndex=0;for(let s=e.iterRange(n,i),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=t.exec(s.value);)r(o+l.index,l)}function d$t(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:r,to:s}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}class f$t{constructor(t){const{regexp:n,decoration:i,decorate:r,boundary:s,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(l,c,u,d)=>r(d,u,u+l[0].length,l,c);else if(typeof i=="function")this.addMatch=(l,c,u,d)=>{let f=i(l,c,u);f&&d(u,u+l[0].length,f)};else if(i)this.addMatch=(l,c,u,d)=>d(u,u+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(t){let n=new pp,i=n.add.bind(n);for(let{from:r,to:s}of d$t(t,this.maxLength))rie(t.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,t,o,i));return n.finish()}updateDeco(t,n){let i=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((s,o,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(i=Math.min(l,i),r=Math.max(c,r))}),t.viewportMoved||r-i>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),i,r):n}updateRange(t,n,i,r){for(let s of t.visibleRanges){let o=Math.max(s.from,i),l=Math.min(s.to,r);if(l>=o){let c=t.state.doc.lineAt(o),u=c.toc.from;o--)if(this.boundary.test(c.text[o-1-c.from])){d=o;break}for(;lh.push(y.range(b,v));if(c==u)for(this.regexp.lastIndex=d-c.from;(m=this.regexp.exec(c.text))&&m.indexthis.addMatch(v,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,v)=>bf,add:h})}}return n}}const lB=/x/.unicode!=null?"gu":"g",h$t=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,lB),p$t={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let y3=null;function m$t(){var e;if(y3==null&&typeof document<"u"&&document.body){let t=document.body.style;y3=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return y3||!1}const oj=an.define({combine(e){let t=Wf(e,{render:null,specialChars:h$t,addSpecialChars:null});return(t.replaceTabs=!m$t())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,lB)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,lB)),t}});function g$t(e={}){return[oj.of(e),b$t()]}let sie=null;function b$t(){return sie||(sie=Zs.fromClass(class{constructor(e){this.view=e,this.decorations=Cn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(oj)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new f$t({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=Zl(t[0],0);if(s==9){let o=r.lineAt(i),l=n.state.tabSize,c=Id(o.text,l,i-o.from);return Cn.replace({widget:new w$t((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Cn.replace({widget:new x$t(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(oj);e.startState.facet(oj)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const y$t="•";function v$t(e){return e>=32?y$t:e==10?"␤":String.fromCharCode(9216+e)}class x$t extends Qd{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=v$t(this.code),i=t.state.phrase("Control character")+" "+(p$t[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,n);if(r)return r;let s=document.createElement("span");return s.textContent=n,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class w$t extends Qd{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function O$t(){return S$t}const k$t=Cn.line({class:"cm-activeLine"}),S$t=Zs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let r=e.lineBlockAt(i.head);r.from>t&&(n.push(k$t.range(r.from)),t=r.from)}return Cn.set(n)}},{decorations:e=>e.decorations});class E$t extends Qd{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?nS(t.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(t.parentNode),r=kE(n[0],i.direction!="rtl"),s=parseInt(i.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}}function C$t(e){let t=Zs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Cn.set([Cn.widget({widget:new E$t(e),side:1}).range(0)]):Cn.none}get decorations(){return this.view.state.doc.length?Cn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Xt.contentAttributes.of({"aria-placeholder":e})]:t}const cB=2e3;function T$t(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>cB||n.off>cB||t.col<0||n.col<0){let o=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=i;c<=r;c++){let u=e.doc.line(c);u.length<=l&&s.push(ut.range(u.from+o,u.to+l))}}else{let o=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=i;c<=r;c++){let u=e.doc.line(c),d=Q8(u.text,o,e.tabSize,!0);if(d<0)s.push(ut.cursor(u.to));else{let f=Q8(u.text,l,e.tabSize);s.push(ut.range(u.from+d,u.from+f))}}}return s}function A$t(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function oie(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(n),r=n-i.from,s=r>cB?-1:r==i.length?A$t(e,t.clientX):Id(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function _$t(e,t){let n=oie(e,t),i=e.state.selection;return n?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},i=i.map(r.changes)}},get(r,s,o){let l=oie(e,r);if(!l)return i;let c=T$t(e.state,n,l);return c.length?o?ut.create(c.concat(i.ranges)):ut.create(c):i}}:null}function j$t(e){let t=n=>n.altKey&&n.button==0;return Xt.mouseSelectionStyle.of((n,i)=>t(i)?_$t(n,i):null)}const N$t={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},R$t={style:"cursor: crosshair"};function I$t(e={}){let[t,n]=N$t[e.key||"Alt"],i=Zs.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==t||n(r))},keyup(r){(r.keyCode==t||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[i,Xt.contentAttributes.of(r=>{var s;return!((s=r.plugin(i))===null||s===void 0)&&s.isDown?R$t:null})]}const O2="-10000px";class H5e{constructor(t,n,i,r){this.facet=n,this.createTooltipView=i,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=i(o,s))}update(t,n){var i;let r=t.state.facet(this.facet),s=r.filter(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let o=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function P$t(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const v3=an.define({combine:e=>{var t,n,i;return{position:sn.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=e.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||P$t}}}),aie=new WeakMap,KV=Zs.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(v3);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new H5e(e,GV,(n,i)=>this.createTooltip(n,i),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(v3);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=O2,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(sn.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=VV(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(v3).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let l=0;l=Math.min(n.bottom,i.bottom)||f.rightMath.min(n.right,i.right)+.1)){d.style.top=O2;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,v=(t=aie.get(u))!==null&&t!==void 0?t:h.bottom-h.top,y=u.offset||M$t,x=this.view.textDirection==Qr.LTR,w=h.width>i.right-i.left?x?i.left:i.right-h.width:x?Math.max(i.left,Math.min(f.left-(m?14:0)+y.x,i.right-b)):Math.min(Math.max(i.left,f.left-b+(m?14:0)-y.x),i.right-b),O=this.above[l];!c.strictSide&&(O?f.top-v-g-y.yi.bottom)&&O==i.bottom-f.bottom>f.top-i.top&&(O=this.above[l]=!O);let S=(O?f.top-i.top:i.bottom-f.bottom)-g;if(Sw&&E.topk&&(k=O?E.top-v-2-g:E.bottom+g+2);if(this.position=="absolute"?(d.style.top=(k-e.parent.top)/s+"px",lie(d,(w-e.parent.left)/r)):(d.style.top=k/s+"px",lie(d,w/r)),m){let E=f.left+(x?y.x:-y.x)-(w+14-7);m.style.left=E/r+"px"}u.overlap!==!0&&o.push({left:w,top:k,right:C,bottom:k+v}),d.classList.toggle("cm-tooltip-above",O),d.classList.toggle("cm-tooltip-below",!O),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=O2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lie(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const D$t=Xt.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),M$t={x:0,y:0},GV=an.define({enables:[KV,D$t]}),hR=an.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class yD{static create(t){return new yD(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new H5e(t,hR,(n,i)=>this.createHostedView(n,i),n=>n.dom.remove())}createHostedView(t,n){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let i of this.manager.tooltipViews){let r=i[t];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const L$t=GV.compute([hR],e=>{let t=e.facet(hR);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var i;return(i=n.end)!==null&&i!==void 0?i:n.pos})),create:yD.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),q5e=an.define();class $$t{constructor(t,n,i,r,s,o){this.view=t,this.source=n,this.field=i,this.locked=r,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;to.bottom||n.xo.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=l&&l.dir==Qr.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];r&&this.locked.set(c,r),t.dispatch({effects:this.setHover.of(c)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(c=>{this.pending==l&&(this.pending=null,o(c))},c=>sc(t.state,c,"hover tooltip"))}else o(s)}get tooltip(){let t=this.view.plugin(KV),n=t?t.manager.tooltips.findIndex(i=>i.create==yD.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:s}=this;if(r.length&&!this.locked.has(r)&&s&&!F$t(s.dom,t)||this.pending){let{pos:o}=r[0]||this.pending,l=(i=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!B$t(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:i}=this;i&&i.dom.contains(t.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=i=>{t.removeEventListener("mouseleave",n);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const k2=4;function F$t(e,t){let{left:n,right:i,top:r,bottom:s}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return t.clientX>=n-k2&&t.clientX<=i+k2&&t.clientY>=r-k2&&t.clientY<=s+k2}function B$t(e,t,n,i,r,s){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,l)=t&&c<=n}function U$t(e,t={}){let n=Gn.define(),i=new WeakMap,r=Qa.define({create(){return[]},update(o,l){let c=i.get(o);if(o.length&&(t.hideOnChange&&(l.docChanged||l.selection)?o=[]:c&&c(l)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let d of o){let f=l.changes.mapPos(d.pos,-1,Pa.TrackDel);if(f!=null){let h=Object.assign(Object.create(null),d);h.pos=f,h.end!=null&&(h.end=l.changes.mapPos(h.end)),u.push(h)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,c=void 0),(u.is(z$t)&&!u.value||u.value==r)&&(o=[]);return o.length&&c&&i.set(o,c),o},provide:o=>hR.from(o)});const s=Zs.define(o=>new $$t(o,e,r,i,n,t.hoverTime||300));return{active:r,extension:[r,s,q5e.of(s),L$t]}}function Q$t(e,t,n,i={}){var r;let s=e.state.facet(q5e).map(o=>e.plugin(o)).filter(o=>!!o);if(i.tooltip&&i.tooltip.active){let o=s.find(l=>l.field==i.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(e,t,n,(r=i.until)!==null&&r!==void 0?r:()=>!1)}function W5e(e,t){let n=e.plugin(KV);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const z$t=Gn.define(),cie=an.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function XV(e,t){let n=e.plugin(K5e),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const K5e=Zs.fromClass(class{constructor(e){this.input=e.state.facet(EE),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(cie);this.top=new S2(e,!0,t.topContainer),this.bottom=new S2(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(cie);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new S2(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new S2(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(EE);if(n!=this.input){let i=n.filter(c=>c),r=[],s=[],o=[],l=[];for(let c of i){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.push(d)):(d=this.panels[u],d.update&&d.update(e)),r.push(d),(d.top?s:o).push(d)}this.specs=i,this.panels=r,this.top.sync(s),this.bottom.sync(o);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let i of this.panels)i.update&&i.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Xt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class S2{constructor(t,n,i){this.view=t,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=uie(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=uie(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function uie(e){let t=e.nextSibling;return e.remove(),t}const EE=an.define({enables:K5e});function V$t(e,t){let n,i=new Promise(o=>n=o),r=o=>H$t(o,t,n);e.state.field(x3,!1)?e.dispatch({effects:G5e.of(r)}):e.dispatch({effects:Gn.appendConfig.of(x3.init(()=>[r]))});let s=X5e.of(r);return{close:s,result:i.then(o=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(x3).indexOf(r)>-1&&e.dispatch({effects:s})}),o))}}const x3=Qa.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(G5e)?e=[n.value].concat(e):n.is(X5e)&&(e=e.filter(i=>i!=n.value));return e},provide:e=>EE.computeN([e],t=>t.field(e))}),G5e=Gn.define(),X5e=Gn.define();function H$t(e,t,n){let i=t.content?t.content(e,()=>o(null)):null;if(!i){if(i=Ir("form"),t.input){let l=Ir("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(Ir("label",(t.label||"")+": ",l))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Ir("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(c))}),c.addEventListener("submit",u=>{u.preventDefault(),o(c)})}let s=Ir("div",i,Ir("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(s.className=t.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:s,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=i.querySelector(t.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class gp extends mg{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}gp.prototype.elementClass="";gp.prototype.toDOM=void 0;gp.prototype.mapMode=Pa.TrackBefore;gp.prototype.startSide=gp.prototype.endSide=-1;gp.prototype.point=!0;const aj=an.define(),q$t=an.define(),W$t={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Di.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},sS=an.define();function K$t(e){return[Y5e(),sS.of({...W$t,...e})]}const die=an.define({combine:e=>e.some(t=>t)});function Y5e(e){return[G$t]}const G$t=Zs.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(sS).map(t=>new hie(e,t)),this.fixed=!e.state.facet(die);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(die)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Di.iter(this.view.state.facet(aj),this.view.viewport.from),i=[],r=this.gutters.map(s=>new X$t(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==La.Text&&o){uB(n,i,l.from);for(let c of r)c.line(this.view,l,i);o=!1}else if(l.widget)for(let c of r)c.widget(this.view,l)}else if(s.type==La.Text){uB(n,i,s.from);for(let o of r)o.line(this.view,s,i)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(sS),n=e.state.facet(sS),i=e.docChanged||e.heightChanged||e.viewportChanged||!Di.eq(e.startState.facet(aj),e.state.facet(aj),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let r of this.gutters)r.update(e)&&(i=!0);else{i=!0;let r=[];for(let s of n){let o=t.indexOf(s);o<0?r.push(new hie(this.view,s)):(this.gutters[o].update(e),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Xt.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Qr.LTR?{left:i,right:r}:{right:i,left:r}})});function fie(e){return Array.isArray(e)?e:[e]}function uB(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class X$t{constructor(t,n,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Di.iter(t.markers,n.from)}addElement(t,n,i){let{gutter:r}=this,s=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==r.elements.length){let l=new Z5e(t,o,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(t,o,s,i);this.height=n.bottom,this.i++}line(t,n,i){let r=[];uB(this.cursor,r,n.from),i.length&&(r=r.concat(i));let s=this.gutter.config.lineMarker(t,n,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,r)}widget(t,n){let i=this.gutter.config.widgetMarker(t,n.widget,n),r=i?[i]:null;for(let s of t.state.facet(q$t)){let o=s(t,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(t,n,r)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class hie{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in n.domEventHandlers)this.dom.addEventListener(i,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();o=(c.top+c.bottom)/2}else o=r.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[i](t,l,r)&&r.preventDefault()});this.markers=fie(n.markers(t)),n.initialSpacer&&(this.spacer=new Z5e(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=fie(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],t);r!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[r])}let i=t.view.viewport;return!Di.eq(this.markers,n,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Z5e{constructor(t,n,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,i,r)}update(t,n,i,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Y$t(this.markers,r)||this.setMarkers(t,r)}setMarkers(t,n){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,c=ss(l,c,u)||o(l,c,u):o}return i}})}});class w3 extends gp{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function O3(e,t){return e.state.facet(Bv).formatNumber(t,e.state)}const e6t=sS.compute([Bv],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Z$t)},lineMarker(t,n,i){return i.some(r=>r.toDOM)?null:new w3(O3(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,i)=>{for(let r of t.state.facet(J$t)){let s=r(t,n,i);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Bv)!=t.state.facet(Bv),initialSpacer(t){return new w3(O3(t,pie(t.state.doc.lines)))},updateSpacer(t,n){let i=O3(n.view,pie(n.view.state.doc.lines));return i==t.number?t:new w3(i)},domEventHandlers:e.facet(Bv).domEventHandlers,side:"before"}));function J5e(e={}){return[Bv.of(e),Y5e(),e6t]}function pie(e){let t=9;for(;t{let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.head).from;r>n&&(n=r,t.push(t6t.range(r)))}return Di.of(t)});function i6t(){return n6t}let r6t=0,uf=class dB{constructor(t,n,i,r){this.name=t,this.set=n,this.base=i,this.modified=r,this.id=r6t++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let i=typeof t=="string"?t:"?";if(t instanceof dB&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new dB(i,[],null,[]);if(r.set.push(r),n)for(let s of n.set)r.set.push(s);return r}static defineModifier(t){let n=new pR(t);return i=>i.modified.indexOf(n)>-1?i:pR.get(i.base||i,i.modified.concat(n).sort((r,s)=>r.id-s.id))}},s6t=0;class pR{constructor(t){this.name=t,this.instances=[],this.id=s6t++}static get(t,n){if(!n.length)return t;let i=n[0].instances.find(l=>l.base==t&&o6t(n,l.modified));if(i)return i;let r=[],s=new uf(t.name,r,t,n);for(let l of n)l.instances.push(s);let o=a6t(n);for(let l of t.set)if(!l.modified.length)for(let c of o)r.push(pR.get(l,c));return s}}function o6t(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function a6t(e){let t=[[]];for(let n=0;ni.length-n.length)}function _p(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let r of n.split(" "))if(r){let s=[],o=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+r);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==r.length)break;let m=r[f++];if(f==r.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+r);l=r.slice(f)}let c=s.length-1,u=s[c];if(!u)throw new RangeError("Invalid path: "+r);let d=new CE(i,o,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return e3e.add(t)}const e3e=new Kn({combine(e,t){let n,i,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new CE(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});let CE=class{constructor(t,n,i,r){this.tags=t,this.mode=n,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=r;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){o=o?o+" "+u:u;break}}return o},scope:i}}function l6t(e,t){let n=null;for(let i of e){let r=i.style(t);r&&(n=n?n+" "+r:r)}return n}function c6t(e,t,n,i=0,r=e.length){let s=new u6t(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}class u6t{constructor(t,n,i){this.at=t,this.highlighters=n,this.span=i,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,i,r,s){let{type:o,from:l,to:c}=t;if(l>=i||c<=n)return;o.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(o)));let u=r,d=d6t(t)||CE.empty,f=l6t(s,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let h=t.tree&&t.tree.prop(Kn.mounted);if(h&&h.overlay){let m=t.node.enter(h.overlay[0].from+l,1),g=this.highlighters.filter(v=>!v.scope||v.scope(h.tree.type)),b=t.firstChild();for(let v=0,y=l;;v++){let x=v=w||!t.nextSibling())););if(!x||w>i)break;y=x.to+l,y>n&&(this.highlightRange(m.cursor(),Math.max(n,x.from+l),Math.min(i,y),"",g),this.startSpan(Math.min(i,y),u))}b&&t.parent()}else if(t.firstChild()){h&&(r="");do if(!(t.to<=n)){if(t.from>=i)break;this.highlightRange(t,n,i,r,s),this.startSpan(Math.min(i,t.to),u)}while(t.nextSibling());t.parent()}}}function d6t(e){let t=e.type.prop(e3e);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const tn=uf.define,E2=tn(),lm=tn(),mie=tn(lm),gie=tn(lm),cm=tn(),C2=tn(cm),k3=tn(cm),of=tn(),ib=tn(of),ef=tn(),tf=tn(),fB=tn(),mO=tn(fB),T2=tn(),oe={comment:E2,lineComment:tn(E2),blockComment:tn(E2),docComment:tn(E2),name:lm,variableName:tn(lm),typeName:mie,tagName:tn(mie),propertyName:gie,attributeName:tn(gie),className:tn(lm),labelName:tn(lm),namespace:tn(lm),macroName:tn(lm),literal:cm,string:C2,docString:tn(C2),character:tn(C2),attributeValue:tn(C2),number:k3,integer:tn(k3),float:tn(k3),bool:tn(cm),regexp:tn(cm),escape:tn(cm),color:tn(cm),url:tn(cm),keyword:ef,self:tn(ef),null:tn(ef),atom:tn(ef),unit:tn(ef),modifier:tn(ef),operatorKeyword:tn(ef),controlKeyword:tn(ef),definitionKeyword:tn(ef),moduleKeyword:tn(ef),operator:tf,derefOperator:tn(tf),arithmeticOperator:tn(tf),logicOperator:tn(tf),bitwiseOperator:tn(tf),compareOperator:tn(tf),updateOperator:tn(tf),definitionOperator:tn(tf),typeOperator:tn(tf),controlOperator:tn(tf),punctuation:fB,separator:tn(fB),bracket:mO,angleBracket:tn(mO),squareBracket:tn(mO),paren:tn(mO),brace:tn(mO),content:of,heading:ib,heading1:tn(ib),heading2:tn(ib),heading3:tn(ib),heading4:tn(ib),heading5:tn(ib),heading6:tn(ib),contentSeparator:tn(of),list:tn(of),quote:tn(of),emphasis:tn(of),strong:tn(of),link:tn(of),monospace:tn(of),strikethrough:tn(of),inserted:tn(),deleted:tn(),changed:tn(),invalid:tn(),meta:T2,documentMeta:tn(T2),annotation:tn(T2),processingInstruction:tn(T2),definition:uf.defineModifier("definition"),constant:uf.defineModifier("constant"),function:uf.defineModifier("function"),standard:uf.defineModifier("standard"),local:uf.defineModifier("local"),special:uf.defineModifier("special")};for(let e in oe){let t=oe[e];t instanceof uf&&(t.name=e)}t3e([{tag:oe.link,class:"tok-link"},{tag:oe.heading,class:"tok-heading"},{tag:oe.emphasis,class:"tok-emphasis"},{tag:oe.strong,class:"tok-strong"},{tag:oe.keyword,class:"tok-keyword"},{tag:oe.atom,class:"tok-atom"},{tag:oe.bool,class:"tok-bool"},{tag:oe.url,class:"tok-url"},{tag:oe.labelName,class:"tok-labelName"},{tag:oe.inserted,class:"tok-inserted"},{tag:oe.deleted,class:"tok-deleted"},{tag:oe.literal,class:"tok-literal"},{tag:oe.string,class:"tok-string"},{tag:oe.number,class:"tok-number"},{tag:[oe.regexp,oe.escape,oe.special(oe.string)],class:"tok-string2"},{tag:oe.variableName,class:"tok-variableName"},{tag:oe.local(oe.variableName),class:"tok-variableName tok-local"},{tag:oe.definition(oe.variableName),class:"tok-variableName tok-definition"},{tag:oe.special(oe.variableName),class:"tok-variableName2"},{tag:oe.definition(oe.propertyName),class:"tok-propertyName tok-definition"},{tag:oe.typeName,class:"tok-typeName"},{tag:oe.namespace,class:"tok-namespace"},{tag:oe.className,class:"tok-className"},{tag:oe.macroName,class:"tok-macroName"},{tag:oe.propertyName,class:"tok-propertyName"},{tag:oe.operator,class:"tok-operator"},{tag:oe.comment,class:"tok-comment"},{tag:oe.meta,class:"tok-meta"},{tag:oe.invalid,class:"tok-invalid"},{tag:oe.punctuation,class:"tok-punctuation"}]);var S3;const _m=new Kn;function vD(e){return an.define({combine:e?t=>t.concat(e):void 0})}const YV=new Kn;class qc{constructor(t,n,i=[],r=""){this.data=t,this.name=r,Ui.prototype.hasOwnProperty("tree")||Object.defineProperty(Ui.prototype,"tree",{get(){return Lr(this)}}),this.parser=n,this.extension=[vg.of(this),Ui.languageData.of((s,o,l)=>{let c=bie(s,o,l),u=c.type.prop(_m);if(!u)return[];let d=s.facet(u),f=c.type.prop(YV);if(f){let h=c.resolve(o-c.from,l);for(let m of f)if(m.test(h,s)){let g=s.facet(m.facet);return m.type=="replace"?g:g.concat(d)}}return d})].concat(i)}isActiveAt(t,n,i=-1){return bie(t,n,i).type.prop(_m)==this.data}findRegions(t){let n=t.facet(vg);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(_m)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(Kn.mounted);if(l){if(l.tree.prop(_m)==this.data){if(l.overlay)for(let c of l.overlay)i.push({from:c.from+o,to:c.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let c=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>c)return}}for(let c=0;ci.isTop?n:void 0)]}),t.name)}configure(t,n){return new bp(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(e){let t=e.field(qc.state,!1);return t?t.tree:Ci.empty}class f6t{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-i,n-i)}}let gO=null;class _y{constructor(t,n,i=[],r,s,o,l,c){this.parser=t,this.state=n,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,i){return new _y(t,n,[],Ci.empty,0,i,[],null)}startParse(){return this.parser.startParse(new f6t(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ci.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Jh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=gO;gO=this;try{return t()}finally{gO=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=yie(t,n.from,n.to);return t}changes(t,n){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,f,h)=>c.push({fromA:u,toA:d,fromB:f,toB:h})),i=Jh.applyChanges(i,c),r=Ci.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);dt.from&&(this.fragments=yie(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends dD{createParse(n,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let c=gO;if(c){for(let u of r)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=o,new Ci(Po.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return gO}}function yie(e,t,n){return Jh.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class vw{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new vw(n)}static init(t){let n=Math.min(3e3,t.doc.length),i=_y.create(t.facet(vg).parser,t,{from:0,to:n});return i.work(20,n)||i.takeTree(),new vw(i)}}qc.state=Qa.define({create:vw.init,update(e,t){for(let n of t.effects)if(n.is(qc.setState))return n.value;return t.startState.facet(vg)!=t.state.facet(vg)?vw.init(t.state):e.apply(t)}});let n3e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(n3e=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const E3=typeof navigator<"u"&&(!((S3=navigator.scheduling)===null||S3===void 0)&&S3.isInputPending)?()=>navigator.scheduling.isInputPending():null,h6t=Zs.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(qc.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(qc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=n3e(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndr+1e3,c=s.context.work(()=>E3&&E3()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:qc.setState.of(new vw(s.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>sc(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),vg=an.define({combine(e){return e.length?e[0]:null},enables:e=>[qc.state,h6t,Xt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class xg{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class mR{constructor(t,n,i,r,s,o=void 0){this.name=t,this.alias=n,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:n,support:i}=t;if(!n){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(i)}return new mR(t.name,(t.alias||[]).concat(t.name).map(r=>r.toLowerCase()),t.extensions||[],t.filename,n,i)}static matchFilename(t,n){for(let r of t)if(r.filename&&r.filename.test(n))return r;let i=/\.([^.]+)$/.exec(n);if(i){for(let r of t)if(r.extensions.indexOf(i[1])>-1)return r}return null}static matchLanguageName(t,n,i=!0){n=n.toLowerCase();for(let r of t)if(r.alias.some(s=>s==n))return r;if(i)for(let r of t)for(let s of r.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return r}return null}}const p6t=an.define(),f1=an.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function jy(e){let t=e.facet(f1);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function TE(e,t){let n="",i=e.tabSize,r=e.facet(f1)[0];if(r==" "){for(;t>=i;)n+=" ",t-=i;r=" "}for(let s=0;s=t?m6t(e,n,t):null}class xD{constructor(t,n={}){this.state=t,this.options=n,this.unit=jy(t)}lineAt(t,n=1){let i=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==t?{text:"",from:t}:(n<0?r-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,n=t.length){return Id(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:i,from:r}=this.lineAt(t,n),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const jp=new Kn;function m6t(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let s=[];for(let o=r;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return i3e(i,e,n)}function i3e(e,t,n){for(let i=e;i;i=i.next){let r=b6t(i.node);if(r)return r(JV.create(t,n,i))}return 0}function g6t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function b6t(e){let t=e.type.prop(jp);if(t)return t;let n=e.firstChild,i;if(n&&(i=n.type.prop(Kn.closedBy))){let r=e.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>r3e(o,!0,1,void 0,s&&!g6t(o)?r.from:void 0)}return e.parent==null?y6t:null}function y6t(){return 0}class JV extends xD{constructor(t,n,i){super(t.state,t.options),this.base=t,this.pos=n,this.context=i}get node(){return this.context.node}static create(t,n,i){return new JV(t,n,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(n.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(v6t(i,t))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return i3e(this.context.next,this.base,this.pos)}}function v6t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function x6t(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=n.to;;){let c=t.childAfter(l);if(!c||c==i)return null;if(!c.type.isSkipped){if(c.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=c.to}}function yx({closing:e,align:t=!0,units:n=1}){return i=>r3e(i,t,n,e)}function r3e(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==e.pos+o,c=t?x6t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const w6t=e=>e.baseIndent;function vx({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const O6t=200;function k6t(){return Ui.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+O6t)return e;let s=n.sliceString(r.from,i);if(!t.some(u=>u.test(s)))return e;let{state:o}=e,l=-1,c=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=ZV(o,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=TE(o,f);h!=m&&c.push({from:d.from,to:d.from+h.length,insert:m})}return c.length?[e,{changes:c,sequential:!0}]:e})}const s3e=an.define(),Np=new Kn;function sT(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&l.from=t&&u.to>n&&(s=u)}}return s}function E6t(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function gR(e,t,n){for(let i of e.facet(s3e)){let r=i(e,t,n);if(r)return r}return S6t(e,t,n)}function o3e(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const wD=Gn.define({map:o3e}),oT=Gn.define({map:o3e});function a3e(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(i=>i.from<=n&&i.to>=n)||t.push(e.lineBlockAt(n));return t}const Ny=Qa.define({create(){return Cn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((i,r)=>e=vie(e,i,r)),e=e.map(t.changes);let n=[];for(let i of t.effects)i.is(wD)&&!C6t(e,i.value.from,i.value.to)?n.push(i.value):i.is(oT)&&(e=e.update({filter:(r,s)=>i.value.from!=r||i.value.to!=s,filterFrom:i.value.from,filterTo:i.value.to}));if(n.length){let{preparePlaceholder:i}=t.state.facet(u3e),r=n.map(s=>(i?Cn.replace({widget:new I6t(i(t.state,s))}):xie).range(s.from,s.to));e=e.update({add:r})}return t.selection&&(e=vie(e,t.selection.main.head)),e},provide:e=>Xt.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(i,r)=>{n.push(i,r)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{rt&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(r,s)=>r>=n||s<=t}):e}function bR(e,t,n){var i;let r=null;return(i=e.field(Ny,!1))===null||i===void 0||i.between(t,n,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function C6t(e,t,n){let i=!1;return e.between(t,t,(r,s)=>{r==t&&s==n&&(i=!0)}),i}function l3e(e,t){return e.field(Ny,!1)?t:t.concat(Gn.appendConfig.of(d3e()))}const T6t=e=>{for(let t of a3e(e)){let n=gR(e.state,t.from,t.to);if(n)return e.dispatch({effects:l3e(e.state,[wD.of(n),c3e(e,n)])}),!0}return!1},A6t=e=>{if(!e.state.field(Ny,!1))return!1;let t=[];for(let n of a3e(e)){let i=bR(e.state,n.from,n.to);i&&t.push(oT.of(i),c3e(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function c3e(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Xt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const _6t=e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(Ny,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(i,r)=>{n.push(oT.of({from:i,to:r}))}),e.dispatch({effects:n}),!0},N6t=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:T6t},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:A6t},{key:"Ctrl-Alt-[",run:_6t},{key:"Ctrl-Alt-]",run:j6t}],R6t={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},u3e=an.define({combine(e){return Wf(e,R6t)}});function d3e(e){return[Ny,M6t]}function f3e(e,t){let{state:n}=e,i=n.facet(u3e),r=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),c=bR(e.state,l.from,l.to);c&&e.dispatch({effects:oT.of(c)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const xie=Cn.replace({widget:new class extends Qd{toDOM(e){return f3e(e,null)}}});class I6t extends Qd{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return f3e(t,this.value)}}const P6t={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class C3 extends gp{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function D6t(e={}){let t={...P6t,...e},n=new C3(t,!0),i=new C3(t,!1),r=Zs.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(vg)!=o.state.facet(vg)||o.startState.field(Ny,!1)!=o.state.field(Ny,!1)||Lr(o.startState)!=Lr(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new pp;for(let c of o.viewportLineBlocks){let u=bR(o.state,c.from,c.to)?i:gR(o.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[r,K$t({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||Di.empty},initialSpacer(){return new C3(t,!1)},domEventHandlers:{...s,click:(o,l,c)=>{if(s.click&&s.click(o,l,c))return!0;let u=bR(o.state,l.from,l.to);if(u)return o.dispatch({effects:oT.of(u)}),!0;let d=gR(o.state,l.from,l.to);return d?(o.dispatch({effects:wD.of(d)}),!0):!1}}}),d3e()]}const M6t=Xt.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class aT{constructor(t,n){this.specs=t;let i;function r(l){let c=gg.newName();return(i||(i=Object.create(null)))["."+c]=l,c}const s=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof qc?l=>l.prop(_m)==o.data:o?l=>l==o:void 0,this.style=t3e(t.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new gg(i):null,this.themeType=n.themeType}static define(t,n){return new aT(t,n||{})}}const hB=an.define(),h3e=an.define({combine(e){return e.length?[e[0]]:null}});function lj(e){let t=e.facet(hB);return t.length?t:e.facet(h3e)}function p3e(e,t){let n=[$6t],i;return e instanceof aT&&(e.module&&n.push(Xt.styleModule.of(e.module)),i=e.themeType),t!=null&&t.fallback?n.push(h3e.of(e)):i?n.push(hB.computeN([Xt.darkTheme],r=>r.facet(Xt.darkTheme)==(i=="dark")?[e]:[])):n.push(hB.of(e)),n}function Qan(e,t,n){let i=lj(e),r=null;if(i){for(let s of i)if(!s.scope||n){let o=s.style(t);o&&(r=r?r+" "+o:o)}}return r}class L6t{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,lj(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Lr(t.state),i=lj(t.state),r=i!=lj(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=s.to)}buildDeco(t,n){if(!n||!this.tree.length)return Cn.none;let i=new pp;for(let{from:r,to:s}of t.visibleRanges)c6t(this.tree,n,(o,l,c)=>{i.add(o,l,this.markCache[c]||(this.markCache[c]=Cn.mark({class:c})))},r,s);return i.finish()}}const $6t=Ap.high(Zs.fromClass(L6t,{decorations:e=>e.decorations})),F6t=aT.define([{tag:oe.meta,color:"#404740"},{tag:oe.link,textDecoration:"underline"},{tag:oe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:oe.emphasis,fontStyle:"italic"},{tag:oe.strong,fontWeight:"bold"},{tag:oe.strikethrough,textDecoration:"line-through"},{tag:oe.keyword,color:"#708"},{tag:[oe.atom,oe.bool,oe.url,oe.contentSeparator,oe.labelName],color:"#219"},{tag:[oe.literal,oe.inserted],color:"#164"},{tag:[oe.string,oe.deleted],color:"#a11"},{tag:[oe.regexp,oe.escape,oe.special(oe.string)],color:"#e40"},{tag:oe.definition(oe.variableName),color:"#00f"},{tag:oe.local(oe.variableName),color:"#30a"},{tag:[oe.typeName,oe.namespace],color:"#085"},{tag:oe.className,color:"#167"},{tag:[oe.special(oe.variableName),oe.macroName],color:"#256"},{tag:oe.definition(oe.propertyName),color:"#00c"},{tag:oe.comment,color:"#940"},{tag:oe.invalid,color:"#f00"}]),B6t=Xt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),m3e=1e4,g3e="()[]{}",b3e=an.define({combine(e){return Wf(e,{afterCursor:!0,brackets:g3e,maxScanDistance:m3e,renderMatch:z6t})}}),U6t=Cn.mark({class:"cm-matchingBracket"}),Q6t=Cn.mark({class:"cm-nonmatchingBracket"});function z6t(e){let t=[],n=e.matched?U6t:Q6t;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function wie(e){let t=[],n=e.facet(b3e);for(let i of e.selection.ranges){if(!i.empty)continue;let r=kf(e,i.head,-1,n)||i.head>0&&kf(e,i.head-1,1,n)||n.afterCursor&&(kf(e,i.head,1,n)||i.heade.decorations}),H6t=[V6t,B6t];function q6t(e={}){return[b3e.of(e),H6t]}const y3e=new Kn;function pB(e,t,n){let i=e.prop(t<0?Kn.openedBy:Kn.closedBy);if(i)return i;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function mB(e){let t=e.type.prop(y3e);return t?t(e.node):e}function kf(e,t,n,i={}){let r=i.maxScanDistance||m3e,s=i.brackets||g3e,o=Lr(e),l=o.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=pB(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return W6t(e,t,n,c,d,u,s)}}return K6t(e,t,n,o,l.type,r,s)}function W6t(e,t,n,i,r,s,o){let l=i.parent,c={from:r.from,to:r.to},u=0,d=l==null?void 0:l.cursor();if(d&&(n<0?d.childBefore(i.from):d.childAfter(i.to)))do if(n<0?d.to<=i.from:d.from>=i.to){if(u==0&&s.indexOf(d.type.name)>-1&&d.from0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let h=0;!d.next().done&&h<=s;){let m=d.value;n<0&&(h+=m.length);let g=t+h*n;for(let b=n>0?0:m.length-1,v=n>0?m.length:-1;b!=v;b+=n){let y=o.indexOf(m[b]);if(!(y<0||i.resolveInner(g+b,1).type!=r))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:y>>1==c>>1};f--}}n>0&&(h+=m.length)}return d.done?{start:u,matched:!1}:null}function Oie(e,t,n,i=0,r=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=r;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?o.toLowerCase():o,s=this.string.substr(this.pos,t.length);return r(s)==r(t)?(n!==!1&&(this.pos+=t.length),!0):null}else{let r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&n!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}function G6t(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||X6t,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||nH,mergeTokens:e.mergeTokens!==!1}}function X6t(e){if(typeof e!="object")return e;let t={};for(let n in e){let i=e[n];t[n]=i instanceof Array?i.slice():i}return t}const kie=new WeakMap;class eH extends qc{constructor(t){let n=vD(t.languageData),i=G6t(t),r,s=new class extends dD{createParse(o,l,c){return new Z6t(r,o,l,c)}};super(n,s,[],t.name),this.topNode=tFt(n,this),r=this,this.streamParser=i,this.stateAfter=new Kn({perNode:!0}),this.tokenTable=t.tokenTable?new k3e(i.tokenTable):eFt}static define(t){return new eH(t)}getIndent(t){let n,{overrideIndentation:i}=t.options;i&&(n=kie.get(t.state),n!=null&&n1e4)return null;for(;s=i&&n+t.length<=r&&t.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let l=t.children[o],c=n+t.positions[o],u=l instanceof Ci&&c=t.length)return t;!r&&n==0&&t.type==e.topNode&&(r=!0);for(let s=t.children.length-1;s>=0;s--){let o=t.positions[s],l=t.children[s],c;if(on&&tH(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=i&&(u=x3e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(r?jy(r):4),tree:Ci.empty}}let Z6t=class{constructor(t,n,i,r){this.lang=t,this.input=n,this.fragments=i,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let s=_y.get(),o=r[0].from,{state:l,tree:c}=Y6t(t,i,o,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=o+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(jy(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=_y.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(n,this.chunkStart+512);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos=n?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let n=this.input.chunk(t);if(this.input.lineChunks)n==` `&&(n="");else{let i=n.indexOf(` -`);i>-1&&(n=n.slice(0,i))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),i=t+n.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=i||(n=n.slice(0,s-(i-n.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);n+=l,i=o+l.length}return{line:n,end:i}}skipGapsTo(t,n,i){for(;;){let r=this.ranges[this.rangeIndex].to,s=t+n;if(i>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;n+=o-r}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(n,r,1),n+=r;let l=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==t&&this.chunk[o+2]==n?this.chunk[o+2]=i:this.chunk.push(t,n,i,s),r}parseLine(t){let{line:n,end:i}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new v3e(n,t?t.state.tabSize:4,t?jy(t.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=w3e(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPost.start)return r}throw new Error("Stream parser failed to advance stream.")}const nH=Object.create(null),AE=[Po.none],Y6t=new u1(AE),Sie=[],Eie=Object.create(null),O3e=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])O3e[e]=S3e(nH,t);class k3e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),O3e)}resolve(t){return t?this.table[t]||(this.table[t]=S3e(this.extra,t)):0}}const Z6t=new k3e(nH);function T3(e,t){Sie.indexOf(e)>-1||(Sie.push(e),console.warn(t))}function S3e(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||oe[u];d?typeof d=="function"?c.length?c=c.map(d):T3(u,`Modifier ${u} used at start of tag`):c.length?T3(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:T3(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map(l=>l.id),s=Eie[r];if(s)return s.id;let o=Eie[r]=Po.define({id:AE.length,name:i,props:[_p({[i]:n})]});return AE.push(o),o.id}function J6t(e,t){let n=Po.define({id:AE.length,name:"Document",props:[_m.add(()=>e),jp.add(()=>i=>t.getIndent(i))],top:!0});return AE.push(n),n}Qr.RTL,Qr.LTR;var Cie={};class yR{constructor(t,n,i,r,s,o,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=c,this.curContext=u,this.lookAhead=d,this.parent=f}toString(){return`[${this.stack.filter((t,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,n,i=0){let r=t.parser.context;return new yR(t,[],n,i,i,0,[],0,r?new Tie(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var n;let i=t>>19,r=t&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(r,u)}storeNode(t,n,i,r=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==i)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(t,n,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let c=o;c>0&&this.buffer[c-2]>i;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=t,this.buffer[o+1]=n,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(t,n,i,r){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=r,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,r,4);else{let s=t,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>i||n<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=o.maxNode&&this.buffer.push(n,i,r,4)}}apply(t,n,i,r){t&65536?this.reduce(t):this.shift(t,n,i,r)}useNode(t,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(n,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let i=t.buffer.slice(n),r=t.bufferBase+n;for(;t&&r==t.bufferBase;)t=t.parent;return new yR(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,n){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(t){for(let n=new eFt(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,t);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sc&1&&l==o)||r.push(n[s],o)}n=r}let i=[];for(let r=0;r>19,r=n&65535,s=this.stack.length-i*3;if(s<0||t.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:t}=this.p,n=[],i=(r,s)=>{if(!n.includes(r))return n.push(r),t.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let c=o&65535,u=this.stack.length-l*3;if(u>=0&&t.getGoto(this.stack[u],c,!1)>=0)return l<<19|65536|c}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class Tie{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class eFt{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let n=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class vR{constructor(t,n,i){this.stack=t,this.pos=n,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new vR(t,n,n-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new vR(this.stack,this.pos,this.index)}}function sk(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let i=0,r=0;i=92&&o--,o>=34&&o--;let c=o-32;if(c>=46&&(c-=46,l=!0),s+=c,l)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class cj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Aie=new cj;class tFt{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Aie,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(t,n){let i=this.range,r=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-i.to,i=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,n.from);return this.end}peek(t){let n=this.chunkOff+t,i,r;if(n>=0&&n=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(t,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,n){if(n?(this.token=n,n.start=t,n.lookAhead=t+1,n.value=n.extended=-1):this.token=Aie,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,n-this.chunkPos);if(t>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,n-this.chunk2Pos);if(t>=this.range.from&&n<=this.range.to)return this.input.read(t,n);let i="";for(let r of this.ranges){if(r.from>=n)break;r.to>t&&(i+=this.input.read(Math.max(r.from,t),Math.min(r.to,n)))}return i}}class xx{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:i}=n.p;E3e(this.data,t,n,this.id,i.data,i.tokenPrecTable)}}xx.prototype.contextual=xx.prototype.fallback=xx.prototype.extend=!1;class xR{constructor(t,n,i){this.precTable=n,this.elseToken=i,this.data=typeof t=="string"?sk(t):t}token(t,n){let i=t.pos,r=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(E3e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;t.reset(o,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}}xR.prototype.contextual=xx.prototype.fallback=xx.prototype.extend=!1;class yo{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function E3e(e,t,n,i,r,s){let o=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||nFt(g,t.token.value,r,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[o+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){o=e[u+h*3-1];continue e}for(;f>1,g=u+m+(m<<1),b=e[g],v=e[g+1]||65536;if(d=v)f=m+1;else{o=e[g+2],t.advance();continue e}}break}}function _ie(e,t,n){for(let i=t,r;(r=e[i])!=65535;i++)if(r==n)return i-t;return-1}function nFt(e,t,n,i){let r=_ie(n,i,t);return r<0||_ie(n,i,e)t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}let iFt=class{constructor(t,n){this.fragments=t,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?jie(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?jie(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof Ci){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}};class rFt{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new cj)}getActions(t){let n=0,i=null,{parser:r}=t.p,{tokenizers:s}=r,o=r.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,c=0;for(let u=0;uf.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(t,f.extended,f.end,n)),n=this.addActions(t,f.value,f.end,n),!d.extend&&(i=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return c&&t.setLookAhead(c),!i&&t.pos==this.stream.end&&(i=new cj,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,n=this.addActions(t,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let n=new cj,{pos:i,p:r}=t;return n.start=i,n.end=Math.min(i+1,r.stream.end),n.value=i==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(t,n,i){let r=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(r,t),i),t.value>-1){let{parser:s}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,n,i,r){for(let s=0;st.bufferLength*4?new iFt(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,n=this.minStackPos,i=this.stacks=[],r,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)i.push(l);else{if(this.advanceStack(l,i,t))continue;{r||(r=[],s=[]),r.push(l);let c=this.tokens.getMainToken(l);s.push(c.value,c.end)}}break}}if(!i.length){let o=r&&aFt(r);if(o)return Tc&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Tc&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(o)return Tc&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,c)=>c.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)i.splice(c--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,d=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(r);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(t.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(Kn.contextHash)||0)==d))return t.useNode(f,h),Tc&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Ci)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof Ci&&f.positions[0]==0)f=m;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Tc&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let c=this.tokens.getActions(t);for(let u=0;ur?n.push(g):i.push(g)}return!1}advanceFully(t,n){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Nie(t,n),!0}}runRecovery(t,n,i){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Tc&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),h=d;for(let m=0;m<10&&f.forceReduce()&&(Tc&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Tc&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))Tc&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),Tc&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),Nie(l,i)):(!r||r.scoree;class OD{constructor(t){this.start=t.start,this.shift=t.shift||_3,this.reduce=t.reduce||_3,this.reuse=t.reuse||_3,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class yp extends dD{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;lt.topRules[l][1]),r=[];for(let l=0;l=0)s(d,c,l[u++]);else{let f=l[u+-d];for(let h=-d;h>0;h--)s(l[u++],c,f);u++}}}this.nodeSet=new u1(n.map((l,c)=>Po.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:r[c],top:i.indexOf(c)>-1,error:c==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(c)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=kLe;let o=sk(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new xx(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,n,i){let r=new sFt(this,t,n,i);for(let s of this.wrappers)r=s(r,t,n,i);return r}getGoto(t,n,i=!1){let r=this.goto;if(n>=r[0])return-1;for(let s=r[n+1];;){let o=r[s++],l=o&1,c=r[s++];if(l&&i)return c;for(let u=s+(o>>1);s0}validAction(t,n){return!!this.allActions(t,i=>i==n?!0:null)}allActions(t,n){let i=this.stateSlot(t,4),r=i?n(i):void 0;for(let s=this.stateSlot(t,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Ch(this.data,s+2);else break;r=n(Ch(this.data,s+1))}return r}nextStates(t){let n=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Ch(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((s,o)=>o&1&&s==r)||n.push(this.data[i],r)}}return n}configure(t){let n=Object.assign(Object.create(yp.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);n.top=i}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let r=t.tokenizers.find(s=>s.from==i);return r?r.to:i})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,r)=>{let s=t.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=Rie(o),o})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let n=this.dynamicPrecedences;return n==null?0:n[t]||0}parseDialect(t){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(t)for(let s of t.split(" ")){let o=n.indexOf(s);o>=0&&(i[o]=!0)}let r=null;for(let s=0;si)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,i)<<1|t}return e.get}const lFt=316,cFt=317,Iie=1,uFt=2,dFt=3,fFt=4,hFt=318,pFt=320,mFt=321,gFt=5,bFt=6,yFt=0,gB=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],C3e=125,vFt=59,bB=47,xFt=42,wFt=43,OFt=45,kFt=60,SFt=44,EFt=63,CFt=46,TFt=91,AFt=new OD({start:!1,shift(e,t){return t==gFt||t==bFt||t==pFt?e:t==mFt},strict:!1}),_Ft=new yo((e,t)=>{let{next:n}=e;(n==C3e||n==-1||t.context)&&e.acceptToken(hFt)},{contextual:!0,fallback:!0}),jFt=new yo((e,t)=>{let{next:n}=e,i;gB.indexOf(n)>-1||n==bB&&((i=e.peek(1))==bB||i==xFt)||n!=C3e&&n!=vFt&&n!=-1&&!t.context&&e.acceptToken(lFt)},{contextual:!0}),NFt=new yo((e,t)=>{e.next==TFt&&!t.context&&e.acceptToken(cFt)},{contextual:!0}),RFt=new yo((e,t)=>{let{next:n}=e;if(n==wFt||n==OFt){if(e.advance(),n==e.next){e.advance();let i=!t.context&&t.canShift(Iie);e.acceptToken(i?Iie:uFt)}}else n==EFt&&e.peek(1)==CFt&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(dFt))},{contextual:!0});function j3(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const IFt=new yo((e,t)=>{if(e.next!=kFt||!t.dialectEnabled(yFt)||(e.advance(),e.next==bB))return;let n=0;for(;gB.indexOf(e.next)>-1;)e.advance(),n++;if(j3(e.next,!0)){for(e.advance(),n++;j3(e.next,!1);)e.advance(),n++;for(;gB.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==SFt)return;for(let i=0;;i++){if(i==7){if(!j3(e.next,!0))return;break}if(e.next!="extends".charCodeAt(i))break;e.advance(),n++}}e.acceptToken(fFt,-n)}),PFt=_p({"get set async static":oe.modifier,"for while do if else switch try catch finally return throw break continue default case defer":oe.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":oe.operatorKeyword,"let var const using function class extends":oe.definitionKeyword,"import export from":oe.moduleKeyword,"with debugger new":oe.keyword,TemplateString:oe.special(oe.string),super:oe.atom,BooleanLiteral:oe.bool,this:oe.self,null:oe.null,Star:oe.modifier,VariableName:oe.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":oe.function(oe.variableName),VariableDefinition:oe.definition(oe.variableName),Label:oe.labelName,PropertyName:oe.propertyName,PrivatePropertyName:oe.special(oe.propertyName),"CallExpression/MemberExpression/PropertyName":oe.function(oe.propertyName),"FunctionDeclaration/VariableDefinition":oe.function(oe.definition(oe.variableName)),"ClassDeclaration/VariableDefinition":oe.definition(oe.className),"NewExpression/VariableName":oe.className,PropertyDefinition:oe.definition(oe.propertyName),PrivatePropertyDefinition:oe.definition(oe.special(oe.propertyName)),UpdateOp:oe.updateOperator,"LineComment Hashbang":oe.lineComment,BlockComment:oe.blockComment,Number:oe.number,String:oe.string,Escape:oe.escape,ArithOp:oe.arithmeticOperator,LogicOp:oe.logicOperator,BitOp:oe.bitwiseOperator,CompareOp:oe.compareOperator,RegExp:oe.regexp,Equals:oe.definitionOperator,Arrow:oe.function(oe.punctuation),": Spread":oe.punctuation,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace,"InterpolationStart InterpolationEnd":oe.special(oe.brace),".":oe.derefOperator,", ;":oe.separator,"@":oe.meta,TypeName:oe.typeName,TypeDefinition:oe.definition(oe.typeName),"type enum interface implements namespace module declare":oe.definitionKeyword,"abstract global Privacy readonly override":oe.modifier,"is keyof unique infer asserts":oe.operatorKeyword,JSXAttributeValue:oe.attributeValue,JSXText:oe.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":oe.angleBracket,"JSXIdentifier JSXNameSpacedName":oe.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":oe.attributeName,"JSXBuiltin/JSXIdentifier":oe.standard(oe.tagName)}),DFt={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},MFt={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},LFt={__proto__:null,"<":193},$Ft=yp.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:AFt,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[PFt],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[jFt,NFt,RFt,IFt,2,3,4,5,6,7,8,9,10,11,12,13,14,_Ft,new xR("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new xR("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:e=>DFt[e]||-1},{term:343,get:e=>MFt[e]||-1},{term:95,get:e=>LFt[e]||-1}],tokenPrec:15201});class iH{constructor(t,n,i,r){this.state=t,this.pos=n,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=Lr(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),i=Math.max(n.from,this.pos-250),r=n.text.slice(i-n.from,this.pos-n.from),s=r.search(A3e(t,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,i){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Pie(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function FFt(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let s=1;stypeof r=="string"?{label:r}:r),[n,i]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:FFt(t);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:t,validFor:n}:null}}function T3e(e,t){return n=>{for(let i=Lr(n.state).resolveInner(n.pos,-1);i;i=i.parent){if(e.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return t(n)}}class Die{constructor(t,n,i,r){this.completion=t,this.source=n,this.match=i,this.score=r}}function iy(e){return e.selection.main.from}function A3e(e,t){var n;let{source:i}=e,r=t&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?e:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const sH=qf.define();function BFt(e,t,n,i){let{main:r}=e.selection,s=n-r.from,o=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,i))return{range:l};let c=e.toText(t);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:c},range:ut.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Mie=new WeakMap;function UFt(e){if(!Array.isArray(e))return e;let t=Mie.get(e);return t||Mie.set(e,t=rH(e)),t}const wR=Gn.define(),_E=Gn.define();class QFt{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=RV(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!x||C==1&&v||O==0&&C!=0)&&(n[f]==S||i[f]==S&&(h=!0)?o[f++]=x:o.length&&(y=!1)),O=C,x+=hf(S)}return f==c&&o[0]==0&&y?this.result(-100+(h?-200:0),o,t):m==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):m==c?this.ret(-900-t.length,[g,b]):f==c?this.result(-100+(h?-200:0)+-700+(y?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,i){let r=[],s=0;for(let o of n){let l=o+(this.astral?hf(Zl(i,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(t-i.length,r)}}class zFt{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:VFt,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>i=>Lie(t(i),n(i)),optionClass:(t,n)=>i=>Lie(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function Lie(e,t){return e?t?e+" "+t:e:t}function VFt(e,t,n,i,r,s){let o=e.textDirection==Qr.RTL,l=o,c=!1,u="top",d,f,h=t.left-r.left,m=r.right-t.right,g=i.right-i.left,b=i.bottom-i.top;if(l&&h=b||x>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let v=(t.bottom-t.top)/s.offsetHeight,y=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/v}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":l?"left":"right")}}const oH=Gn.define();function HFt(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),n.type&&i.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),t.push({render(n,i,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&o.appendChild(document.createTextNode(l.slice(c,d)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(d,f))),h.className="cm-completionMatchedText",c=f}return cn.position-i.position).map(n=>n.render)}function N3(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class qFt{constructor(t,n,i){this.view=t,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:s,selected:o}=r.open,l=t.state.facet(ma);this.optionContent=HFt(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=N3(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:oH.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ma).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:_E.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let i=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=r){let{options:s,selected:o,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=N3(s.length,o,t.state.facet(ma).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),l!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of n.split(" "))i&&this.dom.classList.add(i);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=N3(n.options.length,n.selected,this.view.state.facet(ma).maxRenderedOptions),this.showOptions(n.options,t.id));let i=this.updateSelectedOption(n.selected);if(i){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:s}=r;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(r);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,r)}).catch(l=>sc(this.view.state,l,"completion info")):(this.addInfoPane(o,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)i.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:s}=t;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),n=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return n&&KFt(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom{o.target==r&&o.preventDefault()});let s=null;for(let o=i.from;oi.from||i.from==0))if(s=h,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let m=r.appendChild(document.createElement("completion-section"));m.textContent=h}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let f=this.optionClass(l);f&&(d.className=f);for(let h of this.optionContent){let m=h(l,this.view.state,this.view,c);m&&d.appendChild(m)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.tonew qFt(n,e,t)}function KFt(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.topn.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/r)}function $ie(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function GFt(e,t){let n=[],i=null,r=null,s=d=>{n.push(d);let{section:f}=d.completion;if(f){i||(i=[]);let h=typeof f=="string"?f:f.name;i.some(m=>m.name==h)||i.push(typeof f=="string"?{name:h}:f)}},o=t.facet(ma);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let h of d.result.options)s(new Die(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=o.filterStrict?new zFt(h):new QFt(h);for(let b of d.result.options)if(m=g.match(b.label)){let v=b.displayLabel?f?f(b,m.matched):[]:m.matched,y=m.score+(b.boost||0);if(s(new Die(b,d.source,v,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:x}=b.section;r||(r=Object.create(null)),r[x]=Math.max(y,r[x]||-1e9)}}}}if(i){let d=Object.create(null),f=0,h=(m,g)=>(m.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(m.nameh.score-f.score||u(f.completion,h.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?l.push(d):$ie(d.completion)>$ie(c)&&(l[l.length-1]=d),c=d.completion}return l}class Uv{constructor(t,n,i,r,s,o){this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Uv(this.options,Fie(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,i,r,s,o){if(r&&!o&&t.some(u=>u.isPending))return r.setDisabled();let l=GFt(t,n);if(!l.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(ma).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;dd.hasResult()?Math.min(u,d.from):u,1e8),create:t8t,above:s.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new Uv(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Uv(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class OR{constructor(t,n,i){this.active=t,this.id=n,this.open=i}static start(){return new OR(JFt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,i=n.facet(ma),s=(i.override||n.languageDataAt("autocomplete",iy(n)).map(UFt)).map(c=>(this.active.find(d=>d.source==c)||new Lu(c,this.active.some(d=>d.state!=0)?1:0)).update(t,i));s.length==this.active.length&&s.every((c,u)=>c==this.active[u])&&(s=this.active);let o=this.open,l=t.effects.some(c=>c.is(aH));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!XFt(s,this.active)||l?o=Uv.build(s,n,this.id,o,i,l):o&&o.disabled&&!s.some(c=>c.isPending)&&(o=null),!o&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Lu(c.source,0):c));for(let c of t.effects)c.is(oH)&&(o=o&&o.setSelected(c.value,this.id));return s==this.active&&o==this.open?this:new OR(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?YFt:ZFt}}function XFt(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const JFt=[];function _3e(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(sH);if(i&&t.activateOnCompletion(i))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Lu{constructor(t,n,i=!1){this.source=t,this.state=n,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let i=_3e(t,n),r=this;(i&8||i&16&&this.touches(t))&&(r=new Lu(r.source,0)),i&4&&r.state==0&&(r=new Lu(this.source,1)),r=r.updateFor(t,i);for(let s of t.effects)if(s.is(wR))r=new Lu(r.source,1,s.value);else if(s.is(_E))r=new Lu(r.source,0);else if(s.is(aH))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(iy(t.state))}}class wx extends Lu{constructor(t,n,i,r,s,o){super(t,3,n),this.limit=i,this.result=r,this.from=s,this.to=o}hasResult(){return!0}updateFor(t,n){var i;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=iy(t.state);if(l>o||!r||n&2&&(iy(t.startState)==this.from||ln.map(t))}}),Jl=Qa.define({create(){return OR.start()},update(e,t){return e.update(t)},provide:e=>[GV.from(e,t=>t.tooltip),Xt.contentAttributes.from(e,t=>t.attrs)]});function lH(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(Jl).active.find(r=>r.source==t.source);return i instanceof wx?(typeof n=="string"?e.dispatch({...BFt(e.state,n,i.from,i.to),annotations:sH.of(t.completion)}):n(e,t.completion,i.from,i.to),!0):!1}const t8t=WFt(Jl,lH);function A2(e,t="option"){return n=>{let i=n.state.field(Jl,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(e?1:-1):e?0:o-1;return l<0?l=t=="page"?0:o-1:l>=o&&(l=t=="page"?o-1:0),n.dispatch({effects:oH.of(l)}),!0}}const n8t=e=>{let t=e.state.field(Jl,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Jl,!1)?(e.dispatch({effects:wR.of(!0)}),!0):!1,i8t=e=>{let t=e.state.field(Jl,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:_E.of(null)}),!0)};class r8t{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const s8t=50,o8t=1e3,a8t=Zs.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Jl).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Jl),n=e.state.facet(ma);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Jl)==t)return;let i=e.transactions.some(s=>{let o=_3e(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;ss8t&&Date.now()-o.time>o8t){for(let l of o.context.abortListeners)try{l()}catch(c){sc(this.view.state,c)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(o=>o.is(wR)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Jl);for(let n of t.active)n.isPending&&!this.running.some(i=>i.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=iy(t),i=new iH(t,n,e.explicit,this.view),r=new r8t(e,i);this.running.push(r),Promise.resolve(e.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:_E.of(null)}),sc(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ma),i=this.view.state.field(Jl);for(let r=0;rl.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new Lu(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:aH.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Jl,!1);if(t&&t.tooltip&&this.view.state.facet(ma).closeOnBlur){let n=t.open&&W5e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:_E.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wR.of(!1)}),20),this.composing=0}}}),l8t=typeof navigator=="object"&&/Win/.test(navigator.platform),c8t=Ap.highest(Xt.domEventHandlers({keydown(e,t){let n=t.state.field(Jl,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(l8t&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(o=>o.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&lH(t,i),!1}})),j3e=Xt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class u8t{constructor(t,n,i,r){this.field=t,this.line=n,this.from=i,this.to=r}}class cH{constructor(t,n,i){this.field=t,this.from=n,this.to=i}map(t){let n=t.mapPos(this.from,-1,Pa.TrackDel),i=t.mapPos(this.to,1,Pa.TrackDel);return n==null||i==null?null:new cH(this.field,n,i)}}class uH{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let i=[],r=[n],s=t.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(i.length){let u=o,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew cH(c.field,r[c.line]+c.from,r[c.line]+c.to));return{text:i,ranges:l}}static parse(t){let n=[],i=[],r=[],s;for(let o of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,c=s[2]||s[3]||"",u=-1;l===0&&(l=1e9);let d=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=u&&h.field++}for(let f of r)if(f.line==i.length&&f.from>s.index){let h=s[2]?3+(s[1]||"").length:2;f.from-=h,f.to-=h}r.push(new u8t(u,i.length,s.index,s.index+d.length)),o=o.slice(0,s.index)+c+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,c,u)=>{for(let d of r)d.line==i.length&&d.from>u&&(d.from--,d.to--);return c}),i.push(o)}return new uH(i,r)}}let d8t=Cn.widget({widget:new class extends Qd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),f8t=Cn.mark({class:"cm-snippetField"});class h1{constructor(t,n){this.ranges=t,this.active=n,this.deco=Cn.set(t.map(i=>(i.from==i.to?d8t:f8t).range(i.from,i.to)),!0)}map(t){let n=[];for(let i of this.ranges){let r=i.map(t);if(!r)return null;n.push(r)}return new h1(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(i=>i.field==this.active&&i.from<=n.from&&i.to>=n.to))}}const lT=Gn.define({map(e,t){return e&&e.map(t)}}),h8t=Gn.define(),jE=Qa.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(lT))return n.value;if(n.is(h8t)&&e)return new h1(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Xt.decorations.from(e,t=>t?t.deco:Cn.none)});function dH(e,t){return ut.create(e.filter(n=>n.field==t).map(n=>ut.range(n.from,n.to)))}function p8t(e){let t=uH.parse(e);return(n,i,r,s)=>{let{text:o,ranges:l}=t.instantiate(n.state,r),{main:c}=n.state.selection,u={changes:{from:r,to:s==c.from?c.to:s,insert:sr.of(o)},scrollIntoView:!0,annotations:i?[sH.of(i),Ro.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=dH(l,0)),l.some(d=>d.field>0)){let d=new h1(l,0),f=u.effects=[lT.of(d)];n.state.field(jE,!1)===void 0&&f.push(Gn.appendConfig.of([jE,v8t,x8t,j3e]))}n.dispatch(n.state.update(u))}}function N3e(e){return({state:t,dispatch:n})=>{let i=t.field(jE,!1);if(!i||e<0&&i.active==0)return!1;let r=i.active+e,s=e>0&&!i.ranges.some(o=>o.field==r+e);return n(t.update({selection:dH(i.ranges,r),effects:lT.of(s?null:new h1(i.ranges,r)),scrollIntoView:!0})),!0}}const m8t=({state:e,dispatch:t})=>e.field(jE,!1)?(t(e.update({effects:lT.of(null)})),!0):!1,g8t=N3e(1),b8t=N3e(-1),y8t=[{key:"Tab",run:g8t,shift:b8t},{key:"Escape",run:m8t}],Bie=an.define({combine(e){return e.length?e[0]:y8t}}),v8t=Ap.highest(d1.compute([Bie],e=>e.facet(Bie)));function Ms(e,t){return{...t,apply:p8t(e)}}const x8t=Xt.domEventHandlers({mousedown(e,t){let n=t.state.field(jE,!1),i;if(!n||(i=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let r=n.ranges.find(s=>s.from<=i&&s.to>=i);return!r||r.field==n.active?!1:(t.dispatch({selection:dH(n.ranges,r.field),effects:lT.of(n.ranges.some(s=>s.field>r.field)?new h1(n.ranges,r.field):null),scrollIntoView:!0}),!0)}}),NE={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fb=Gn.define({map(e,t){let n=t.mapPos(e,-1,Pa.TrackAfter);return n??void 0}}),fH=new class extends mg{};fH.startSide=1;fH.endSide=-1;const R3e=Qa.define({create(){return Di.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:i=>i>=n.from&&i<=n.to})}for(let n of t.effects)n.is(Fb)&&(e=e.update({add:[fH.range(n.value,n.value+1)]}));return e}});function w8t(){return[k8t,R3e]}const I3="()[]{}<>«»»«[]{}";function I3e(e){for(let t=0;t{if((O8t?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||i.length==2&&hf(Zl(i,0))==1||t!=r.from||n!=r.to)return!1;let s=C8t(e.state,i);return s?(e.dispatch(s),!0):!1}),S8t=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=P3e(e,e.selection.main.head).brackets||NE.brackets,r=null,s=e.changeByRange(o=>{if(o.empty){let l=T8t(e.doc,o.head);for(let c of i)if(c==l&&kD(e.doc,o.head)==I3e(Zl(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:ut.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},E8t=[{key:"Backspace",run:S8t}];function C8t(e,t){let n=P3e(e,e.selection.main.head),i=n.brackets||NE.brackets;for(let r of i){let s=I3e(Zl(r,0));if(t==r)return s==r?j8t(e,r,i.indexOf(r+r+r)>-1,n):A8t(e,r,s,n.before||NE.before);if(t==s&&D3e(e,e.selection.main.from))return _8t(e,r,s)}return null}function D3e(e,t){let n=!1;return e.field(R3e).between(0,e.doc.length,i=>{i==t&&(n=!0)}),n}function kD(e,t){let n=e.sliceString(t,t+2);return n.slice(0,hf(Zl(n,0)))}function T8t(e,t){let n=e.sliceString(t-2,t);return hf(Zl(n,0))==n.length?n:n.slice(1)}function A8t(e,t,n,i){let r=null,s=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Fb.of(o.to+t.length),range:ut.range(o.anchor+t.length,o.head+t.length)};let l=kD(e.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:t+n,from:o.head},effects:Fb.of(o.head+t.length),range:ut.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function _8t(e,t,n){let i=null,r=e.changeByRange(s=>s.empty&&kD(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:ut.cursor(s.head+n.length)}:i={range:s});return i?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function j8t(e,t,n,i){let r=i.stringPrefixes||NE.stringPrefixes,s=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Fb.of(l.to+t.length),range:ut.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=kD(e.doc,c),d;if(u==t){if(Uie(e,c))return{changes:{insert:t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)};if(D3e(e,c)){let h=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+h.length,insert:h},range:ut.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=Qie(e,c-2*t.length,r))>-1&&Uie(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ts.Word&&Qie(e,c,r)>-1&&!N8t(e,c,t,r))return{changes:{insert:t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Uie(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function N8t(e,t,n,i){let r=Lr(e).resolveInner(t,-1),s=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),c=l.indexOf(n);if(!c||c>-1&&i.indexOf(l.slice(0,c))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function Qie(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=Ts.Word)return t;for(let r of n){let s=t-r.length;if(e.sliceDoc(s,t)==r&&i(e.sliceDoc(s-1,s))!=Ts.Word)return s}return-1}function R8t(e={}){return[c8t,Jl,ma.of(e),a8t,I8t,j3e]}const M3e=[{key:"Ctrl-Space",run:R3},{mac:"Alt-`",run:R3},{mac:"Alt-i",run:R3},{key:"Escape",run:i8t},{key:"ArrowDown",run:A2(!0)},{key:"ArrowUp",run:A2(!1)},{key:"PageDown",run:A2(!0,"page")},{key:"PageUp",run:A2(!1,"page")},{key:"Enter",run:n8t}],I8t=Ap.highest(d1.computeN([ma],e=>e.facet(ma).defaultKeymap?[M3e]:[])),L3e=[Ms("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Ms("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Ms("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Ms("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Ms("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Ms(`try { +`);i>-1&&(n=n.slice(0,i))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),i=t+n.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=i||(n=n.slice(0,s-(i-n.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);n+=l,i=o+l.length}return{line:n,end:i}}skipGapsTo(t,n,i){for(;;){let r=this.ranges[this.rangeIndex].to,s=t+n;if(i>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;n+=o-r}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(n,r,1),n+=r;let l=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==t&&this.chunk[o+2]==n?this.chunk[o+2]=i:this.chunk.push(t,n,i,s),r}parseLine(t){let{line:n,end:i}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new v3e(n,t?t.state.tabSize:4,t?jy(t.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=w3e(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPost.start)return r}throw new Error("Stream parser failed to advance stream.")}const nH=Object.create(null),AE=[Po.none],J6t=new u1(AE),Sie=[],Eie=Object.create(null),O3e=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])O3e[e]=S3e(nH,t);class k3e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),O3e)}resolve(t){return t?this.table[t]||(this.table[t]=S3e(this.extra,t)):0}}const eFt=new k3e(nH);function T3(e,t){Sie.indexOf(e)>-1||(Sie.push(e),console.warn(t))}function S3e(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||oe[u];d?typeof d=="function"?c.length?c=c.map(d):T3(u,`Modifier ${u} used at start of tag`):c.length?T3(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:T3(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map(l=>l.id),s=Eie[r];if(s)return s.id;let o=Eie[r]=Po.define({id:AE.length,name:i,props:[_p({[i]:n})]});return AE.push(o),o.id}function tFt(e,t){let n=Po.define({id:AE.length,name:"Document",props:[_m.add(()=>e),jp.add(()=>i=>t.getIndent(i))],top:!0});return AE.push(n),n}Qr.RTL,Qr.LTR;var Cie={};class yR{constructor(t,n,i,r,s,o,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=c,this.curContext=u,this.lookAhead=d,this.parent=f}toString(){return`[${this.stack.filter((t,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,n,i=0){let r=t.parser.context;return new yR(t,[],n,i,i,0,[],0,r?new Tie(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var n;let i=t>>19,r=t&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(r,u)}storeNode(t,n,i,r=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==i)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(t,n,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let c=o;c>0&&this.buffer[c-2]>i;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=t,this.buffer[o+1]=n,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(t,n,i,r){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=r,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,r,4);else{let s=t,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>i||n<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=o.maxNode&&this.buffer.push(n,i,r,4)}}apply(t,n,i,r){t&65536?this.reduce(t):this.shift(t,n,i,r)}useNode(t,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let r=this.pos;this.reducePos=this.pos=r+t.length,this.pushState(n,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let i=t.buffer.slice(n),r=t.bufferBase+n;for(;t&&r==t.bufferBase;)t=t.parent;return new yR(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,t)}recoverByDelete(t,n){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(t){for(let n=new nFt(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,t);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sc&1&&l==o)||r.push(n[s],o)}n=r}let i=[];for(let r=0;r>19,r=n&65535,s=this.stack.length-i*3;if(s<0||t.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:t}=this.p,n=[],i=(r,s)=>{if(!n.includes(r))return n.push(r),t.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let c=o&65535,u=this.stack.length-l*3;if(u>=0&&t.getGoto(this.stack[u],c,!1)>=0)return l<<19|65536|c}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class Tie{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class nFt{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let n=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class vR{constructor(t,n,i){this.stack=t,this.pos=n,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new vR(t,n,n-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new vR(this.stack,this.pos,this.index)}}function sk(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let i=0,r=0;i=92&&o--,o>=34&&o--;let c=o-32;if(c>=46&&(c-=46,l=!0),s+=c,l)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class cj{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Aie=new cj;class iFt{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Aie,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(t,n){let i=this.range,r=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-i.to,i=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,n.from);return this.end}peek(t){let n=this.chunkOff+t,i,r;if(n>=0&&n=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(t,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,n){if(n?(this.token=n,n.start=t,n.lookAhead=t+1,n.value=n.extended=-1):this.token=Aie,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,n-this.chunkPos);if(t>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,n-this.chunk2Pos);if(t>=this.range.from&&n<=this.range.to)return this.input.read(t,n);let i="";for(let r of this.ranges){if(r.from>=n)break;r.to>t&&(i+=this.input.read(Math.max(r.from,t),Math.min(r.to,n)))}return i}}class xx{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:i}=n.p;E3e(this.data,t,n,this.id,i.data,i.tokenPrecTable)}}xx.prototype.contextual=xx.prototype.fallback=xx.prototype.extend=!1;class xR{constructor(t,n,i){this.precTable=n,this.elseToken=i,this.data=typeof t=="string"?sk(t):t}token(t,n){let i=t.pos,r=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(E3e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;t.reset(o,t.token)}r&&(t.reset(i,t.token),t.acceptToken(this.elseToken,r))}}xR.prototype.contextual=xx.prototype.fallback=xx.prototype.extend=!1;class yo{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function E3e(e,t,n,i,r,s){let o=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||rFt(g,t.token.value,r,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[o+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){o=e[u+h*3-1];continue e}for(;f>1,g=u+m+(m<<1),b=e[g],v=e[g+1]||65536;if(d=v)f=m+1;else{o=e[g+2],t.advance();continue e}}break}}function _ie(e,t,n){for(let i=t,r;(r=e[i])!=65535;i++)if(r==n)return i-t;return-1}function rFt(e,t,n,i){let r=_ie(n,i,t);return r<0||_ie(n,i,e)t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}let sFt=class{constructor(t,n){this.fragments=t,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?jie(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?jie(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof Ci){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}};class oFt{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new cj)}getActions(t){let n=0,i=null,{parser:r}=t.p,{tokenizers:s}=r,o=r.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,c=0;for(let u=0;uf.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(t,f.extended,f.end,n)),n=this.addActions(t,f.value,f.end,n),!d.extend&&(i=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return c&&t.setLookAhead(c),!i&&t.pos==this.stream.end&&(i=new cj,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,n=this.addActions(t,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let n=new cj,{pos:i,p:r}=t;return n.start=i,n.end=Math.min(i+1,r.stream.end),n.value=i==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(t,n,i){let r=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(r,t),i),t.value>-1){let{parser:s}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(r+1)}putAction(t,n,i,r){for(let s=0;st.bufferLength*4?new sFt(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,n=this.minStackPos,i=this.stacks=[],r,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)i.push(l);else{if(this.advanceStack(l,i,t))continue;{r||(r=[],s=[]),r.push(l);let c=this.tokens.getMainToken(l);s.push(c.value,c.end)}}break}}if(!i.length){let o=r&&cFt(r);if(o)return Tc&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Tc&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(o)return Tc&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,c)=>c.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)i.splice(c--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,d=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(r);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(t.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(Kn.contextHash)||0)==d))return t.useNode(f,h),Tc&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Ci)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof Ci&&f.positions[0]==0)f=m;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Tc&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let c=this.tokens.getActions(t);for(let u=0;ur?n.push(g):i.push(g)}return!1}advanceFully(t,n){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Nie(t,n),!0}}runRecovery(t,n,i){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Tc&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),h=d;for(let m=0;m<10&&f.forceReduce()&&(Tc&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Tc&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))Tc&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),Tc&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),Nie(l,i)):(!r||r.scoree;class OD{constructor(t){this.start=t.start,this.shift=t.shift||_3,this.reduce=t.reduce||_3,this.reuse=t.reuse||_3,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class yp extends dD{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;lt.topRules[l][1]),r=[];for(let l=0;l=0)s(d,c,l[u++]);else{let f=l[u+-d];for(let h=-d;h>0;h--)s(l[u++],c,f);u++}}}this.nodeSet=new u1(n.map((l,c)=>Po.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:r[c],top:i.indexOf(c)>-1,error:c==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(c)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=kLe;let o=sk(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new xx(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,n,i){let r=new aFt(this,t,n,i);for(let s of this.wrappers)r=s(r,t,n,i);return r}getGoto(t,n,i=!1){let r=this.goto;if(n>=r[0])return-1;for(let s=r[n+1];;){let o=r[s++],l=o&1,c=r[s++];if(l&&i)return c;for(let u=s+(o>>1);s0}validAction(t,n){return!!this.allActions(t,i=>i==n?!0:null)}allActions(t,n){let i=this.stateSlot(t,4),r=i?n(i):void 0;for(let s=this.stateSlot(t,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Ch(this.data,s+2);else break;r=n(Ch(this.data,s+1))}return r}nextStates(t){let n=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Ch(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((s,o)=>o&1&&s==r)||n.push(this.data[i],r)}}return n}configure(t){let n=Object.assign(Object.create(yp.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);n.top=i}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let r=t.tokenizers.find(s=>s.from==i);return r?r.to:i})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,r)=>{let s=t.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=Rie(o),o})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let n=this.dynamicPrecedences;return n==null?0:n[t]||0}parseDialect(t){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(t)for(let s of t.split(" ")){let o=n.indexOf(s);o>=0&&(i[o]=!0)}let r=null;for(let s=0;si)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,i)<<1|t}return e.get}const uFt=316,dFt=317,Iie=1,fFt=2,hFt=3,pFt=4,mFt=318,gFt=320,bFt=321,yFt=5,vFt=6,xFt=0,gB=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],C3e=125,wFt=59,bB=47,OFt=42,kFt=43,SFt=45,EFt=60,CFt=44,TFt=63,AFt=46,_Ft=91,jFt=new OD({start:!1,shift(e,t){return t==yFt||t==vFt||t==gFt?e:t==bFt},strict:!1}),NFt=new yo((e,t)=>{let{next:n}=e;(n==C3e||n==-1||t.context)&&e.acceptToken(mFt)},{contextual:!0,fallback:!0}),RFt=new yo((e,t)=>{let{next:n}=e,i;gB.indexOf(n)>-1||n==bB&&((i=e.peek(1))==bB||i==OFt)||n!=C3e&&n!=wFt&&n!=-1&&!t.context&&e.acceptToken(uFt)},{contextual:!0}),IFt=new yo((e,t)=>{e.next==_Ft&&!t.context&&e.acceptToken(dFt)},{contextual:!0}),PFt=new yo((e,t)=>{let{next:n}=e;if(n==kFt||n==SFt){if(e.advance(),n==e.next){e.advance();let i=!t.context&&t.canShift(Iie);e.acceptToken(i?Iie:fFt)}}else n==TFt&&e.peek(1)==AFt&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(hFt))},{contextual:!0});function j3(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const DFt=new yo((e,t)=>{if(e.next!=EFt||!t.dialectEnabled(xFt)||(e.advance(),e.next==bB))return;let n=0;for(;gB.indexOf(e.next)>-1;)e.advance(),n++;if(j3(e.next,!0)){for(e.advance(),n++;j3(e.next,!1);)e.advance(),n++;for(;gB.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==CFt)return;for(let i=0;;i++){if(i==7){if(!j3(e.next,!0))return;break}if(e.next!="extends".charCodeAt(i))break;e.advance(),n++}}e.acceptToken(pFt,-n)}),MFt=_p({"get set async static":oe.modifier,"for while do if else switch try catch finally return throw break continue default case defer":oe.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":oe.operatorKeyword,"let var const using function class extends":oe.definitionKeyword,"import export from":oe.moduleKeyword,"with debugger new":oe.keyword,TemplateString:oe.special(oe.string),super:oe.atom,BooleanLiteral:oe.bool,this:oe.self,null:oe.null,Star:oe.modifier,VariableName:oe.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":oe.function(oe.variableName),VariableDefinition:oe.definition(oe.variableName),Label:oe.labelName,PropertyName:oe.propertyName,PrivatePropertyName:oe.special(oe.propertyName),"CallExpression/MemberExpression/PropertyName":oe.function(oe.propertyName),"FunctionDeclaration/VariableDefinition":oe.function(oe.definition(oe.variableName)),"ClassDeclaration/VariableDefinition":oe.definition(oe.className),"NewExpression/VariableName":oe.className,PropertyDefinition:oe.definition(oe.propertyName),PrivatePropertyDefinition:oe.definition(oe.special(oe.propertyName)),UpdateOp:oe.updateOperator,"LineComment Hashbang":oe.lineComment,BlockComment:oe.blockComment,Number:oe.number,String:oe.string,Escape:oe.escape,ArithOp:oe.arithmeticOperator,LogicOp:oe.logicOperator,BitOp:oe.bitwiseOperator,CompareOp:oe.compareOperator,RegExp:oe.regexp,Equals:oe.definitionOperator,Arrow:oe.function(oe.punctuation),": Spread":oe.punctuation,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace,"InterpolationStart InterpolationEnd":oe.special(oe.brace),".":oe.derefOperator,", ;":oe.separator,"@":oe.meta,TypeName:oe.typeName,TypeDefinition:oe.definition(oe.typeName),"type enum interface implements namespace module declare":oe.definitionKeyword,"abstract global Privacy readonly override":oe.modifier,"is keyof unique infer asserts":oe.operatorKeyword,JSXAttributeValue:oe.attributeValue,JSXText:oe.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":oe.angleBracket,"JSXIdentifier JSXNameSpacedName":oe.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":oe.attributeName,"JSXBuiltin/JSXIdentifier":oe.standard(oe.tagName)}),LFt={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},$Ft={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},FFt={__proto__:null,"<":193},BFt=yp.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:jFt,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[MFt],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[RFt,IFt,PFt,DFt,2,3,4,5,6,7,8,9,10,11,12,13,14,NFt,new xR("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new xR("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:e=>LFt[e]||-1},{term:343,get:e=>$Ft[e]||-1},{term:95,get:e=>FFt[e]||-1}],tokenPrec:15201});class iH{constructor(t,n,i,r){this.state=t,this.pos=n,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=Lr(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),i=Math.max(n.from,this.pos-250),r=n.text.slice(i-n.from,this.pos-n.from),s=r.search(A3e(t,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,i){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Pie(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function UFt(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let s=1;stypeof r=="string"?{label:r}:r),[n,i]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:UFt(t);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:t,validFor:n}:null}}function T3e(e,t){return n=>{for(let i=Lr(n.state).resolveInner(n.pos,-1);i;i=i.parent){if(e.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return t(n)}}class Die{constructor(t,n,i,r){this.completion=t,this.source=n,this.match=i,this.score=r}}function iy(e){return e.selection.main.from}function A3e(e,t){var n;let{source:i}=e,r=t&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?e:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const sH=qf.define();function QFt(e,t,n,i){let{main:r}=e.selection,s=n-r.from,o=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,i))return{range:l};let c=e.toText(t);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:c},range:ut.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Mie=new WeakMap;function zFt(e){if(!Array.isArray(e))return e;let t=Mie.get(e);return t||Mie.set(e,t=rH(e)),t}const wR=Gn.define(),_E=Gn.define();class VFt{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=RV(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!x||C==1&&v||O==0&&C!=0)&&(n[f]==S||i[f]==S&&(h=!0)?o[f++]=x:o.length&&(y=!1)),O=C,x+=hf(S)}return f==c&&o[0]==0&&y?this.result(-100+(h?-200:0),o,t):m==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):m==c?this.ret(-900-t.length,[g,b]):f==c?this.result(-100+(h?-200:0)+-700+(y?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,i){let r=[],s=0;for(let o of n){let l=o+(this.astral?hf(Zl(i,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(t-i.length,r)}}class HFt{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qFt,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>i=>Lie(t(i),n(i)),optionClass:(t,n)=>i=>Lie(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function Lie(e,t){return e?t?e+" "+t:e:t}function qFt(e,t,n,i,r,s){let o=e.textDirection==Qr.RTL,l=o,c=!1,u="top",d,f,h=t.left-r.left,m=r.right-t.right,g=i.right-i.left,b=i.bottom-i.top;if(l&&h=b||x>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let v=(t.bottom-t.top)/s.offsetHeight,y=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/v}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":l?"left":"right")}}const oH=Gn.define();function WFt(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),n.type&&i.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),t.push({render(n,i,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&o.appendChild(document.createTextNode(l.slice(c,d)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(d,f))),h.className="cm-completionMatchedText",c=f}return cn.position-i.position).map(n=>n.render)}function N3(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class KFt{constructor(t,n,i){this.view=t,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:s,selected:o}=r.open,l=t.state.facet(ma);this.optionContent=WFt(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=N3(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:oH.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ma).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:_E.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let i=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=r){let{options:s,selected:o,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=N3(s.length,o,t.state.facet(ma).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),l!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of n.split(" "))i&&this.dom.classList.add(i);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=N3(n.options.length,n.selected,this.view.state.facet(ma).maxRenderedOptions),this.showOptions(n.options,t.id));let i=this.updateSelectedOption(n.selected);if(i){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:s}=r;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(r);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,r)}).catch(l=>sc(this.view.state,l,"completion info")):(this.addInfoPane(o,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)i.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:s}=t;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),n=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return n&&XFt(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom{o.target==r&&o.preventDefault()});let s=null;for(let o=i.from;oi.from||i.from==0))if(s=h,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let m=r.appendChild(document.createElement("completion-section"));m.textContent=h}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let f=this.optionClass(l);f&&(d.className=f);for(let h of this.optionContent){let m=h(l,this.view.state,this.view,c);m&&d.appendChild(m)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.tonew KFt(n,e,t)}function XFt(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.topn.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/r)}function $ie(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function YFt(e,t){let n=[],i=null,r=null,s=d=>{n.push(d);let{section:f}=d.completion;if(f){i||(i=[]);let h=typeof f=="string"?f:f.name;i.some(m=>m.name==h)||i.push(typeof f=="string"?{name:h}:f)}},o=t.facet(ma);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let h of d.result.options)s(new Die(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=o.filterStrict?new HFt(h):new VFt(h);for(let b of d.result.options)if(m=g.match(b.label)){let v=b.displayLabel?f?f(b,m.matched):[]:m.matched,y=m.score+(b.boost||0);if(s(new Die(b,d.source,v,y)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:x}=b.section;r||(r=Object.create(null)),r[x]=Math.max(y,r[x]||-1e9)}}}}if(i){let d=Object.create(null),f=0,h=(m,g)=>(m.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(m.nameh.score-f.score||u(f.completion,h.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?l.push(d):$ie(d.completion)>$ie(c)&&(l[l.length-1]=d),c=d.completion}return l}class Uv{constructor(t,n,i,r,s,o){this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Uv(this.options,Fie(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,i,r,s,o){if(r&&!o&&t.some(u=>u.isPending))return r.setDisabled();let l=YFt(t,n);if(!l.length)return r&&t.some(u=>u.isPending)?r.setDisabled():null;let c=n.facet(ma).selectOnOpen?0:-1;if(r&&r.selected!=c&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;dd.hasResult()?Math.min(u,d.from):u,1e8),create:i8t,above:s.aboveCursor},r?r.timestamp:Date.now(),c,!1)}map(t){return new Uv(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Uv(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class OR{constructor(t,n,i){this.active=t,this.id=n,this.open=i}static start(){return new OR(t8t,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,i=n.facet(ma),s=(i.override||n.languageDataAt("autocomplete",iy(n)).map(zFt)).map(c=>(this.active.find(d=>d.source==c)||new Lu(c,this.active.some(d=>d.state!=0)?1:0)).update(t,i));s.length==this.active.length&&s.every((c,u)=>c==this.active[u])&&(s=this.active);let o=this.open,l=t.effects.some(c=>c.is(aH));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!ZFt(s,this.active)||l?o=Uv.build(s,n,this.id,o,i,l):o&&o.disabled&&!s.some(c=>c.isPending)&&(o=null),!o&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Lu(c.source,0):c));for(let c of t.effects)c.is(oH)&&(o=o&&o.setSelected(c.value,this.id));return s==this.active&&o==this.open?this:new OR(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?JFt:e8t}}function ZFt(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const t8t=[];function _3e(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(sH);if(i&&t.activateOnCompletion(i))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Lu{constructor(t,n,i=!1){this.source=t,this.state=n,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let i=_3e(t,n),r=this;(i&8||i&16&&this.touches(t))&&(r=new Lu(r.source,0)),i&4&&r.state==0&&(r=new Lu(this.source,1)),r=r.updateFor(t,i);for(let s of t.effects)if(s.is(wR))r=new Lu(r.source,1,s.value);else if(s.is(_E))r=new Lu(r.source,0);else if(s.is(aH))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(iy(t.state))}}class wx extends Lu{constructor(t,n,i,r,s,o){super(t,3,n),this.limit=i,this.result=r,this.from=s,this.to=o}hasResult(){return!0}updateFor(t,n){var i;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=iy(t.state);if(l>o||!r||n&2&&(iy(t.startState)==this.from||ln.map(t))}}),Jl=Qa.define({create(){return OR.start()},update(e,t){return e.update(t)},provide:e=>[GV.from(e,t=>t.tooltip),Xt.contentAttributes.from(e,t=>t.attrs)]});function lH(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(Jl).active.find(r=>r.source==t.source);return i instanceof wx?(typeof n=="string"?e.dispatch({...QFt(e.state,n,i.from,i.to),annotations:sH.of(t.completion)}):n(e,t.completion,i.from,i.to),!0):!1}const i8t=GFt(Jl,lH);function A2(e,t="option"){return n=>{let i=n.state.field(Jl,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(e?1:-1):e?0:o-1;return l<0?l=t=="page"?0:o-1:l>=o&&(l=t=="page"?o-1:0),n.dispatch({effects:oH.of(l)}),!0}}const r8t=e=>{let t=e.state.field(Jl,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Jl,!1)?(e.dispatch({effects:wR.of(!0)}),!0):!1,s8t=e=>{let t=e.state.field(Jl,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:_E.of(null)}),!0)};class o8t{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const a8t=50,l8t=1e3,c8t=Zs.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Jl).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Jl),n=e.state.facet(ma);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Jl)==t)return;let i=e.transactions.some(s=>{let o=_3e(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;sa8t&&Date.now()-o.time>l8t){for(let l of o.context.abortListeners)try{l()}catch(c){sc(this.view.state,c)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(o=>o.is(wR)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Jl);for(let n of t.active)n.isPending&&!this.running.some(i=>i.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=iy(t),i=new iH(t,n,e.explicit,this.view),r=new o8t(e,i);this.running.push(r),Promise.resolve(e.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:_E.of(null)}),sc(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ma),i=this.view.state.field(Jl);for(let r=0;rl.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new Lu(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:aH.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Jl,!1);if(t&&t.tooltip&&this.view.state.facet(ma).closeOnBlur){let n=t.open&&W5e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:_E.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:wR.of(!1)}),20),this.composing=0}}}),u8t=typeof navigator=="object"&&/Win/.test(navigator.platform),d8t=Ap.highest(Xt.domEventHandlers({keydown(e,t){let n=t.state.field(Jl,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(u8t&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(o=>o.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&lH(t,i),!1}})),j3e=Xt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class f8t{constructor(t,n,i,r){this.field=t,this.line=n,this.from=i,this.to=r}}class cH{constructor(t,n,i){this.field=t,this.from=n,this.to=i}map(t){let n=t.mapPos(this.from,-1,Pa.TrackDel),i=t.mapPos(this.to,1,Pa.TrackDel);return n==null||i==null?null:new cH(this.field,n,i)}}class uH{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let i=[],r=[n],s=t.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(i.length){let u=o,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew cH(c.field,r[c.line]+c.from,r[c.line]+c.to));return{text:i,ranges:l}}static parse(t){let n=[],i=[],r=[],s;for(let o of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,c=s[2]||s[3]||"",u=-1;l===0&&(l=1e9);let d=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=u&&h.field++}for(let f of r)if(f.line==i.length&&f.from>s.index){let h=s[2]?3+(s[1]||"").length:2;f.from-=h,f.to-=h}r.push(new f8t(u,i.length,s.index,s.index+d.length)),o=o.slice(0,s.index)+c+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,c,u)=>{for(let d of r)d.line==i.length&&d.from>u&&(d.from--,d.to--);return c}),i.push(o)}return new uH(i,r)}}let h8t=Cn.widget({widget:new class extends Qd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),p8t=Cn.mark({class:"cm-snippetField"});class h1{constructor(t,n){this.ranges=t,this.active=n,this.deco=Cn.set(t.map(i=>(i.from==i.to?h8t:p8t).range(i.from,i.to)),!0)}map(t){let n=[];for(let i of this.ranges){let r=i.map(t);if(!r)return null;n.push(r)}return new h1(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(i=>i.field==this.active&&i.from<=n.from&&i.to>=n.to))}}const lT=Gn.define({map(e,t){return e&&e.map(t)}}),m8t=Gn.define(),jE=Qa.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(lT))return n.value;if(n.is(m8t)&&e)return new h1(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Xt.decorations.from(e,t=>t?t.deco:Cn.none)});function dH(e,t){return ut.create(e.filter(n=>n.field==t).map(n=>ut.range(n.from,n.to)))}function g8t(e){let t=uH.parse(e);return(n,i,r,s)=>{let{text:o,ranges:l}=t.instantiate(n.state,r),{main:c}=n.state.selection,u={changes:{from:r,to:s==c.from?c.to:s,insert:sr.of(o)},scrollIntoView:!0,annotations:i?[sH.of(i),Ro.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=dH(l,0)),l.some(d=>d.field>0)){let d=new h1(l,0),f=u.effects=[lT.of(d)];n.state.field(jE,!1)===void 0&&f.push(Gn.appendConfig.of([jE,w8t,O8t,j3e]))}n.dispatch(n.state.update(u))}}function N3e(e){return({state:t,dispatch:n})=>{let i=t.field(jE,!1);if(!i||e<0&&i.active==0)return!1;let r=i.active+e,s=e>0&&!i.ranges.some(o=>o.field==r+e);return n(t.update({selection:dH(i.ranges,r),effects:lT.of(s?null:new h1(i.ranges,r)),scrollIntoView:!0})),!0}}const b8t=({state:e,dispatch:t})=>e.field(jE,!1)?(t(e.update({effects:lT.of(null)})),!0):!1,y8t=N3e(1),v8t=N3e(-1),x8t=[{key:"Tab",run:y8t,shift:v8t},{key:"Escape",run:b8t}],Bie=an.define({combine(e){return e.length?e[0]:x8t}}),w8t=Ap.highest(d1.compute([Bie],e=>e.facet(Bie)));function Ms(e,t){return{...t,apply:g8t(e)}}const O8t=Xt.domEventHandlers({mousedown(e,t){let n=t.state.field(jE,!1),i;if(!n||(i=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let r=n.ranges.find(s=>s.from<=i&&s.to>=i);return!r||r.field==n.active?!1:(t.dispatch({selection:dH(n.ranges,r.field),effects:lT.of(n.ranges.some(s=>s.field>r.field)?new h1(n.ranges,r.field):null),scrollIntoView:!0}),!0)}}),NE={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fb=Gn.define({map(e,t){let n=t.mapPos(e,-1,Pa.TrackAfter);return n??void 0}}),fH=new class extends mg{};fH.startSide=1;fH.endSide=-1;const R3e=Qa.define({create(){return Di.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:i=>i>=n.from&&i<=n.to})}for(let n of t.effects)n.is(Fb)&&(e=e.update({add:[fH.range(n.value,n.value+1)]}));return e}});function k8t(){return[E8t,R3e]}const I3="()[]{}<>«»»«[]{}";function I3e(e){for(let t=0;t{if((S8t?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||i.length==2&&hf(Zl(i,0))==1||t!=r.from||n!=r.to)return!1;let s=A8t(e.state,i);return s?(e.dispatch(s),!0):!1}),C8t=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=P3e(e,e.selection.main.head).brackets||NE.brackets,r=null,s=e.changeByRange(o=>{if(o.empty){let l=_8t(e.doc,o.head);for(let c of i)if(c==l&&kD(e.doc,o.head)==I3e(Zl(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:ut.cursor(o.head-c.length)}}return{range:r=o}});return r||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},T8t=[{key:"Backspace",run:C8t}];function A8t(e,t){let n=P3e(e,e.selection.main.head),i=n.brackets||NE.brackets;for(let r of i){let s=I3e(Zl(r,0));if(t==r)return s==r?R8t(e,r,i.indexOf(r+r+r)>-1,n):j8t(e,r,s,n.before||NE.before);if(t==s&&D3e(e,e.selection.main.from))return N8t(e,r,s)}return null}function D3e(e,t){let n=!1;return e.field(R3e).between(0,e.doc.length,i=>{i==t&&(n=!0)}),n}function kD(e,t){let n=e.sliceString(t,t+2);return n.slice(0,hf(Zl(n,0)))}function _8t(e,t){let n=e.sliceString(t-2,t);return hf(Zl(n,0))==n.length?n:n.slice(1)}function j8t(e,t,n,i){let r=null,s=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Fb.of(o.to+t.length),range:ut.range(o.anchor+t.length,o.head+t.length)};let l=kD(e.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:t+n,from:o.head},effects:Fb.of(o.head+t.length),range:ut.cursor(o.head+t.length)}:{range:r=o}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function N8t(e,t,n){let i=null,r=e.changeByRange(s=>s.empty&&kD(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:ut.cursor(s.head+n.length)}:i={range:s});return i?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function R8t(e,t,n,i){let r=i.stringPrefixes||NE.stringPrefixes,s=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Fb.of(l.to+t.length),range:ut.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=kD(e.doc,c),d;if(u==t){if(Uie(e,c))return{changes:{insert:t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)};if(D3e(e,c)){let h=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+h.length,insert:h},range:ut.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=Qie(e,c-2*t.length,r))>-1&&Uie(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ts.Word&&Qie(e,c,r)>-1&&!I8t(e,c,t,r))return{changes:{insert:t+t,from:c},effects:Fb.of(c+t.length),range:ut.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Uie(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function I8t(e,t,n,i){let r=Lr(e).resolveInner(t,-1),s=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),c=l.indexOf(n);if(!c||c>-1&&i.indexOf(l.slice(0,c))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==t&&r.parent;if(!u)break;r=u}return!1}function Qie(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=Ts.Word)return t;for(let r of n){let s=t-r.length;if(e.sliceDoc(s,t)==r&&i(e.sliceDoc(s-1,s))!=Ts.Word)return s}return-1}function P8t(e={}){return[d8t,Jl,ma.of(e),c8t,D8t,j3e]}const M3e=[{key:"Ctrl-Space",run:R3},{mac:"Alt-`",run:R3},{mac:"Alt-i",run:R3},{key:"Escape",run:s8t},{key:"ArrowDown",run:A2(!0)},{key:"ArrowUp",run:A2(!1)},{key:"PageDown",run:A2(!0,"page")},{key:"PageUp",run:A2(!1,"page")},{key:"Enter",run:r8t}],D8t=Ap.highest(d1.computeN([ma],e=>e.facet(ma).defaultKeymap?[M3e]:[])),L3e=[Ms("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Ms("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Ms("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Ms("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Ms("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Ms(`try { \${} } catch (\${error}) { \${} @@ -731,27 +731,27 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),Ms('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Ms('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],P8t=L3e.concat([Ms("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Ms("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Ms("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),zie=new NV,$3e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function bO(e){return(t,n)=>{let i=t.node.getChild("VariableDefinition");return i&&n(i,e),!0}}const D8t=["FunctionDeclaration"],M8t={FunctionDeclaration:bO("function"),ClassDeclaration:bO("class"),ClassExpression:()=>!0,EnumDeclaration:bO("constant"),TypeAliasDeclaration:bO("type"),NamespaceDeclaration:bO("namespace"),VariableDefinition(e,t){e.matchContext(D8t)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function F3e(e,t){let n=zie.get(t);if(n)return n;let i=[],r=!0;function s(o,l){let c=e.sliceString(o.from,o.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=M8t[o.name];if(l&&l(o,s)||$3e.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of F3e(e,o.node))i.push(l);return!1}}),zie.set(t,i),i}const Vie=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,B3e=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function L8t(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(B3e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&Vie.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)$3e.has(r.name)&&(i=i.concat(F3e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:Vie}}const Rf=bp.define({name:"javascript",parser:$Ft.configure({props:[jp.add({IfStatement:vx({except:/^\s*({|else\b)/}),TryStatement:vx({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:v6t,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),i=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:i?1:2)*e.unit},Block:yx({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":vx({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Np.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":sT,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,i=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:i.type.isError?e.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),U3e={test:e=>/^JSX/.test(e.name),facet:vD({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Q3e=Rf.configure({dialect:"ts"},"typescript"),z3e=Rf.configure({dialect:"jsx",props:[YV.add(e=>e.isTop?[U3e]:void 0)]}),V3e=Rf.configure({dialect:"jsx ts",props:[YV.add(e=>e.isTop?[U3e]:void 0)]},"typescript");let H3e=e=>({label:e,type:"keyword"});const q3e="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(H3e),$8t=q3e.concat(["declare","implements","private","protected","public"].map(H3e));function yB(e={}){let t=e.jsx?e.typescript?V3e:z3e:e.typescript?Q3e:Rf,n=e.typescript?P8t.concat($8t):L3e.concat(q3e);return new xg(t,[Rf.data.of({autocomplete:T3e(B3e,rH(n))}),Rf.data.of({autocomplete:L8t}),e.jsx?U8t:[]])}function F8t(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function Hie(e,t,n=e.length){for(let i=t==null?void 0:t.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return e.sliceString(i.from,Math.min(i.to,n));return""}const B8t=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),U8t=Xt.inputHandler.of((e,t,n,i,r)=>{if((B8t?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||i!=">"&&i!="/"||!Rf.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(c=>{var u;let{head:d}=c,f=Lr(o).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(d-1,d)!=i||f.name=="JSXAttributeValue"&&f.to>d)){if(i==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:""}};if(i=="/"&&f.name=="JSXStartCloseTag"){let m=f.parent,g=m.parent;if(g&&m.from==d-2&&((h=Hie(o.doc,g.firstChild,d))||((u=g.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${h}>`;return{range:ut.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(i==">"){let m=F8t(f);if(m&&m.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(h=Hie(o.doc,m,d)))return{range:c,changes:{from:d,insert:``}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Q8t=_p({String:oe.string,Number:oe.number,"True False":oe.bool,PropertyName:oe.propertyName,Null:oe.null,", :":oe.separator,"[ ]":oe.squareBracket,"{ }":oe.brace}),z8t=yp.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Q8t],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),V8t=bp.define({name:"json",parser:z8t.configure({props:[jp.add({Object:vx({except:/^\s*\}/}),Array:vx({except:/^\s*\]/})}),Np.add({"Object Array":sT})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function H8t(){return new xg(V8t)}class kR{static create(t,n,i,r,s){let o=r+(r<<8)+t+(n<<4)|0;return new kR(t,n,i,o,s,[],[])}constructor(t,n,i,r,s,o,l){this.type=t,this.value=n,this.from=i,this.hash=r,this.end=s,this.children=o,this.positions=l,this.hashProp=[[Kn.contextHash,r]]}addChild(t,n){t.prop(Kn.contextHash)!=this.hash&&(t=new Ci(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(n)}toTree(t,n=this.end){let i=this.children.length-1;return i>=0&&(n=Math.max(n,this.positions[i]+this.children[i].length+this.from)),new Ci(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(r,s,o)=>new Ci(Po.none,r,s,o,this.hashProp)})}}var zt;(function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"})(zt||(zt={}));class q8t{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class W8t{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return oS(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,n=0,i=0){for(let r=n;r=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let i=(e.type==zt.OrderedList?mH:pH)(n,t,!1);return i>0&&(e.type!=zt.BulletList||hH(n,t,!1)<0)&&n.text.charCodeAt(n.pos+i-1)==e.value}const W3e={[zt.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(er(zt.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(td(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[zt.ListItem](e,t,n){return n.indent-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[zt.OrderedList]:qie,[zt.BulletList]:qie,[zt.Document](){return!0}};function td(e){return e==32||e==9||e==10||e==13}function oS(e,t=0){for(;tn&&td(e.charCodeAt(t-1));)t--;return t}function K3e(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(n4e.SetextHeading)>-1||i<3?-1:1}function X3e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function pH(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||td(e.text.charCodeAt(e.pos+1)))&&(!n||X3e(t,zt.BulletList)||e.skipSpace(e.pos+2)=48&&r<=57;){i++;if(i==e.text.length)return-1;r=e.text.charCodeAt(i)}return i==e.pos||i>e.pos+9||r!=46&&r!=41||ie.pos+1||e.next!=49)?-1:i+1-e.pos}function Y3e(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t6?-1:n}function Z3e(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t/,e4e=/\?>/,xB=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/,e4e=/\?>/,xB=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(i);if(s)return e.append(er(zt.Comment,n,n+1+s[0].length));let o=/^\?[^]*?\?>/.exec(i);if(o)return e.append(er(zt.ProcessingInstruction,n,n+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return l?e.append(er(zt.HTMLTag,n,n+1+l[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let i=n+1;for(;e.char(i)==t;)i++;let r=e.slice(n-1,n),s=e.slice(i,i+1),o=IE.test(r),l=IE.test(s),c=/\s|^$/.test(r),u=/\s|^$/.test(s),d=!u&&(!l||c||o),f=!c&&(!o||u||l),h=d&&(t==42||!f||o),m=f&&(t==42||!d||l);return e.append(new Lc(t==95?a4e:l4e,n,i,(h?1:0)|(m?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(er(zt.HardBreak,n,n+2));if(t==32){let i=n+1;for(;e.char(i)==32;)i++;if(e.char(i)==10&&i>=n+2)return e.append(er(zt.HardBreak,n,i+1))}return-1},Link(e,t,n){return t==91?e.append(new Lc(Eb,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Lc(SR,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let i=e.parts.length-1;i>=0;i--){let r=e.parts[i];if(r instanceof Lc&&(r.type==Eb||r.type==SR)){if(!r.side||e.skipSpace(r.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[i]=null,-1;let s=e.takeContent(i),o=e.parts[i]=J8t(e,s,r.type==Eb?zt.Link:zt.Image,r.from,n+1);if(r.type==Eb)for(let l=0;lt?er(zt.URL,t+n,s+n):s==e.length?null:!1}}function u4e(e,t,n){let i=e.charCodeAt(t);if(i!=39&&i!=34&&i!=40)return!1;let r=i==40?41:i;for(let s=t+1,o=!1;s=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,n){return this.text.slice(t-this.offset,n-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,n,i,r,s){return this.append(new Lc(t,n,i,(r?1:0)|(s?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof Lc&&(n.type==Eb||n.type==SR))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let i=t;i=t;c--){let b=this.parts[c];if(b instanceof Lc&&b.side&1&&b.type==r.type&&!(s&&(r.side&1||b.side&2)&&(b.to-b.from+o)%3==0&&((b.to-b.from)%3||o%3))){l=b;break}}if(!l)continue;let u=r.type.resolve,d=[],f=l.from,h=r.to;if(s){let b=Math.min(2,l.to-l.from,o);f=l.to-b,h=r.from+b,u=b==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let b=c+1;b=0;n--){let i=this.parts[n];if(i instanceof Lc&&i.type==t&&i.side&1)return n}return null}takeContent(t){let n=this.resolveMarkers(t);return this.parts.length=t,n}getDelimiterAt(t){let n=this.parts[t];return n instanceof Lc?n:null}skipSpace(t){return oS(this.text,t-this.offset)+this.offset}elt(t,n,i,r){return typeof t=="string"?er(this.parser.getNodeType(t),n,i,r):new o4e(t,n)}}gH.linkStart=Eb;gH.imageStart=SR;function OB(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),i=0;for(let r of t){for(;i(t?t-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` -`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=t+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=n;if(!i.childAfter(r))return!1}}matches(t){let n=this.cursor.tree;return n&&n.prop(Kn.contextHash)==t}takeNodes(t){let n=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,o=s,l=t.block.children.length,c=o,u=l;for(;;){if(n.to-i>r){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=f4e(n.from-i,t.ranges);if(n.to-i<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new Ci(t.parser.nodeSet.types[zt.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(eBt.indexOf(n.type.id)<0?(o=n.to-i,l=t.block.children.length):(o=c,l=u),c=n.to-i,u=t.block.children.length),!n.nextSibling())break}for(;t.block.children.length>l;)t.block.children.pop(),t.block.positions.pop();return o-s}}function f4e(e,t){let n=e;for(let i=1;i_2[e]),Object.keys(_2).map(e=>n4e[e]),Object.keys(_2),X8t,W3e,Object.keys(D3).map(e=>D3[e]),Object.keys(D3),[]);function rBt(e,t,n){let i=[];for(let r=e.firstChild,s=t;;r=r.nextSibling){let o=r?r.from:n;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function sBt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:TLe((r,s)=>{let o=r.type.id;if(t&&(o==zt.CodeBlock||o==zt.FencedCode)){let l="";if(o==zt.FencedCode){let u=r.node.getChild(zt.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==zt.CodeText,bracketed:o==zt.FencedCode}}else if(n&&(o==zt.HTMLBlock||o==zt.HTMLTag||o==zt.CommentBlock))return{parser:n,overlay:rBt(r.node,r.from,r.to)};return null})}}const oBt={resolve:"Strikethrough",mark:"StrikethroughMark"},aBt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":oe.strikethrough}},{name:"StrikethroughMark",style:oe.processingInstruction}],parseInline:[{name:"Strikethrough",parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let i=e.slice(n-1,n),r=e.slice(n+2,n+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=IE.test(i),c=IE.test(r);return e.addDelimiter(oBt,n,n+2,!o&&(!c||s||l),!s&&(!l||o||c))},after:"Emphasis"}]};function aS(e,t,n=0,i,r=0){let s=0,o=!0,l=-1,c=-1,u=!1,d=()=>{i.push(e.elt("TableCell",r+l,r+c,e.parser.parseInline(t.slice(l,c),r+l)))};for(let f=n;f-1)&&s++,o=!1,i&&(l>-1&&d(),i.push(e.elt("TableDelimiter",f+r,f+r+1))),l=c=-1):(u||h!=32&&h!=9)&&(l<0&&(l=f),c=f+1),u=!u&&h==92}return l>-1&&(s++,i&&d()),s}function Xie(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class Yie{constructor(){this.rows=null}nextLine(t,n,i){if(this.rows==null){this.rows=!1;let r;if((n.next==45||n.next==58||n.next==124)&&h4e.test(r=n.text.slice(n.pos))){let s=[];aS(t,i.content,0,s,i.start)==aS(t,r,0)&&(this.rows=[t.elt("TableHeader",i.start,i.start+i.content.length,s),t.elt("TableDelimiter",t.lineStart+n.pos,t.lineStart+n.text.length)])}}else if(this.rows){let r=[];aS(t,n.text,n.pos,r,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+n.pos,t.lineStart+n.text.length,r))}return!1}finish(t,n){return this.rows?(t.addLeafElement(n,t.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const lBt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":oe.heading}},"TableRow",{name:"TableCell",style:oe.content},{name:"TableDelimiter",style:oe.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return Xie(t.content,0)?new Yie:null},endLeaf(e,t,n){if(n.parsers.some(r=>r instanceof Yie)||!Xie(t.text,t.basePos))return!1;let i=e.peekLine();return h4e.test(i)&&aS(e,t.text,t.basePos)==aS(e,i,t.basePos)},before:"SetextHeading"}]};class cBt{nextLine(){return!1}finish(t,n){return t.addLeafElement(n,t.elt("Task",n.start,n.start+n.content.length,[t.elt("TaskMarker",n.start,n.start+3),...t.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const uBt={defineNodes:[{name:"Task",block:!0,style:oe.list},{name:"TaskMarker",style:oe.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new cBt:null},after:"SetextHeading"}]},Zie=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Jie=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,dBt=/[\w-]+\.[\w-]+($|[/:])/,ere=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,tre=/\/[a-zA-Z\d@.]+/gy;function nre(e,t,n,i){let r=0;for(let s=t;s-1)return-1;let i=t+n[0].length;for(;;){let r=e[i-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&nre(e,t,i,")")>nre(e,t,i,"("))i--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,i))))i=t+s.index;else break}return i}function ire(e,t){ere.lastIndex=t;let n=ere.exec(e);if(!n)return-1;let i=n[0][n[0].length-1];return i=="_"||i=="-"?-1:t+n[0].length-(i=="."?1:0)}const hBt={parseInline:[{name:"Autolink",parse(e,t,n){let i=n-e.offset;if(i&&/\w/.test(e.text[i-1]))return-1;Zie.lastIndex=i;let r=Zie.exec(e.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=fBt(e.text,i+r[0].length),s>-1&&e.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(i,s));s=i+o[0].length}}else r[3]?s=ire(e.text,i):(s=ire(e.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(tre.lastIndex=s,r=tre.exec(e.text),r&&(s=r.index+r[0].length)));return s<0?-1:(e.addElement(e.elt("URL",n,s+e.offset)),s+e.offset)}}]},pBt=[lBt,uBt,aBt,hBt];function p4e(e,t,n){return(i,r,s)=>{if(r!=e||i.char(s+1)==e)return-1;let o=[i.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let are=null,lre=null,cre=0;function SB(e,t){let n=e.pos+t;if(cre==n&&lre==e)return are;let i=e.peek(t),r="";for(;UBt(i);)r+=String.fromCharCode(i),i=e.peek(++t);return lre=e,cre=n,are=r?r.toLowerCase():i==QBt||i==zBt?void 0:null}const O4e=60,ER=62,yH=47,QBt=63,zBt=33,VBt=45;function ure(e,t){this.name=e,this.parent=t}const HBt=[bH,y4e,m4e,g4e,b4e],qBt=new OD({start:null,shift(e,t,n,i){return HBt.indexOf(t)>-1?new ure(SB(i,1)||"",e):e},reduce(e,t){return t==v4e&&e?e.parent:e},reuse(e,t,n,i){let r=t.type.id;return r==bH||r==DBt?new ure(SB(i,1)||"",e):e},strict:!1}),WBt=new yo((e,t)=>{if(e.next!=O4e){e.next<0&&t.context&&e.acceptToken(M3);return}e.advance();let n=e.next==yH;n&&e.advance();let i=SB(e,0);if(i===void 0)return;if(!i)return e.acceptToken(n?_Bt:ABt);let r=t.context?t.context.name:null;if(n){if(i==r)return e.acceptToken(EBt);if(r&&BBt[r])return e.acceptToken(M3,-2);if(t.dialectEnabled(LBt))return e.acceptToken(CBt);for(let s=t.context;s;s=s.parent)if(s.name==i)return;e.acceptToken(TBt)}else{if(i=="script")return e.acceptToken(m4e);if(i=="style")return e.acceptToken(g4e);if(i=="textarea")return e.acceptToken(b4e);if(FBt.hasOwnProperty(i))return e.acceptToken(y4e);r&&ore[r]&&ore[r][i]?e.acceptToken(M3,-1):e.acceptToken(bH)}},{contextual:!0}),KBt=new yo(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(sre);break}if(e.next==VBt)t++;else if(e.next==ER&&t>=2){n>=3&&e.acceptToken(sre,-2);break}else t=0;e.advance()}});function GBt(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const XBt=new yo((e,t)=>{if(e.next==yH&&e.peek(1)==ER){let n=t.dialectEnabled($Bt)||GBt(t.context);e.acceptToken(n?SBt:rre,2)}else e.next==ER&&e.acceptToken(rre,1)});function vH(e,t,n){let i=2+e.length;return new yo(r=>{for(let s=0,o=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(t);break}if(s==0&&r.next==O4e||s==1&&r.next==yH||s>=2&&so?r.acceptToken(t,-o):r.acceptToken(n,-(o-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(t,1);break}else s=o=0;r.advance()}})}const YBt=vH("script",yBt,vBt),ZBt=vH("style",xBt,wBt),JBt=vH("textarea",OBt,kBt),e9t=_p({"Text RawText IncompleteTag IncompleteCloseTag":oe.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":oe.angleBracket,TagName:oe.tagName,"MismatchedCloseTag/TagName":[oe.tagName,oe.invalid],AttributeName:oe.attributeName,"AttributeValue UnquotedAttributeValue":oe.attributeValue,Is:oe.definitionOperator,"EntityReference CharacterReference":oe.character,Comment:oe.blockComment,ProcessingInst:oe.processingInstruction,DoctypeDecl:oe.documentMeta}),t9t=yp.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:qBt,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[e9t],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=l.type.id;if(u==RBt)return L3(l,c,n);if(u==IBt)return L3(l,c,i);if(u==PBt)return L3(l,c,r);if(u==v4e&&s.length){let d=l.node,f=d.firstChild,h=f&&dre(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=k4e(f,c))))){let b=d.lastChild,v=b.type.id==MBt?b.from:d.to;if(v>f.to)return{parser:g.parser,overlay:[{from:f.to,to:v}]}}}}if(o&&u==x4e){let d=l.node,f;if(f=d.firstChild){let h=o[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=dre(d.parent,c))continue;let g=d.lastChild;if(g.type.id==kB){let b=g.from+1,v=g.lastChild,y=g.to-(v&&v.isError?0:1);if(y>b)return{parser:m.parser,overlay:[{from:b,to:y}],bracketed:!0}}else if(g.type.id==w4e)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const n9t=145,fre=1,i9t=146,r9t=147,E4e=2,s9t=148,o9t=3,a9t=4,C4e=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],l9t=58,c9t=40,T4e=95,u9t=91,uj=45,d9t=46,f9t=35,h9t=37,p9t=38,m9t=92,g9t=10,b9t=42;function PE(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function xH(e){return e>=48&&e<=57}function hre(e){return xH(e)||e>=97&&e<=102||e>=65&&e<=70}const A4e=(e,t,n)=>(i,r)=>{for(let s=!1,o=0,l=0;;l++){let{next:c}=i;if(PE(c)||c==uj||c==T4e||s&&xH(c))!s&&(c!=uj||l>0)&&(s=!0),o===l&&c==uj&&o++,i.advance();else if(c==m9t&&i.peek(1)!=g9t){if(i.advance(),hre(i.next)){do i.advance();while(hre(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&r.canShift(E4e)?t:c==c9t?n:e);break}}},y9t=new yo(A4e(i9t,E4e,r9t),{contextual:!0}),v9t=new yo(A4e(s9t,o9t,a9t),{contextual:!0}),x9t=new yo(e=>{if(C4e.includes(e.peek(-1))){let{next:t}=e;(PE(t)||t==T4e||t==f9t||t==d9t||t==b9t||t==u9t||t==l9t&&PE(e.peek(1))||t==uj||t==p9t)&&e.acceptToken(n9t)}}),w9t=new yo(e=>{if(!C4e.includes(e.peek(-1))){let{next:t}=e;if(t==h9t&&(e.advance(),e.acceptToken(fre)),PE(t)){do e.advance();while(PE(e.next)||xH(e.next));e.acceptToken(fre)}}}),O9t=_p({"AtKeyword import charset namespace keyframes media supports font-feature-values":oe.definitionKeyword,"from to selector scope MatchFlag":oe.keyword,NamespaceName:oe.namespace,KeyframeName:oe.labelName,KeyframeRangeName:oe.operatorKeyword,TagName:oe.tagName,ClassName:oe.className,PseudoClassName:oe.constant(oe.className),IdName:oe.labelName,"FeatureName PropertyName":oe.propertyName,AttributeName:oe.attributeName,NumberLiteral:oe.number,KeywordQuery:oe.keyword,UnaryQueryOp:oe.operatorKeyword,"CallTag ValueName FontName":oe.atom,VariableName:oe.variableName,Callee:oe.operatorKeyword,Unit:oe.unit,"UniversalSelector NestingSelector":oe.definitionOperator,"MatchOp CompareOp":oe.compareOperator,"ChildOp SiblingOp, LogicOp":oe.logicOperator,BinOp:oe.arithmeticOperator,Important:oe.modifier,Comment:oe.blockComment,ColorLiteral:oe.color,"ParenthesizedContent StringLiteral":oe.string,":":oe.punctuation,"PseudoOp #":oe.derefOperator,"; , |":oe.separator,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace}),k9t={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:152,"url-prefix":152,domain:152,regexp:152},S9t={__proto__:null,or:104,and:104,not:112,only:112,layer:206},E9t={__proto__:null,selector:118,style:124,layer:202},C9t={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},T9t={__proto__:null,to:243},A9t=yp.deserialize({version:14,states:"MlQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FnO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#EOO'dQdO'#EQO'oQdO'#EXO'oQdO'#E[OOQP'#Fn'#FnO)RQhO'#E}OOQS'#Fm'#FmOOQS'#FQ'#FQQYQdOOO)YQdO'#EbO*iQhO'#EhO)YQdO'#EjO*pQdO'#ElO*{QdO'#EoO)}QhO'#EuO+TQdO'#EwO+`QdO'#EzO+eQaO'#CfO+lQ`O'#E_O+qQ`O'#F{O+|QdO'#F{QOQ`OOP,WO&jO'#CaPOOO)CA])CA]OOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,cQdO,59YO'_QdO,5:jO'dQdO,5:lO'oQdO,5:sO'oQdO,5:uO'oQdO,5:vO'oQdO'#FXO,nQ`O,58}O,vQdO'#E^OOQS,58},58}OOQP'#Cq'#CqOOQO'#D|'#D|OOQP,59Y,59YO,}Q`O,59YO-SQ`O,59YOOQP'#EP'#EPOOQP,5:j,5:jO-XQpO'#ERO-dQdO'#ESO-iQ`O'#ESO-nQpO,5:lO.XQaO,5:sO.oQaO,5:vOOQW'#D^'#D^O/nQhO'#DgO0RQhO,5;iO)}QhO'#DeO0`Q`O'#DnO0eQhO'#DxOOQW'#Ft'#FtOOQS,5;i,5;iO0jQ`O'#DhO0oQ`O'#DkOOQS-E9O-E9OOOQ['#Cv'#CvO0tQdO'#CwO1[QdO'#C}O1rQdO'#DQO2YQ!pO'#DSO4fQ!jO,5:|OOQO'#DX'#DXO-SQ`O'#DWO4vQ!nO'#FqO6|Q`O'#DYO7RQ`O'#DyOOQ['#Fq'#FqO7WQhO'#GOO7fQ`O,5;SO7kQ!bO,5;UOOQS'#En'#EnO7sQ`O,5;WO7xQdO,5;WOOQO'#Eq'#EqO8QQ`O,5;ZO8VQhO,5;aO'oQdO'#DjOOQS,5;c,5;cO0jQ`O,5;cO8_QdO,5;cOOQS'#F`'#F`O8gQdO'#E|O7fQ`O,5;fO8oQdO,5:yO9PQdO'#FZO9^Q`O,5lQhO'#DoOOQW,5:Y,5:YOOQW,5:d,5:dOOQW,5:S,5:SO>vQhO,5:VO?bQ!fO'#FrOOQS'#Fr'#FrOOQS'#FS'#FSO@rQdO,59cOOQ[,59c,59cOAYQdO,59iOOQ[,59i,59iOApQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)YQdO,59pOBWQhO'#EdOOQW'#Ed'#EdOBuQ`O1G0hO4oQhO1G0hOOQ[,59r,59rO)}QhO'#D[OOQ[,59t,59tOBzQ#tO,5:eOCVQhO'#F]OCdQ`O,5vQhO'#DmOI_QhO'#DqOIgQhO'#DsOIlQhO'#FwOOQO'#Fw'#FwOItQ!bO'#DwOOQO'#Fy'#FyOOQO'#Fv'#FvOIyQ`O1G/qOOQS-E9Q-E9QOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OJOQdO,5;OOOQS7+&S7+&SOJTQ`O7+&SOJYQhO'#D]OJbQ`O,59vO)}QhO,59vOOQ[1G0P1G0POJjQ`O1G0POJoQhO,5;wOOQO-E9Z-E9ZOOQS7+&^7+&^OJ}QbO'#DSOOQO'#Et'#EtOK]Q`O'#EsOOQO'#Es'#EsOKhQ`O'#F^OKpQdO,5;^OOQS,5;^,5;^OOQ[1G/p1G/pOOQS7+&i7+&iO7fQ`O7+&iOK{Q!fO'#FYO)YQdO'#FYOMSQdO7+&POOQO7+&P7+&POOQO,5:{,5:{OOQO1G1a1G1aOMgQ!bO<vQhO'#DrOOQO,5:],5:]O! hQhO,5:_OGUQhO,5:cOOQW7+%]7+%]OOQO'#Ef'#EfO! pQ`O1G0jOOQS<xAN>xO!#zQ`OAN>xO!$PQaO,5;rOOQO-E9U-E9UO!$ZQdO,5;qOOQO-E9T-E9TOOQW<vQhO'#DuOOQO1G/y1G/yO!%vQ!bO1G/}OJOQdO'#F[O!&OQ`O7+&UOOQW7+&U7+&UO!&WQ!bO1G/cOOQ[7+$|7+$|O!&cQhO7+$|P!&jQ`O'#FTOOQO,5;y,5;yOOQO-E9]-E9]OOQS1G1d1G1dOOQPG24dG24dO!&oQ`OAN>ZO)YQdO1G1[O!&tQ`O7+'jOOQO1G/x1G/xO!&|Q`O,5:aO!$eQhO7+%iOOQO,5;v,5;vOOQO-E9Y-E9YOOQW<Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!o`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$[~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$[~!o`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$qYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!o`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!o`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!o`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!o`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!o`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!o`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!o`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!o`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!yS!o`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW#PQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!o`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!o`$gYOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!o`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!o`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!o`$gYOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!o`$gYOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!dYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!o`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!o`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!ySOy%jz;'S%j;'S;=`%{<%lO%jj@uV!|Q!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!|Q!o`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!o`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!o`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!zWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!zWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!o`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!o`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!o`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!o`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!o`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!o`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!o`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$pQ!o`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$cUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU#PQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[x9t,w9t,y9t,v9t,1,2,3,4,new xR("m~RRYZ[z{a~~g~aO$_~~dP!P!Qg~lO$`~~",28,152)],topRules:{StyleSheet:[0,6],Styles:[1,126]},dynamicPrecedences:{94:1},specialized:[{term:147,get:e=>k9t[e]||-1},{term:148,get:e=>S9t[e]||-1},{term:4,get:e=>E9t[e]||-1},{term:28,get:e=>C9t[e]||-1},{term:146,get:e=>T9t[e]||-1}],tokenPrec:2405});let $3=null;function F3(){if(!$3&&typeof document=="object"&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let i in e)i!="cssText"&&i!="cssFloat"&&typeof e[i]=="string"&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),n.has(i)||(t.push(i),n.add(i)));$3=t.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return $3||[]}const pre=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),mre=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),_9t=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),j9t=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),uh=/^(\w[\w-]*|-\w[\w-]*|)$/,N9t=/^-(-[\w-]*)?$/;function R9t(e,t){var n;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let i=(n=e.parent)===null||n===void 0?void 0:n.firstChild;return(i==null?void 0:i.name)!="Callee"?!1:t.sliceString(i.from,i.to)=="var"}const gre=new NV,I9t=["Declaration"];function P9t(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function _4e(e,t,n){if(t.to-t.from>4096){let i=gre.get(t);if(i)return i;let r=[],s=new Set,o=t.cursor(cr.IncludeAnonymous);if(o.firstChild())do for(let l of _4e(e,o.node,n))s.has(l.label)||(s.add(l.label),r.push(l));while(o.nextSibling());return gre.set(t,r),r}else{let i=[],r=new Set;return t.cursor().iterate(s=>{var o;if(n(s)&&s.matchContext(I9t)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=e.sliceString(s.from,s.to);r.has(l)||(r.add(l),i.push({label:l,type:"variable"}))}}),i}}const D9t=e=>t=>{let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.type.isError&&r.from==r.to-1&&n.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:F3(),validFor:uh};if(r.name=="ValueName")return{from:r.from,options:mre,validFor:uh};if(r.name=="PseudoClassName")return{from:r.from,options:pre,validFor:uh};if(e(r)||(t.explicit||s)&&R9t(r,n.doc))return{from:e(r)||s?r.from:i,options:_4e(n.doc,P9t(r),e),validFor:N9t};if(r.name=="TagName"){for(let{parent:c}=r;c;c=c.parent)if(c.name=="Block")return{from:r.from,options:F3(),validFor:uh};return{from:r.from,options:_9t,validFor:uh}}if(r.name=="AtKeyword")return{from:r.from,options:j9t,validFor:uh};if(!t.explicit)return null;let o=r.resolve(i),l=o.childBefore(i);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:i,options:pre,validFor:uh}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:i,options:mre,validFor:uh}:o.name=="Block"||o.name=="Styles"?{from:i,options:F3(),validFor:uh}:null},M9t=D9t(e=>e.name=="VariableName"),CR=bp.define({name:"css",parser:A9t.configure({props:[jp.add({Declaration:vx()}),Np.add({"Block KeyframeList":sT})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function L9t(){return new xg(CR,CR.data.of({autocomplete:M9t}))}const vO=["_blank","_self","_top","_parent"],B3=["ascii","utf-8","utf-16","latin1","latin1"],U3=["get","post","put","delete"],Q3=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ac=["true","false"],Sn={},$9t={a:{attrs:{href:null,ping:null,type:null,media:null,target:vO,hreflang:null}},abbr:Sn,address:Sn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Sn,aside:Sn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Sn,base:{attrs:{href:null,target:vO}},bdi:Sn,bdo:Sn,blockquote:{attrs:{cite:null}},body:Sn,br:Sn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Q3,formmethod:U3,formnovalidate:["novalidate"],formtarget:vO,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Sn,center:Sn,cite:Sn,code:Sn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Sn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Sn,div:Sn,dl:Sn,dt:Sn,em:Sn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Sn,figure:Sn,footer:Sn,form:{attrs:{action:null,name:null,"accept-charset":B3,autocomplete:["on","off"],enctype:Q3,method:U3,novalidate:["novalidate"],target:vO}},h1:Sn,h2:Sn,h3:Sn,h4:Sn,h5:Sn,h6:Sn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Sn,hgroup:Sn,hr:Sn,html:{attrs:{manifest:null}},i:Sn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Q3,formmethod:U3,formnovalidate:["novalidate"],formtarget:vO,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Sn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Sn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Sn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:B3,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Sn,noscript:Sn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Sn,param:{attrs:{name:null,value:null}},pre:Sn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Sn,rt:Sn,ruby:Sn,samp:Sn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:B3}},section:Sn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Sn,source:{attrs:{src:null,type:null,media:null}},span:Sn,strong:Sn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Sn,summary:Sn,sup:Sn,table:Sn,tbody:Sn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Sn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Sn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Sn,time:{attrs:{datetime:null}},title:Sn,tr:Sn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Sn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Sn},j4e={accesskey:null,class:null,contenteditable:Ac,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ac,autocorrect:Ac,autocapitalize:Ac,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ac,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ac,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ac,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ac,"aria-hidden":Ac,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ac,"aria-multiselectable":Ac,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ac,"aria-relevant":null,"aria-required":Ac,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},N4e="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of N4e)j4e[e]=null;class DE{constructor(t,n){this.tags={...$9t,...t},this.globalAttrs={...j4e,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}DE.default=new DE;function ww(e,t,n=e.length){if(!t)return"";let i=t.firstChild,r=i&&i.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,n)):""}function Ow(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function R4e(e,t,n){let i=n.tags[ww(e,Ow(t))];return(i==null?void 0:i.children)||n.allTags}function wH(e,t){let n=[];for(let i=Ow(t);i&&!i.type.isTop;i=Ow(i.parent)){let r=ww(e,i);if(r&&i.lastChild.name=="CloseTag")break;r&&n.indexOf(r)<0&&(t.name=="EndTag"||t.from>=i.firstChild.to)&&n.push(r)}return n}const I4e=/^[:\-\.\w\u00b7-\uffff]*$/;function bre(e,t,n,i,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">",o=Ow(n,n.name=="StartTag"||n.name=="TagName");return{from:i,to:r,options:R4e(e.doc,o,t).map(l=>({label:l,type:"type"})).concat(wH(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function yre(e,t,n,i){let r=/\s*>/.test(e.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:wH(e.doc,t).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:I4e}}function F9t(e,t,n,i){let r=[],s=0;for(let o of R4e(e.doc,n,t))r.push({label:"<"+o,type:"type"});for(let o of wH(e.doc,n))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function B9t(e,t,n,i,r){let s=Ow(n),o=s?t.tags[ww(e.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:i,to:r,options:c.map(u=>({label:u,type:"property"})),validFor:I4e}}function U9t(e,t,n,i,r){var s;let o=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(o){let u=e.sliceDoc(o.from,o.to),d=t.globalAttrs[u];if(!d){let f=Ow(n),h=f?t.tags[ww(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(i,r).toLowerCase(),h='"',m='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",m=e.sliceDoc(r,r+1)==f[0]?"":f[0],f=f.slice(1),i++):c=/^[^\s<>='"]*$/;for(let g of d)l.push({label:g,apply:h+g+m,type:"constant"})}}return{from:i,to:r,options:l,validFor:c}}function P4e(e,t){let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.resolve(i);for(let o=i,l;s==r&&(l=r.childBefore(o));){let c=l.lastChild;if(!c||!c.type.isError||c.fromP4e(i,r)}const V9t=Rf.parser.configure({top:"SingleExpression"}),D4e=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Q3e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:z3e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:V3e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:V9t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Rf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:CR.parser}],M4e=[{name:"style",parser:CR.parser.configure({top:"Styles"})}].concat(N4e.map(e=>({name:e,parser:Rf.parser}))),L4e=bp.define({name:"html",parser:t9t.configure({props:[jp.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),dj=L4e.configure({wrap:S4e(D4e,M4e)});function H9t(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=S4e((e.nestedLanguages||[]).concat(D4e),(e.nestedAttributes||[]).concat(M4e)));let i=n?L4e.configure({wrap:n,dialect:t}):t?dj.configure({dialect:t}):dj;return new xg(i,[dj.data.of({autocomplete:z9t(e)}),e.autoCloseTags!==!1?q9t:[],yB().support,L9t().support])}const vre=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),q9t=Xt.inputHandler.of((e,t,n,i,r)=>{if(e.composing||e.state.readOnly||t!=n||i!=">"&&i!="/"||!dj.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(c=>{var u,d,f;let h=o.doc.sliceString(c.from-1,c.to)==i,{head:m}=c,g=Lr(o).resolveInner(m,-1),b;if(h&&i==">"&&g.name=="EndTag"){let v=g.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=ww(o.doc,v.parent,m))&&!vre.has(b)){let y=m+(o.doc.sliceString(m,m+1)===">"?1:0),x=``;return{range:c,changes:{from:m,to:y,insert:x}}}}else if(h&&i=="/"&&g.name=="IncompleteCloseTag"){let v=g.parent;if(g.from==m-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=ww(o.doc,v,m))&&!vre.has(b)){let y=m+(o.doc.sliceString(m,m+1)===">"?1:0),x=`${b}>`;return{range:ut.cursor(m+x.length,-1),changes:{from:m,to:y,insert:x}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),$4e=vD({commentTokens:{block:{open:""}}}),F4e=new Kn,B4e=iBt.configure({props:[Np.add(e=>!e.is("Block")||e.is("Document")||EB(e)!=null||W9t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),F4e.add(EB),jp.add({Document:()=>null}),_m.add({Document:$4e})]});function EB(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function W9t(e){return e.name=="OrderedList"||e.name=="BulletList"}function K9t(e,t){let n=e;for(;;){let i=n.nextSibling,r;if(!i||(r=EB(i.type))!=null&&r<=t)break;n=i}return n.to}const G9t=s3e.of((e,t,n)=>{for(let i=Lr(e).resolveInner(n,-1);i&&!(i.fromn)return{from:n,to:s}}return null});function OH(e){return new qc($4e,e,[],"markdown")}const X9t=OH(B4e),Y9t=B4e.configure([pBt,gBt,mBt,bBt,{props:[Np.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),TR=OH(Y9t);function Z9t(e,t){return n=>{if(n&&e){let i=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?i=e(n):i=mR.matchLanguageName(e,n,!0),i instanceof mR)return i.support?i.support.language.parser:_y.getSkippingParser(i.load());if(i)return i.parser}return t?t.parser:null}}let z3=class{constructor(t,n,i,r,s,o,l){this.node=t,this.from=n,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(t,n=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;i.length0;r--)i+=" ";return i+(n?this.spaceAfter:"")}}marker(t,n){let i=this.node.name=="OrderedList"?String(+Q4e(this.item,t)[2]+n):"";return this.spaceBefore+i+this.type+this.spaceAfter}};function U4e(e,t){let n=[],i=[];for(let r=e;r;r=r.parent){if(r.name=="FencedCode")return i;(r.name=="ListItem"||r.name=="Blockquote")&&n.push(r)}for(let r=n.length-1;r>=0;r--){let s=n[r],o,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(c))))i.push(new z3(s,c,c+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),i.push(new z3(s.parent,c,c+d,o[1],u,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),i.push(new z3(s.parent,c,c+d,o[1],u,f,s))}}return i}function Q4e(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function V3(e,t,n,i=0){for(let r=-1,s=e;;){if(s.name=="ListItem"){let l=Q4e(s,t),c=+l[2];if(r>=0){if(c!=r+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+i)})}r=c}let o=s.nextSibling;if(!o)break;s=o}}function kH(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(f1)!=" ")return e;let i=Id(e,4,n),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+e.slice(n)}const J9t=(e={})=>({state:t,dispatch:n})=>{let i=Lr(t),{doc:r}=t,s=null,o=t.changeByRange(l=>{if(!l.empty||!TR.isActiveAt(t,l.from,-1)&&!TR.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=r.lineAt(c),d=U4e(i.resolveInner(c,-1),r);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let y=f.node.firstChild,x=f.node.getChild("ListItem","ListItem");if(y.to>=c||x&&x.to0&&!/[^\s>]/.test(r.lineAt(u.from-1).text)||e.nonTightLists===!1){let w=d.length>1?d[d.length-2]:null,O,S="";w&&w.item?(O=u.from+w.from,S=w.marker(r,1)):O=u.from+(w?w.to:0);let k=[{from:O,to:c,insert:S}];return f.node.name=="OrderedList"&&V3(f.item,r,k,-2),w&&w.node.name=="OrderedList"&&V3(w.item,r,k),{range:ut.cursor(O+S.length),changes:k}}else{let w=wre(d,t,u);return{range:ut.cursor(c+w.length+1),changes:{from:u.from,insert:w+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let y=r.lineAt(u.from-1),x=/>\s*$/.exec(y.text);if(x&&x.index==f.from){let w=t.changes([{from:y.from+x.index,to:y.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(w),changes:w}}}let m=[];f.node.name=="OrderedList"&&V3(f.item,r,m);let g=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let y=0,x=d.length-1;y<=x;y++)b+=y==x&&!g?d[y].marker(r,1):d[y].blank(yu.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return b=kH(b,t),t7t(f.node,t.doc)&&(b=wre(d,t,u)+t.lineBreak+b),m.push({from:v,to:c,insert:t.lineBreak+b}),{range:ut.cursor(v+b.length+1),changes:m}});return s?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},e7t=J9t();function xre(e){return e.name=="QuoteMark"||e.name=="ListMark"}function t7t(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,i=e.getChild("ListItem","ListItem");if(!i)return!1;let r=t.lineAt(n.to),s=t.lineAt(i.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1){let n=Lr(e),i=null,r=e.changeByRange(s=>{let o=s.from,{doc:l}=e;if(s.empty&&TR.isActiveAt(e,s.from)){let c=l.lineAt(o),u=U4e(n7t(n,o),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>f&&!/\S/.test(c.text.slice(f,o-c.from)))return{range:ut.cursor(c.from+f),changes:{from:c.from+f,to:o}};if(o-c.from==f&&(d.item&&c.from<=d.item.from||/^[\s>]*$/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from{var n;let{main:i}=t.state.selection;if(i.empty)return!1;let r=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!TR.isActiveAt(t.state,i.from,1)))return!1;let s=Lr(t.state),o=!1;return s.iterate({from:i.from,to:i.to,enter:l=>{(l.from>i.from||l7t.test(l.name))&&(o=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const cUt=new yo((e,t)=>{let n;if(e.next<0)e.acceptToken(h7t);else if(t.context.flags&fj)q3(e.next)&&e.acceptToken(f7t,1);else if(((n=e.peek(-1))<0||q3(n))&&t.canShift(Ore)){let i=0;for(;e.next==SH||e.next==ED;)e.advance(),i++;(e.next==Ry||e.next==ME||e.next==EH)&&e.acceptToken(Ore,-i)}else q3(e.next)&&e.acceptToken(d7t,1)},{contextual:!0}),uUt=new yo((e,t)=>{let n=t.context;if(n.flags)return;let i=e.peek(-1);if(i==Ry||i==ME){let r=0,s=0;for(;;){if(e.next==SH)r++;else if(e.next==ED)r+=8-r%8;else break;e.advance(),s++}r!=n.indent&&e.next!=Ry&&e.next!=ME&&e.next!=EH&&(r[e,t|X4e])),hUt=new OD({start:dUt,reduce(e,t,n,i){return e.flags&fj&&lUt.has(t)||(t==j7t||t==W4e)&&e.flags&X4e?e.parent:e},shift(e,t,n,i){return t==V4e?new hj(e,fUt(i.read(i.pos,n.pos)),0):t==H4e?e.parent:t==g7t||t==x7t||t==k7t||t==q4e?new hj(e,0,fj):Cre.has(t)?new hj(e,0,Cre.get(t)|e.flags&fj):e},hash(e){return e.hash}}),pUt=new yo(e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(!(n==SH||n==ED)){n!=tUt&&n!=nUt&&n!=Ry&&n!=ME&&n!=EH&&e.acceptToken(u7t);return}}}),mUt=new yo((e,t)=>{let{flags:n}=t.context,i=n&bh?G4e:K4e,r=(n&yh)>0,s=!(n&vh),o=(n&xh)>0,l=e.pos;for(;!(e.next<0);)if(o&&e.next==CB)if(e.peek(1)==CB)e.advance(2);else{if(e.pos==l){e.acceptToken(q4e,1);return}break}else if(s&&e.next==Ere){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),gUt(e,c)),e.acceptToken(m7t);return}break}else if(e.next==Ere&&!s&&e.peek(1)>-1)e.advance(2);else if(e.next==i&&(!r||e.peek(1)==i&&e.peek(2)==i)){if(e.pos==l){e.acceptToken(kre,r?3:1);return}break}else if(e.next==Ry){if(r)e.advance();else if(e.pos==l){e.acceptToken(kre);return}break}else e.advance();e.pos>l&&e.acceptToken(p7t)});function gUt(e,t){if(t==iUt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==rUt)for(let n=0;n<2&&W3(e.next);n++)e.advance();else if(t==oUt)for(let n=0;n<4&&W3(e.next);n++)e.advance();else if(t==aUt)for(let n=0;n<8&&W3(e.next);n++)e.advance();else if(t==sUt&&e.next==CB){for(e.advance();e.next>=0&&e.next!=Sre&&e.next!=K4e&&e.next!=G4e&&e.next!=Ry;)e.advance();e.next==Sre&&e.advance()}}const bUt=_p({'async "*" "**" FormatConversion FormatSpec':oe.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":oe.controlKeyword,"in not and or is del":oe.operatorKeyword,"from def class global nonlocal lambda":oe.definitionKeyword,import:oe.moduleKeyword,"with as print":oe.keyword,Boolean:oe.bool,None:oe.null,VariableName:oe.variableName,"CallExpression/VariableName":oe.function(oe.variableName),"FunctionDefinition/VariableName":oe.function(oe.definition(oe.variableName)),"ClassDefinition/VariableName":oe.definition(oe.className),PropertyName:oe.propertyName,"CallExpression/MemberExpression/PropertyName":oe.function(oe.propertyName),Comment:oe.lineComment,Number:oe.number,String:oe.string,FormatString:oe.special(oe.string),Escape:oe.escape,UpdateOp:oe.updateOperator,"ArithOp!":oe.arithmeticOperator,BitOp:oe.bitwiseOperator,CompareOp:oe.compareOperator,AssignOp:oe.definitionOperator,Ellipsis:oe.punctuation,At:oe.meta,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace,".":oe.derefOperator,", ;":oe.separator}),yUt={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},vUt=yp.deserialize({version:14,states:"##jQ`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[pUt,uUt,cUt,mUt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>yUt[e]||-1}],tokenPrec:7668}),Tre=new NV,Y4e=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function N2(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const xUt={FunctionDefinition:N2("function"),ClassDefinition:N2("class"),ForStatement(e,t,n){if(n){for(let i=e.node.firstChild;i;i=i.nextSibling)if(i.name=="VariableName")t(i,"variable");else if(i.name=="in")break}},ImportStatement(e,t){var n,i;let{node:r}=e,s=((n=r.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let o=r.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((i=o.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&t(o,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")t(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(e,t){for(let n=null,i=e.node.firstChild;i;i=i.nextSibling)i.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&t(i,"variable"),n=i},CapturePattern:N2("variable"),AsPattern:N2("variable"),__proto__:null};function Z4e(e,t){let n=Tre.get(t);if(n)return n;let i=[],r=!0;function s(o,l){let c=e.sliceString(o.from,o.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(o=>{if(o.name){let l=xUt[o.name];if(l&&l(o,s,r)||!r&&Y4e.has(o.name))return!1;r=!1}else if(o.to-o.from>8192){for(let l of Z4e(e,o.node))i.push(l);return!1}}),Tre.set(t,i),i}const Are=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,J4e=["String","FormatString","Comment","PropertyName"];function wUt(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(J4e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&Are.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)Y4e.has(r.name)&&(i=i.concat(Z4e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:Are}}const OUt=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(e=>({label:e,type:"function"}))),kUt=[Ms("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ms("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ms("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ms("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ms(`if \${}: +`);i=r<0?n:n.slice(0,r)}return t+i.length>this.to?i.slice(0,this.to-t):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,n,i=0){this.block=kR.create(t,i,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,n,i=0){this.startContext(this.parser.getNodeType(t),n,i)}addNode(t,n,i){typeof t=="number"&&(t=new Ci(this.parser.nodeSet.types[t],xw,xw,(i??this.prevLineEnd())-n)),this.block.addChild(t,n-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,n){this.addNode(this.buffer.writeElements(OB(n.children,t.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let t=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(t.toTree(this.parser.nodeSet),t.from-n.from),this.block=n}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?i4e(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let i of t.parsers)if(i.finish(this,t))return;let n=OB(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(n,-t.start).finish(zt.Paragraph,t.content.length),t.start)}elt(t,n,i,r){return typeof t=="string"?er(this.parser.getNodeType(t),n,i,r):new o4e(t,n)}get buffer(){return new s4e(this.parser.nodeSet)}}function i4e(e,t,n,i,r){let s=e[t].to,o=[],l=[],c=n.from+i;function u(d,f){for(;f?d>=s:d>s;){let h=e[t+1].from-s;i+=h,d+=h,t++,s=e[t].to}}for(let d=n.firstChild;d;d=d.nextSibling){u(d.from+i,!0);let f=d.from+i,h,m=r.get(d.tree);m?h=m:d.to+i>s?(h=i4e(e,t,d,i,r),u(d.to+i,!1)):h=d.toTree(),o.push(h),l.push(f-c)}return u(n.to+i,!1),new Ci(n.type,o,l,n.to+i-c,n.tree?n.tree.propValues:void 0)}class SD extends dD{constructor(t,n,i,r,s,o,l,c,u){super(),this.nodeSet=t,this.blockParsers=n,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=c,this.wrappers=u,this.nodeTypes=Object.create(null);for(let d of t.types)this.nodeTypes[d.name]=d.id}createParse(t,n,i){let r=new eBt(this,t,n,i);for(let s of this.wrappers)r=s(r,t,n,i);return r}configure(t){let n=wB(t);if(!n)return this;let{nodeSet:i,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),c=this.inlineParsers.slice(),u=this.inlineNames.slice(),d=this.endLeafBlock.slice(),f=this.wrappers;if(yO(n.defineNodes)){r=Object.assign({},r);let h=i.types.slice(),m;for(let g of n.defineNodes){let{name:b,block:v,composite:y,style:x}=typeof g=="string"?{name:g}:g;if(h.some(S=>S.name==b))continue;y&&(r[h.length]=(S,k,C)=>y(k,C,S.value));let w=h.length,O=y?["Block","BlockContext"]:v?w>=zt.ATXHeading1&&w<=zt.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;h.push(Po.define({id:w,name:b,props:O&&[[Kn.group,O]]})),x&&(m||(m={}),Array.isArray(x)||x instanceof uf?m[b]=x:Object.assign(m,x))}i=new u1(h),m&&(i=i.extend(_p(m)))}if(yO(n.props)&&(i=i.extend(...n.props)),yO(n.remove))for(let h of n.remove){let m=this.blockNames.indexOf(h),g=this.inlineNames.indexOf(h);m>-1&&(s[m]=o[m]=void 0),g>-1&&(c[g]=void 0)}if(yO(n.parseBlock))for(let h of n.parseBlock){let m=l.indexOf(h.name);if(m>-1)s[m]=h.parse,o[m]=h.leaf;else{let g=h.before?j2(l,h.before):h.after?j2(l,h.after)+1:l.length-1;s.splice(g,0,h.parse),o.splice(g,0,h.leaf),l.splice(g,0,h.name)}h.endLeaf&&d.push(h.endLeaf)}if(yO(n.parseInline))for(let h of n.parseInline){let m=u.indexOf(h.name);if(m>-1)c[m]=h.parse;else{let g=h.before?j2(u,h.before):h.after?j2(u,h.after)+1:u.length-1;c.splice(g,0,h.parse),u.splice(g,0,h.name)}}return n.wrap&&(f=f.concat(n.wrap)),new SD(i,s,o,l,d,r,c,u,f)}getNodeType(t){let n=this.nodeTypes[t];if(n==null)throw new RangeError(`Unknown node type '${t}'`);return n}parseInline(t,n){let i=new gH(this,t,n);e:for(let r=n;r=0){r=l;continue e}}r++}return i.resolveMarkers(0)}}function yO(e){return e!=null&&e.length>0}function wB(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=wB(e[0]);if(e.length==1)return t;let n=wB(e.slice(1));if(!n||!t)return t||n;let i=(o,l)=>(o||xw).concat(l||xw),r=t.wrap,s=n.wrap;return{props:i(t.props,n.props),defineNodes:i(t.defineNodes,n.defineNodes),parseBlock:i(t.parseBlock,n.parseBlock),parseInline:i(t.parseInline,n.parseInline),remove:i(t.remove,n.remove),wrap:r?s?(o,l,c,u)=>r(s(o,l,c,u),l,c,u):r:s}}function j2(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}let r4e=[Po.none];for(let e=1,t;t=zt[e];e++)r4e[e]=Po.define({id:e,name:t,props:e>=zt.Escape?[]:[[Kn.group,e in W3e?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});const xw=[];class s4e{constructor(t){this.nodeSet=t,this.content=[],this.nodes=[]}write(t,n,i,r=0){return this.content.push(t,n,i,4+r*4),this}writeElements(t,n=0){for(let i of t)i.writeTo(this,n);return this}finish(t,n){return Ci.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:n})}}let RE=class{constructor(t,n,i,r=xw){this.type=t,this.from=n,this.to=i,this.children=r}writeTo(t,n){let i=t.content.length;t.writeElements(this.children,n),t.content.push(this.type,this.from+n,this.to+n,t.content.length+4-i)}toTree(t){return new s4e(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class o4e{constructor(t,n){this.tree=t,this.from=n}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return xw}writeTo(t,n){t.nodes.push(this.tree),t.content.push(t.nodes.length-1,this.from+n,this.to+n,-1)}toTree(){return this.tree}}function er(e,t,n,i){return new RE(e,t,n,i)}const a4e={resolve:"Emphasis",mark:"EmphasisMark"},l4e={resolve:"Emphasis",mark:"EmphasisMark"},Eb={},SR={};class Lc{constructor(t,n,i,r){this.type=t,this.from=n,this.to=i,this.side=r}}const Gie="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let IE=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{IE=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const D3={Escape(e,t,n){if(t!=92||n==e.end-1)return-1;let i=e.char(n+1);for(let r=0;r]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(i);if(r)return e.append(er(zt.Autolink,n,n+1+r[0].length,[er(zt.LinkMark,n,n+1),er(zt.URL,n+1,n+r[0].length),er(zt.LinkMark,n+r[0].length,n+1+r[0].length)]));let s=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(i);if(s)return e.append(er(zt.Comment,n,n+1+s[0].length));let o=/^\?[^]*?\?>/.exec(i);if(o)return e.append(er(zt.ProcessingInstruction,n,n+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return l?e.append(er(zt.HTMLTag,n,n+1+l[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let i=n+1;for(;e.char(i)==t;)i++;let r=e.slice(n-1,n),s=e.slice(i,i+1),o=IE.test(r),l=IE.test(s),c=/\s|^$/.test(r),u=/\s|^$/.test(s),d=!u&&(!l||c||o),f=!c&&(!o||u||l),h=d&&(t==42||!f||o),m=f&&(t==42||!d||l);return e.append(new Lc(t==95?a4e:l4e,n,i,(h?1:0)|(m?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(er(zt.HardBreak,n,n+2));if(t==32){let i=n+1;for(;e.char(i)==32;)i++;if(e.char(i)==10&&i>=n+2)return e.append(er(zt.HardBreak,n,i+1))}return-1},Link(e,t,n){return t==91?e.append(new Lc(Eb,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Lc(SR,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let i=e.parts.length-1;i>=0;i--){let r=e.parts[i];if(r instanceof Lc&&(r.type==Eb||r.type==SR)){if(!r.side||e.skipSpace(r.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[i]=null,-1;let s=e.takeContent(i),o=e.parts[i]=tBt(e,s,r.type==Eb?zt.Link:zt.Image,r.from,n+1);if(r.type==Eb)for(let l=0;lt?er(zt.URL,t+n,s+n):s==e.length?null:!1}}function u4e(e,t,n){let i=e.charCodeAt(t);if(i!=39&&i!=34&&i!=40)return!1;let r=i==40?41:i;for(let s=t+1,o=!1;s=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,n){return this.text.slice(t-this.offset,n-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,n,i,r,s){return this.append(new Lc(t,n,i,(r?1:0)|(s?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof Lc&&(n.type==Eb||n.type==SR))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let i=t;i=t;c--){let b=this.parts[c];if(b instanceof Lc&&b.side&1&&b.type==r.type&&!(s&&(r.side&1||b.side&2)&&(b.to-b.from+o)%3==0&&((b.to-b.from)%3||o%3))){l=b;break}}if(!l)continue;let u=r.type.resolve,d=[],f=l.from,h=r.to;if(s){let b=Math.min(2,l.to-l.from,o);f=l.to-b,h=r.from+b,u=b==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let b=c+1;b=0;n--){let i=this.parts[n];if(i instanceof Lc&&i.type==t&&i.side&1)return n}return null}takeContent(t){let n=this.resolveMarkers(t);return this.parts.length=t,n}getDelimiterAt(t){let n=this.parts[t];return n instanceof Lc?n:null}skipSpace(t){return oS(this.text,t-this.offset)+this.offset}elt(t,n,i,r){return typeof t=="string"?er(this.parser.getNodeType(t),n,i,r):new o4e(t,n)}}gH.linkStart=Eb;gH.imageStart=SR;function OB(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),i=0;for(let r of t){for(;i(t?t-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` +`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=t+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=n;if(!i.childAfter(r))return!1}}matches(t){let n=this.cursor.tree;return n&&n.prop(Kn.contextHash)==t}takeNodes(t){let n=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,o=s,l=t.block.children.length,c=o,u=l;for(;;){if(n.to-i>r){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=f4e(n.from-i,t.ranges);if(n.to-i<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new Ci(t.parser.nodeSet.types[zt.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(nBt.indexOf(n.type.id)<0?(o=n.to-i,l=t.block.children.length):(o=c,l=u),c=n.to-i,u=t.block.children.length),!n.nextSibling())break}for(;t.block.children.length>l;)t.block.children.pop(),t.block.positions.pop();return o-s}}function f4e(e,t){let n=e;for(let i=1;i_2[e]),Object.keys(_2).map(e=>n4e[e]),Object.keys(_2),Z8t,W3e,Object.keys(D3).map(e=>D3[e]),Object.keys(D3),[]);function oBt(e,t,n){let i=[];for(let r=e.firstChild,s=t;;r=r.nextSibling){let o=r?r.from:n;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function aBt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:TLe((r,s)=>{let o=r.type.id;if(t&&(o==zt.CodeBlock||o==zt.FencedCode)){let l="";if(o==zt.FencedCode){let u=r.node.getChild(zt.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==zt.CodeText,bracketed:o==zt.FencedCode}}else if(n&&(o==zt.HTMLBlock||o==zt.HTMLTag||o==zt.CommentBlock))return{parser:n,overlay:oBt(r.node,r.from,r.to)};return null})}}const lBt={resolve:"Strikethrough",mark:"StrikethroughMark"},cBt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":oe.strikethrough}},{name:"StrikethroughMark",style:oe.processingInstruction}],parseInline:[{name:"Strikethrough",parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let i=e.slice(n-1,n),r=e.slice(n+2,n+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=IE.test(i),c=IE.test(r);return e.addDelimiter(lBt,n,n+2,!o&&(!c||s||l),!s&&(!l||o||c))},after:"Emphasis"}]};function aS(e,t,n=0,i,r=0){let s=0,o=!0,l=-1,c=-1,u=!1,d=()=>{i.push(e.elt("TableCell",r+l,r+c,e.parser.parseInline(t.slice(l,c),r+l)))};for(let f=n;f-1)&&s++,o=!1,i&&(l>-1&&d(),i.push(e.elt("TableDelimiter",f+r,f+r+1))),l=c=-1):(u||h!=32&&h!=9)&&(l<0&&(l=f),c=f+1),u=!u&&h==92}return l>-1&&(s++,i&&d()),s}function Xie(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class Yie{constructor(){this.rows=null}nextLine(t,n,i){if(this.rows==null){this.rows=!1;let r;if((n.next==45||n.next==58||n.next==124)&&h4e.test(r=n.text.slice(n.pos))){let s=[];aS(t,i.content,0,s,i.start)==aS(t,r,0)&&(this.rows=[t.elt("TableHeader",i.start,i.start+i.content.length,s),t.elt("TableDelimiter",t.lineStart+n.pos,t.lineStart+n.text.length)])}}else if(this.rows){let r=[];aS(t,n.text,n.pos,r,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+n.pos,t.lineStart+n.text.length,r))}return!1}finish(t,n){return this.rows?(t.addLeafElement(n,t.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const uBt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":oe.heading}},"TableRow",{name:"TableCell",style:oe.content},{name:"TableDelimiter",style:oe.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return Xie(t.content,0)?new Yie:null},endLeaf(e,t,n){if(n.parsers.some(r=>r instanceof Yie)||!Xie(t.text,t.basePos))return!1;let i=e.peekLine();return h4e.test(i)&&aS(e,t.text,t.basePos)==aS(e,i,t.basePos)},before:"SetextHeading"}]};class dBt{nextLine(){return!1}finish(t,n){return t.addLeafElement(n,t.elt("Task",n.start,n.start+n.content.length,[t.elt("TaskMarker",n.start,n.start+3),...t.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const fBt={defineNodes:[{name:"Task",block:!0,style:oe.list},{name:"TaskMarker",style:oe.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new dBt:null},after:"SetextHeading"}]},Zie=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Jie=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,hBt=/[\w-]+\.[\w-]+($|[/:])/,ere=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,tre=/\/[a-zA-Z\d@.]+/gy;function nre(e,t,n,i){let r=0;for(let s=t;s-1)return-1;let i=t+n[0].length;for(;;){let r=e[i-1],s;if(/[?!.,:*_~]/.test(r)||r==")"&&nre(e,t,i,")")>nre(e,t,i,"("))i--;else if(r==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,i))))i=t+s.index;else break}return i}function ire(e,t){ere.lastIndex=t;let n=ere.exec(e);if(!n)return-1;let i=n[0][n[0].length-1];return i=="_"||i=="-"?-1:t+n[0].length-(i=="."?1:0)}const mBt={parseInline:[{name:"Autolink",parse(e,t,n){let i=n-e.offset;if(i&&/\w/.test(e.text[i-1]))return-1;Zie.lastIndex=i;let r=Zie.exec(e.text),s=-1;if(!r)return-1;if(r[1]||r[2]){if(s=pBt(e.text,i+r[0].length),s>-1&&e.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(i,s));s=i+o[0].length}}else r[3]?s=ire(e.text,i):(s=ire(e.text,i+r[0].length),s>-1&&r[0]=="xmpp:"&&(tre.lastIndex=s,r=tre.exec(e.text),r&&(s=r.index+r[0].length)));return s<0?-1:(e.addElement(e.elt("URL",n,s+e.offset)),s+e.offset)}}]},gBt=[uBt,fBt,cBt,mBt];function p4e(e,t,n){return(i,r,s)=>{if(r!=e||i.char(s+1)==e)return-1;let o=[i.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let are=null,lre=null,cre=0;function SB(e,t){let n=e.pos+t;if(cre==n&&lre==e)return are;let i=e.peek(t),r="";for(;zBt(i);)r+=String.fromCharCode(i),i=e.peek(++t);return lre=e,cre=n,are=r?r.toLowerCase():i==VBt||i==HBt?void 0:null}const O4e=60,ER=62,yH=47,VBt=63,HBt=33,qBt=45;function ure(e,t){this.name=e,this.parent=t}const WBt=[bH,y4e,m4e,g4e,b4e],KBt=new OD({start:null,shift(e,t,n,i){return WBt.indexOf(t)>-1?new ure(SB(i,1)||"",e):e},reduce(e,t){return t==v4e&&e?e.parent:e},reuse(e,t,n,i){let r=t.type.id;return r==bH||r==LBt?new ure(SB(i,1)||"",e):e},strict:!1}),GBt=new yo((e,t)=>{if(e.next!=O4e){e.next<0&&t.context&&e.acceptToken(M3);return}e.advance();let n=e.next==yH;n&&e.advance();let i=SB(e,0);if(i===void 0)return;if(!i)return e.acceptToken(n?NBt:jBt);let r=t.context?t.context.name:null;if(n){if(i==r)return e.acceptToken(TBt);if(r&&QBt[r])return e.acceptToken(M3,-2);if(t.dialectEnabled(FBt))return e.acceptToken(ABt);for(let s=t.context;s;s=s.parent)if(s.name==i)return;e.acceptToken(_Bt)}else{if(i=="script")return e.acceptToken(m4e);if(i=="style")return e.acceptToken(g4e);if(i=="textarea")return e.acceptToken(b4e);if(UBt.hasOwnProperty(i))return e.acceptToken(y4e);r&&ore[r]&&ore[r][i]?e.acceptToken(M3,-1):e.acceptToken(bH)}},{contextual:!0}),XBt=new yo(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(sre);break}if(e.next==qBt)t++;else if(e.next==ER&&t>=2){n>=3&&e.acceptToken(sre,-2);break}else t=0;e.advance()}});function YBt(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const ZBt=new yo((e,t)=>{if(e.next==yH&&e.peek(1)==ER){let n=t.dialectEnabled(BBt)||YBt(t.context);e.acceptToken(n?CBt:rre,2)}else e.next==ER&&e.acceptToken(rre,1)});function vH(e,t,n){let i=2+e.length;return new yo(r=>{for(let s=0,o=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(t);break}if(s==0&&r.next==O4e||s==1&&r.next==yH||s>=2&&so?r.acceptToken(t,-o):r.acceptToken(n,-(o-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(t,1);break}else s=o=0;r.advance()}})}const JBt=vH("script",xBt,wBt),e9t=vH("style",OBt,kBt),t9t=vH("textarea",SBt,EBt),n9t=_p({"Text RawText IncompleteTag IncompleteCloseTag":oe.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":oe.angleBracket,TagName:oe.tagName,"MismatchedCloseTag/TagName":[oe.tagName,oe.invalid],AttributeName:oe.attributeName,"AttributeValue UnquotedAttributeValue":oe.attributeValue,Is:oe.definitionOperator,"EntityReference CharacterReference":oe.character,Comment:oe.blockComment,ProcessingInst:oe.processingInstruction,DoctypeDecl:oe.documentMeta}),i9t=yp.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:KBt,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[n9t],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=l.type.id;if(u==PBt)return L3(l,c,n);if(u==DBt)return L3(l,c,i);if(u==MBt)return L3(l,c,r);if(u==v4e&&s.length){let d=l.node,f=d.firstChild,h=f&&dre(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=k4e(f,c))))){let b=d.lastChild,v=b.type.id==$Bt?b.from:d.to;if(v>f.to)return{parser:g.parser,overlay:[{from:f.to,to:v}]}}}}if(o&&u==x4e){let d=l.node,f;if(f=d.firstChild){let h=o[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=dre(d.parent,c))continue;let g=d.lastChild;if(g.type.id==kB){let b=g.from+1,v=g.lastChild,y=g.to-(v&&v.isError?0:1);if(y>b)return{parser:m.parser,overlay:[{from:b,to:y}],bracketed:!0}}else if(g.type.id==w4e)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const r9t=145,fre=1,s9t=146,o9t=147,E4e=2,a9t=148,l9t=3,c9t=4,C4e=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],u9t=58,d9t=40,T4e=95,f9t=91,uj=45,h9t=46,p9t=35,m9t=37,g9t=38,b9t=92,y9t=10,v9t=42;function PE(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function xH(e){return e>=48&&e<=57}function hre(e){return xH(e)||e>=97&&e<=102||e>=65&&e<=70}const A4e=(e,t,n)=>(i,r)=>{for(let s=!1,o=0,l=0;;l++){let{next:c}=i;if(PE(c)||c==uj||c==T4e||s&&xH(c))!s&&(c!=uj||l>0)&&(s=!0),o===l&&c==uj&&o++,i.advance();else if(c==b9t&&i.peek(1)!=y9t){if(i.advance(),hre(i.next)){do i.advance();while(hre(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&r.canShift(E4e)?t:c==d9t?n:e);break}}},x9t=new yo(A4e(s9t,E4e,o9t),{contextual:!0}),w9t=new yo(A4e(a9t,l9t,c9t),{contextual:!0}),O9t=new yo(e=>{if(C4e.includes(e.peek(-1))){let{next:t}=e;(PE(t)||t==T4e||t==p9t||t==h9t||t==v9t||t==f9t||t==u9t&&PE(e.peek(1))||t==uj||t==g9t)&&e.acceptToken(r9t)}}),k9t=new yo(e=>{if(!C4e.includes(e.peek(-1))){let{next:t}=e;if(t==m9t&&(e.advance(),e.acceptToken(fre)),PE(t)){do e.advance();while(PE(e.next)||xH(e.next));e.acceptToken(fre)}}}),S9t=_p({"AtKeyword import charset namespace keyframes media supports font-feature-values":oe.definitionKeyword,"from to selector scope MatchFlag":oe.keyword,NamespaceName:oe.namespace,KeyframeName:oe.labelName,KeyframeRangeName:oe.operatorKeyword,TagName:oe.tagName,ClassName:oe.className,PseudoClassName:oe.constant(oe.className),IdName:oe.labelName,"FeatureName PropertyName":oe.propertyName,AttributeName:oe.attributeName,NumberLiteral:oe.number,KeywordQuery:oe.keyword,UnaryQueryOp:oe.operatorKeyword,"CallTag ValueName FontName":oe.atom,VariableName:oe.variableName,Callee:oe.operatorKeyword,Unit:oe.unit,"UniversalSelector NestingSelector":oe.definitionOperator,"MatchOp CompareOp":oe.compareOperator,"ChildOp SiblingOp, LogicOp":oe.logicOperator,BinOp:oe.arithmeticOperator,Important:oe.modifier,Comment:oe.blockComment,ColorLiteral:oe.color,"ParenthesizedContent StringLiteral":oe.string,":":oe.punctuation,"PseudoOp #":oe.derefOperator,"; , |":oe.separator,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace}),E9t={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:152,"url-prefix":152,domain:152,regexp:152},C9t={__proto__:null,or:104,and:104,not:112,only:112,layer:206},T9t={__proto__:null,selector:118,style:124,layer:202},A9t={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},_9t={__proto__:null,to:243},j9t=yp.deserialize({version:14,states:"MlQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FnO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#EOO'dQdO'#EQO'oQdO'#EXO'oQdO'#E[OOQP'#Fn'#FnO)RQhO'#E}OOQS'#Fm'#FmOOQS'#FQ'#FQQYQdOOO)YQdO'#EbO*iQhO'#EhO)YQdO'#EjO*pQdO'#ElO*{QdO'#EoO)}QhO'#EuO+TQdO'#EwO+`QdO'#EzO+eQaO'#CfO+lQ`O'#E_O+qQ`O'#F{O+|QdO'#F{QOQ`OOP,WO&jO'#CaPOOO)CA])CA]OOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,cQdO,59YO'_QdO,5:jO'dQdO,5:lO'oQdO,5:sO'oQdO,5:uO'oQdO,5:vO'oQdO'#FXO,nQ`O,58}O,vQdO'#E^OOQS,58},58}OOQP'#Cq'#CqOOQO'#D|'#D|OOQP,59Y,59YO,}Q`O,59YO-SQ`O,59YOOQP'#EP'#EPOOQP,5:j,5:jO-XQpO'#ERO-dQdO'#ESO-iQ`O'#ESO-nQpO,5:lO.XQaO,5:sO.oQaO,5:vOOQW'#D^'#D^O/nQhO'#DgO0RQhO,5;iO)}QhO'#DeO0`Q`O'#DnO0eQhO'#DxOOQW'#Ft'#FtOOQS,5;i,5;iO0jQ`O'#DhO0oQ`O'#DkOOQS-E9O-E9OOOQ['#Cv'#CvO0tQdO'#CwO1[QdO'#C}O1rQdO'#DQO2YQ!pO'#DSO4fQ!jO,5:|OOQO'#DX'#DXO-SQ`O'#DWO4vQ!nO'#FqO6|Q`O'#DYO7RQ`O'#DyOOQ['#Fq'#FqO7WQhO'#GOO7fQ`O,5;SO7kQ!bO,5;UOOQS'#En'#EnO7sQ`O,5;WO7xQdO,5;WOOQO'#Eq'#EqO8QQ`O,5;ZO8VQhO,5;aO'oQdO'#DjOOQS,5;c,5;cO0jQ`O,5;cO8_QdO,5;cOOQS'#F`'#F`O8gQdO'#E|O7fQ`O,5;fO8oQdO,5:yO9PQdO'#FZO9^Q`O,5lQhO'#DoOOQW,5:Y,5:YOOQW,5:d,5:dOOQW,5:S,5:SO>vQhO,5:VO?bQ!fO'#FrOOQS'#Fr'#FrOOQS'#FS'#FSO@rQdO,59cOOQ[,59c,59cOAYQdO,59iOOQ[,59i,59iOApQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)YQdO,59pOBWQhO'#EdOOQW'#Ed'#EdOBuQ`O1G0hO4oQhO1G0hOOQ[,59r,59rO)}QhO'#D[OOQ[,59t,59tOBzQ#tO,5:eOCVQhO'#F]OCdQ`O,5vQhO'#DmOI_QhO'#DqOIgQhO'#DsOIlQhO'#FwOOQO'#Fw'#FwOItQ!bO'#DwOOQO'#Fy'#FyOOQO'#Fv'#FvOIyQ`O1G/qOOQS-E9Q-E9QOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OJOQdO,5;OOOQS7+&S7+&SOJTQ`O7+&SOJYQhO'#D]OJbQ`O,59vO)}QhO,59vOOQ[1G0P1G0POJjQ`O1G0POJoQhO,5;wOOQO-E9Z-E9ZOOQS7+&^7+&^OJ}QbO'#DSOOQO'#Et'#EtOK]Q`O'#EsOOQO'#Es'#EsOKhQ`O'#F^OKpQdO,5;^OOQS,5;^,5;^OOQ[1G/p1G/pOOQS7+&i7+&iO7fQ`O7+&iOK{Q!fO'#FYO)YQdO'#FYOMSQdO7+&POOQO7+&P7+&POOQO,5:{,5:{OOQO1G1a1G1aOMgQ!bO<vQhO'#DrOOQO,5:],5:]O! hQhO,5:_OGUQhO,5:cOOQW7+%]7+%]OOQO'#Ef'#EfO! pQ`O1G0jOOQS<xAN>xO!#zQ`OAN>xO!$PQaO,5;rOOQO-E9U-E9UO!$ZQdO,5;qOOQO-E9T-E9TOOQW<vQhO'#DuOOQO1G/y1G/yO!%vQ!bO1G/}OJOQdO'#F[O!&OQ`O7+&UOOQW7+&U7+&UO!&WQ!bO1G/cOOQ[7+$|7+$|O!&cQhO7+$|P!&jQ`O'#FTOOQO,5;y,5;yOOQO-E9]-E9]OOQS1G1d1G1dOOQPG24dG24dO!&oQ`OAN>ZO)YQdO1G1[O!&tQ`O7+'jOOQO1G/x1G/xO!&|Q`O,5:aO!$eQhO7+%iOOQO,5;v,5;vOOQO-E9Y-E9YOOQW<Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!o`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$[~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$[~!o`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$qYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!o`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!o`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!o`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!o`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!o`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!o`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!o`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!o`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!yS!o`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW#PQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!o`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!o`$gYOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!o`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!o`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!o`$gYOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!o`$gYOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!dYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!o`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!o`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!ySOy%jz;'S%j;'S;=`%{<%lO%jj@uV!|Q!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!|Q!o`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!o`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!o`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!zWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!zWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!o`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!o`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!o`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!o`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!o`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!o`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!o`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$pQ!o`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$cUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU#PQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[O9t,k9t,x9t,w9t,1,2,3,4,new xR("m~RRYZ[z{a~~g~aO$_~~dP!P!Qg~lO$`~~",28,152)],topRules:{StyleSheet:[0,6],Styles:[1,126]},dynamicPrecedences:{94:1},specialized:[{term:147,get:e=>E9t[e]||-1},{term:148,get:e=>C9t[e]||-1},{term:4,get:e=>T9t[e]||-1},{term:28,get:e=>A9t[e]||-1},{term:146,get:e=>_9t[e]||-1}],tokenPrec:2405});let $3=null;function F3(){if(!$3&&typeof document=="object"&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let i in e)i!="cssText"&&i!="cssFloat"&&typeof e[i]=="string"&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),n.has(i)||(t.push(i),n.add(i)));$3=t.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return $3||[]}const pre=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),mre=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),N9t=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),R9t=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),uh=/^(\w[\w-]*|-\w[\w-]*|)$/,I9t=/^-(-[\w-]*)?$/;function P9t(e,t){var n;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let i=(n=e.parent)===null||n===void 0?void 0:n.firstChild;return(i==null?void 0:i.name)!="Callee"?!1:t.sliceString(i.from,i.to)=="var"}const gre=new NV,D9t=["Declaration"];function M9t(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function _4e(e,t,n){if(t.to-t.from>4096){let i=gre.get(t);if(i)return i;let r=[],s=new Set,o=t.cursor(cr.IncludeAnonymous);if(o.firstChild())do for(let l of _4e(e,o.node,n))s.has(l.label)||(s.add(l.label),r.push(l));while(o.nextSibling());return gre.set(t,r),r}else{let i=[],r=new Set;return t.cursor().iterate(s=>{var o;if(n(s)&&s.matchContext(D9t)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=e.sliceString(s.from,s.to);r.has(l)||(r.add(l),i.push({label:l,type:"variable"}))}}),i}}const L9t=e=>t=>{let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.type.isError&&r.from==r.to-1&&n.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:F3(),validFor:uh};if(r.name=="ValueName")return{from:r.from,options:mre,validFor:uh};if(r.name=="PseudoClassName")return{from:r.from,options:pre,validFor:uh};if(e(r)||(t.explicit||s)&&P9t(r,n.doc))return{from:e(r)||s?r.from:i,options:_4e(n.doc,M9t(r),e),validFor:I9t};if(r.name=="TagName"){for(let{parent:c}=r;c;c=c.parent)if(c.name=="Block")return{from:r.from,options:F3(),validFor:uh};return{from:r.from,options:N9t,validFor:uh}}if(r.name=="AtKeyword")return{from:r.from,options:R9t,validFor:uh};if(!t.explicit)return null;let o=r.resolve(i),l=o.childBefore(i);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:i,options:pre,validFor:uh}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:i,options:mre,validFor:uh}:o.name=="Block"||o.name=="Styles"?{from:i,options:F3(),validFor:uh}:null},$9t=L9t(e=>e.name=="VariableName"),CR=bp.define({name:"css",parser:j9t.configure({props:[jp.add({Declaration:vx()}),Np.add({"Block KeyframeList":sT})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function F9t(){return new xg(CR,CR.data.of({autocomplete:$9t}))}const vO=["_blank","_self","_top","_parent"],B3=["ascii","utf-8","utf-16","latin1","latin1"],U3=["get","post","put","delete"],Q3=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ac=["true","false"],Sn={},B9t={a:{attrs:{href:null,ping:null,type:null,media:null,target:vO,hreflang:null}},abbr:Sn,address:Sn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Sn,aside:Sn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Sn,base:{attrs:{href:null,target:vO}},bdi:Sn,bdo:Sn,blockquote:{attrs:{cite:null}},body:Sn,br:Sn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Q3,formmethod:U3,formnovalidate:["novalidate"],formtarget:vO,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Sn,center:Sn,cite:Sn,code:Sn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Sn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Sn,div:Sn,dl:Sn,dt:Sn,em:Sn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Sn,figure:Sn,footer:Sn,form:{attrs:{action:null,name:null,"accept-charset":B3,autocomplete:["on","off"],enctype:Q3,method:U3,novalidate:["novalidate"],target:vO}},h1:Sn,h2:Sn,h3:Sn,h4:Sn,h5:Sn,h6:Sn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Sn,hgroup:Sn,hr:Sn,html:{attrs:{manifest:null}},i:Sn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Q3,formmethod:U3,formnovalidate:["novalidate"],formtarget:vO,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Sn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Sn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Sn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:B3,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Sn,noscript:Sn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Sn,param:{attrs:{name:null,value:null}},pre:Sn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Sn,rt:Sn,ruby:Sn,samp:Sn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:B3}},section:Sn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Sn,source:{attrs:{src:null,type:null,media:null}},span:Sn,strong:Sn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Sn,summary:Sn,sup:Sn,table:Sn,tbody:Sn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Sn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Sn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Sn,time:{attrs:{datetime:null}},title:Sn,tr:Sn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Sn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Sn},j4e={accesskey:null,class:null,contenteditable:Ac,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ac,autocorrect:Ac,autocapitalize:Ac,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ac,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ac,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ac,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ac,"aria-hidden":Ac,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ac,"aria-multiselectable":Ac,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ac,"aria-relevant":null,"aria-required":Ac,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},N4e="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of N4e)j4e[e]=null;class DE{constructor(t,n){this.tags={...B9t,...t},this.globalAttrs={...j4e,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}DE.default=new DE;function ww(e,t,n=e.length){if(!t)return"";let i=t.firstChild,r=i&&i.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,n)):""}function Ow(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function R4e(e,t,n){let i=n.tags[ww(e,Ow(t))];return(i==null?void 0:i.children)||n.allTags}function wH(e,t){let n=[];for(let i=Ow(t);i&&!i.type.isTop;i=Ow(i.parent)){let r=ww(e,i);if(r&&i.lastChild.name=="CloseTag")break;r&&n.indexOf(r)<0&&(t.name=="EndTag"||t.from>=i.firstChild.to)&&n.push(r)}return n}const I4e=/^[:\-\.\w\u00b7-\uffff]*$/;function bre(e,t,n,i,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">",o=Ow(n,n.name=="StartTag"||n.name=="TagName");return{from:i,to:r,options:R4e(e.doc,o,t).map(l=>({label:l,type:"type"})).concat(wH(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function yre(e,t,n,i){let r=/\s*>/.test(e.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:wH(e.doc,t).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:I4e}}function U9t(e,t,n,i){let r=[],s=0;for(let o of R4e(e.doc,n,t))r.push({label:"<"+o,type:"type"});for(let o of wH(e.doc,n))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Q9t(e,t,n,i,r){let s=Ow(n),o=s?t.tags[ww(e.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:i,to:r,options:c.map(u=>({label:u,type:"property"})),validFor:I4e}}function z9t(e,t,n,i,r){var s;let o=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(o){let u=e.sliceDoc(o.from,o.to),d=t.globalAttrs[u];if(!d){let f=Ow(n),h=f?t.tags[ww(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(i,r).toLowerCase(),h='"',m='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",m=e.sliceDoc(r,r+1)==f[0]?"":f[0],f=f.slice(1),i++):c=/^[^\s<>='"]*$/;for(let g of d)l.push({label:g,apply:h+g+m,type:"constant"})}}return{from:i,to:r,options:l,validFor:c}}function P4e(e,t){let{state:n,pos:i}=t,r=Lr(n).resolveInner(i,-1),s=r.resolve(i);for(let o=i,l;s==r&&(l=r.childBefore(o));){let c=l.lastChild;if(!c||!c.type.isError||c.fromP4e(i,r)}const q9t=Rf.parser.configure({top:"SingleExpression"}),D4e=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Q3e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:z3e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:V3e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:q9t},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Rf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:CR.parser}],M4e=[{name:"style",parser:CR.parser.configure({top:"Styles"})}].concat(N4e.map(e=>({name:e,parser:Rf.parser}))),L4e=bp.define({name:"html",parser:i9t.configure({props:[jp.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),dj=L4e.configure({wrap:S4e(D4e,M4e)});function W9t(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=S4e((e.nestedLanguages||[]).concat(D4e),(e.nestedAttributes||[]).concat(M4e)));let i=n?L4e.configure({wrap:n,dialect:t}):t?dj.configure({dialect:t}):dj;return new xg(i,[dj.data.of({autocomplete:H9t(e)}),e.autoCloseTags!==!1?K9t:[],yB().support,F9t().support])}const vre=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),K9t=Xt.inputHandler.of((e,t,n,i,r)=>{if(e.composing||e.state.readOnly||t!=n||i!=">"&&i!="/"||!dj.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(c=>{var u,d,f;let h=o.doc.sliceString(c.from-1,c.to)==i,{head:m}=c,g=Lr(o).resolveInner(m,-1),b;if(h&&i==">"&&g.name=="EndTag"){let v=g.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=ww(o.doc,v.parent,m))&&!vre.has(b)){let y=m+(o.doc.sliceString(m,m+1)===">"?1:0),x=``;return{range:c,changes:{from:m,to:y,insert:x}}}}else if(h&&i=="/"&&g.name=="IncompleteCloseTag"){let v=g.parent;if(g.from==m-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=ww(o.doc,v,m))&&!vre.has(b)){let y=m+(o.doc.sliceString(m,m+1)===">"?1:0),x=`${b}>`;return{range:ut.cursor(m+x.length,-1),changes:{from:m,to:y,insert:x}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),$4e=vD({commentTokens:{block:{open:""}}}),F4e=new Kn,B4e=sBt.configure({props:[Np.add(e=>!e.is("Block")||e.is("Document")||EB(e)!=null||G9t(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),F4e.add(EB),jp.add({Document:()=>null}),_m.add({Document:$4e})]});function EB(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function G9t(e){return e.name=="OrderedList"||e.name=="BulletList"}function X9t(e,t){let n=e;for(;;){let i=n.nextSibling,r;if(!i||(r=EB(i.type))!=null&&r<=t)break;n=i}return n.to}const Y9t=s3e.of((e,t,n)=>{for(let i=Lr(e).resolveInner(n,-1);i&&!(i.fromn)return{from:n,to:s}}return null});function OH(e){return new qc($4e,e,[],"markdown")}const Z9t=OH(B4e),J9t=B4e.configure([gBt,yBt,bBt,vBt,{props:[Np.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),TR=OH(J9t);function e7t(e,t){return n=>{if(n&&e){let i=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?i=e(n):i=mR.matchLanguageName(e,n,!0),i instanceof mR)return i.support?i.support.language.parser:_y.getSkippingParser(i.load());if(i)return i.parser}return t?t.parser:null}}let z3=class{constructor(t,n,i,r,s,o,l){this.node=t,this.from=n,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(t,n=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;i.length0;r--)i+=" ";return i+(n?this.spaceAfter:"")}}marker(t,n){let i=this.node.name=="OrderedList"?String(+Q4e(this.item,t)[2]+n):"";return this.spaceBefore+i+this.type+this.spaceAfter}};function U4e(e,t){let n=[],i=[];for(let r=e;r;r=r.parent){if(r.name=="FencedCode")return i;(r.name=="ListItem"||r.name=="Blockquote")&&n.push(r)}for(let r=n.length-1;r>=0;r--){let s=n[r],o,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(c))))i.push(new z3(s,c,c+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),i.push(new z3(s.parent,c,c+d,o[1],u,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),i.push(new z3(s.parent,c,c+d,o[1],u,f,s))}}return i}function Q4e(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function V3(e,t,n,i=0){for(let r=-1,s=e;;){if(s.name=="ListItem"){let l=Q4e(s,t),c=+l[2];if(r>=0){if(c!=r+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+i)})}r=c}let o=s.nextSibling;if(!o)break;s=o}}function kH(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(f1)!=" ")return e;let i=Id(e,4,n),r="";for(let s=i;s>0;)s>=4?(r+=" ",s-=4):(r+=" ",s--);return r+e.slice(n)}const t7t=(e={})=>({state:t,dispatch:n})=>{let i=Lr(t),{doc:r}=t,s=null,o=t.changeByRange(l=>{if(!l.empty||!TR.isActiveAt(t,l.from,-1)&&!TR.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=r.lineAt(c),d=U4e(i.resolveInner(c,-1),r);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let y=f.node.firstChild,x=f.node.getChild("ListItem","ListItem");if(y.to>=c||x&&x.to0&&!/[^\s>]/.test(r.lineAt(u.from-1).text)||e.nonTightLists===!1){let w=d.length>1?d[d.length-2]:null,O,S="";w&&w.item?(O=u.from+w.from,S=w.marker(r,1)):O=u.from+(w?w.to:0);let k=[{from:O,to:c,insert:S}];return f.node.name=="OrderedList"&&V3(f.item,r,k,-2),w&&w.node.name=="OrderedList"&&V3(w.item,r,k),{range:ut.cursor(O+S.length),changes:k}}else{let w=wre(d,t,u);return{range:ut.cursor(c+w.length+1),changes:{from:u.from,insert:w+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let y=r.lineAt(u.from-1),x=/>\s*$/.exec(y.text);if(x&&x.index==f.from){let w=t.changes([{from:y.from+x.index,to:y.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(w),changes:w}}}let m=[];f.node.name=="OrderedList"&&V3(f.item,r,m);let g=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let y=0,x=d.length-1;y<=x;y++)b+=y==x&&!g?d[y].marker(r,1):d[y].blank(yu.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return b=kH(b,t),i7t(f.node,t.doc)&&(b=wre(d,t,u)+t.lineBreak+b),m.push({from:v,to:c,insert:t.lineBreak+b}),{range:ut.cursor(v+b.length+1),changes:m}});return s?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},n7t=t7t();function xre(e){return e.name=="QuoteMark"||e.name=="ListMark"}function i7t(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,i=e.getChild("ListItem","ListItem");if(!i)return!1;let r=t.lineAt(n.to),s=t.lineAt(i.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1){let n=Lr(e),i=null,r=e.changeByRange(s=>{let o=s.from,{doc:l}=e;if(s.empty&&TR.isActiveAt(e,s.from)){let c=l.lineAt(o),u=U4e(r7t(n,o),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>f&&!/\S/.test(c.text.slice(f,o-c.from)))return{range:ut.cursor(c.from+f),changes:{from:c.from+f,to:o}};if(o-c.from==f&&(d.item&&c.from<=d.item.from||/^[\s>]*$/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from{var n;let{main:i}=t.state.selection;if(i.empty)return!1;let r=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!TR.isActiveAt(t.state,i.from,1)))return!1;let s=Lr(t.state),o=!1;return s.iterate({from:i.from,to:i.to,enter:l=>{(l.from>i.from||u7t.test(l.name))&&(o=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const dUt=new yo((e,t)=>{let n;if(e.next<0)e.acceptToken(m7t);else if(t.context.flags&fj)q3(e.next)&&e.acceptToken(p7t,1);else if(((n=e.peek(-1))<0||q3(n))&&t.canShift(Ore)){let i=0;for(;e.next==SH||e.next==ED;)e.advance(),i++;(e.next==Ry||e.next==ME||e.next==EH)&&e.acceptToken(Ore,-i)}else q3(e.next)&&e.acceptToken(h7t,1)},{contextual:!0}),fUt=new yo((e,t)=>{let n=t.context;if(n.flags)return;let i=e.peek(-1);if(i==Ry||i==ME){let r=0,s=0;for(;;){if(e.next==SH)r++;else if(e.next==ED)r+=8-r%8;else break;e.advance(),s++}r!=n.indent&&e.next!=Ry&&e.next!=ME&&e.next!=EH&&(r[e,t|X4e])),mUt=new OD({start:hUt,reduce(e,t,n,i){return e.flags&fj&&uUt.has(t)||(t==R7t||t==W4e)&&e.flags&X4e?e.parent:e},shift(e,t,n,i){return t==V4e?new hj(e,pUt(i.read(i.pos,n.pos)),0):t==H4e?e.parent:t==y7t||t==O7t||t==E7t||t==q4e?new hj(e,0,fj):Cre.has(t)?new hj(e,0,Cre.get(t)|e.flags&fj):e},hash(e){return e.hash}}),gUt=new yo(e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(!(n==SH||n==ED)){n!=iUt&&n!=rUt&&n!=Ry&&n!=ME&&n!=EH&&e.acceptToken(f7t);return}}}),bUt=new yo((e,t)=>{let{flags:n}=t.context,i=n&bh?G4e:K4e,r=(n&yh)>0,s=!(n&vh),o=(n&xh)>0,l=e.pos;for(;!(e.next<0);)if(o&&e.next==CB)if(e.peek(1)==CB)e.advance(2);else{if(e.pos==l){e.acceptToken(q4e,1);return}break}else if(s&&e.next==Ere){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),yUt(e,c)),e.acceptToken(b7t);return}break}else if(e.next==Ere&&!s&&e.peek(1)>-1)e.advance(2);else if(e.next==i&&(!r||e.peek(1)==i&&e.peek(2)==i)){if(e.pos==l){e.acceptToken(kre,r?3:1);return}break}else if(e.next==Ry){if(r)e.advance();else if(e.pos==l){e.acceptToken(kre);return}break}else e.advance();e.pos>l&&e.acceptToken(g7t)});function yUt(e,t){if(t==sUt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==oUt)for(let n=0;n<2&&W3(e.next);n++)e.advance();else if(t==lUt)for(let n=0;n<4&&W3(e.next);n++)e.advance();else if(t==cUt)for(let n=0;n<8&&W3(e.next);n++)e.advance();else if(t==aUt&&e.next==CB){for(e.advance();e.next>=0&&e.next!=Sre&&e.next!=K4e&&e.next!=G4e&&e.next!=Ry;)e.advance();e.next==Sre&&e.advance()}}const vUt=_p({'async "*" "**" FormatConversion FormatSpec':oe.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":oe.controlKeyword,"in not and or is del":oe.operatorKeyword,"from def class global nonlocal lambda":oe.definitionKeyword,import:oe.moduleKeyword,"with as print":oe.keyword,Boolean:oe.bool,None:oe.null,VariableName:oe.variableName,"CallExpression/VariableName":oe.function(oe.variableName),"FunctionDefinition/VariableName":oe.function(oe.definition(oe.variableName)),"ClassDefinition/VariableName":oe.definition(oe.className),PropertyName:oe.propertyName,"CallExpression/MemberExpression/PropertyName":oe.function(oe.propertyName),Comment:oe.lineComment,Number:oe.number,String:oe.string,FormatString:oe.special(oe.string),Escape:oe.escape,UpdateOp:oe.updateOperator,"ArithOp!":oe.arithmeticOperator,BitOp:oe.bitwiseOperator,CompareOp:oe.compareOperator,AssignOp:oe.definitionOperator,Ellipsis:oe.punctuation,At:oe.meta,"( )":oe.paren,"[ ]":oe.squareBracket,"{ }":oe.brace,".":oe.derefOperator,", ;":oe.separator}),xUt={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},wUt=yp.deserialize({version:14,states:"##jQ`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[gUt,fUt,dUt,bUt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>xUt[e]||-1}],tokenPrec:7668}),Tre=new NV,Y4e=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function N2(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const OUt={FunctionDefinition:N2("function"),ClassDefinition:N2("class"),ForStatement(e,t,n){if(n){for(let i=e.node.firstChild;i;i=i.nextSibling)if(i.name=="VariableName")t(i,"variable");else if(i.name=="in")break}},ImportStatement(e,t){var n,i;let{node:r}=e,s=((n=r.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let o=r.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((i=o.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&t(o,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")t(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(e,t){for(let n=null,i=e.node.firstChild;i;i=i.nextSibling)i.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&t(i,"variable"),n=i},CapturePattern:N2("variable"),AsPattern:N2("variable"),__proto__:null};function Z4e(e,t){let n=Tre.get(t);if(n)return n;let i=[],r=!0;function s(o,l){let c=e.sliceString(o.from,o.to);i.push({label:c,type:l})}return t.cursor(cr.IncludeAnonymous).iterate(o=>{if(o.name){let l=OUt[o.name];if(l&&l(o,s,r)||!r&&Y4e.has(o.name))return!1;r=!1}else if(o.to-o.from>8192){for(let l of Z4e(e,o.node))i.push(l);return!1}}),Tre.set(t,i),i}const Are=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,J4e=["String","FormatString","Comment","PropertyName"];function kUt(e){let t=Lr(e.state).resolveInner(e.pos,-1);if(J4e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&Are.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let r=t;r;r=r.parent)Y4e.has(r.name)&&(i=i.concat(Z4e(e.state.doc,r)));return{options:i,from:n?t.from:e.pos,validFor:Are}}const SUt=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(e=>({label:e,type:"function"}))),EUt=[Ms("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ms("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ms("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ms("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ms(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),Ms("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ms("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ms("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ms("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],SUt=T3e(J4e,rH(OUt.concat(kUt)));function K3(e){let{node:t,pos:n}=e,i=e.lineIndent(n,-1),r=null;for(;;){let s=t.childBefore(n);if(s)if(s.name=="Comment")n=s.from;else if(s.name=="Body"||s.name=="MatchBody")e.baseIndentFor(s)+e.unit<=i&&(r=s),t=s;else if(s.name=="MatchClause")t=s;else if(s.type.is("Statement"))t=s;else break;else break}return r}function G3(e,t){let n=e.baseIndentFor(t),i=e.lineAt(e.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&e.node.ton?null:n+e.unit}const X3=bp.define({name:"python",parser:vUt.configure({props:[jp.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&K3(e)||e.node;return(t=G3(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=K3(e);return(t=G3(e,n||e.node))!==null&&t!==void 0?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":yx({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":yx({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":yx({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=K3(e);return(t=n&&G3(e,n))!==null&&t!==void 0?t:e.continue()}}),Np.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":sT,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function EUt(){return new xg(X3,[X3.data.of({autocomplete:wUt}),X3.data.of({autocomplete:SUt})])}const uv=63,_re=64,CUt=1,TUt=2,e$e=3,AUt=4,t$e=5,_Ut=6,jUt=7,n$e=65,NUt=66,RUt=8,IUt=9,PUt=10,DUt=11,MUt=12,i$e=13,LUt=19,$Ut=20,FUt=29,BUt=33,UUt=34,QUt=47,zUt=0,CH=1,TB=2,LE=3,AB=4;class Cb{constructor(t,n,i){this.parent=t,this.depth=n,this.type=i,this.hash=(t?t.hash+t.hash<<8:0)+n+(n<<4)+i}}Cb.top=new Cb(null,-1,zUt);function lS(e,t){for(let n=0,i=t-e.pos-1;;i--,n++){let r=e.peek(i);if(vp(r)||r==-1)return n}}function _B(e){return e==32||e==9}function vp(e){return e==10||e==13}function r$e(e){return _B(e)||vp(e)}function Bb(e){return e<0||r$e(e)}const VUt=new OD({start:Cb.top,reduce(e,t){return e.type==LE&&(t==$Ut||t==UUt)?e.parent:e},shift(e,t,n,i){if(t==e$e)return new Cb(e,lS(i,i.pos),CH);if(t==n$e||t==t$e)return new Cb(e,lS(i,i.pos),TB);if(t==uv)return e.parent;if(t==LUt||t==BUt)return new Cb(e,0,LE);if(t==i$e&&e.type==AB)return e.parent;if(t==QUt){let r=/[1-9]/.exec(i.read(i.pos,n.pos));if(r)return new Cb(e,e.depth+ +r[0],AB)}return e},hash(e){return e.hash}});function kw(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&Bb(e.peek(n+3))}const HUt=new yo((e,t)=>{if(e.next==-1&&t.canShift(_re))return e.acceptToken(_re);let n=e.peek(-1);if((vp(n)||n<0)&&t.context.type!=LE){if(kw(e,45))if(t.canShift(uv))e.acceptToken(uv);else return e.acceptToken(CUt,3);if(kw(e,46))if(t.canShift(uv))e.acceptToken(uv);else return e.acceptToken(TUt,3);let i=0;for(;e.next==32;)i++,e.advance();(i{if(t.context.type==LE){e.next==63&&(e.advance(),Bb(e.next)&&e.acceptToken(jUt));return}if(e.next==45)e.advance(),Bb(e.next)&&e.acceptToken(t.context.type==CH&&t.context.depth==lS(e,e.pos-1)?AUt:e$e);else if(e.next==63)e.advance(),Bb(e.next)&&e.acceptToken(t.context.type==TB&&t.context.depth==lS(e,e.pos-1)?_Ut:t$e);else{let n=e.pos;for(;;)if(_B(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)s$e(e);else if(e.next==38)jB(e);else if(e.next==42){jB(e);break}else if(e.next==39||e.next==34){if(TH(e,!0))break;return}else if(e.next==91||e.next==123){if(!KUt(e))return;break}else{o$e(e,!0,!1,0);break}for(;_B(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(FUt))return;let i=e.peek(1);Bb(i)&&e.acceptTokenTo(t.context.type==TB&&t.context.depth==lS(e,n)?NUt:n$e,n)}}},{contextual:!0});function WUt(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function jre(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Nre(e,t){return e.next==37?(e.advance(),jre(e.next)&&e.advance(),jre(e.next)&&e.advance(),!0):WUt(e.next)||t&&e.next==44?(e.advance(),!0):!1}function s$e(e){if(e.advance(),e.next==60){for(e.advance();;)if(!Nre(e,!0)){e.next==62&&e.advance();break}}else for(;Nre(e,!1););}function jB(e){for(e.advance();!Bb(e.next)&&AR(e.next)!="f";)e.advance()}function TH(e,t){let n=e.next,i=!1,r=e.pos;for(e.advance();;){let s=e.next;if(s<0)break;if(e.advance(),s==n)if(s==39)if(e.next==39)e.advance();else break;else break;else if(s==92&&n==34)e.next>=0&&e.advance();else if(vp(s)){if(t)return!1;i=!0}else if(t&&e.pos>=r+1024)return!1}return!i}function KUt(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!TH(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else{if(e.next<0||e.pos>n||vp(e.next))return!1;e.advance()}}const GUt="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function AR(e){return e<33?"u":e>125?"s":GUt[e-33]}function Y3(e,t){let n=AR(e);return n!="u"&&!(t&&n=="f")}function o$e(e,t,n,i){if(AR(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&Y3(e.peek(1),n))e.advance();else return!1;let r=e.pos;for(;;){let s=e.next,o=0,l=i+1;for(;r$e(s);){if(vp(s)){if(t)return!1;l=0}else l++;s=e.peek(++o)}if(!(s>=0&&(s==58?Y3(e.peek(o+1),n):s==35?e.peek(o-1)!=32:Y3(s,n)))||!n&&l<=i||l==0&&!n&&(kw(e,45,o)||kw(e,46,o)))break;if(t&&AR(s)=="f")return!1;for(let u=o;u>=0;u--)e.advance();if(t&&e.pos>r+1024)return!1}return!0}const XUt=new yo((e,t)=>{if(e.next==33)s$e(e),e.acceptToken(MUt);else if(e.next==38||e.next==42){let n=e.next==38?PUt:DUt;jB(e),e.acceptToken(n)}else e.next==39||e.next==34?(TH(e,!1),e.acceptToken(IUt)):o$e(e,!1,t.context.type==LE,t.context.depth)&&e.acceptToken(RUt)}),YUt=new yo((e,t)=>{let n=t.context.type==AB?t.context.depth:-1,i=e.pos;e:for(;;){let r=0,s=e.next;for(;s==32;)s=e.peek(++r);if(!r&&(kw(e,45,r)||kw(e,46,r))||!vp(s)&&(n<0&&(n=Math.max(t.context.depth+1,r)),rYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:VUt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[ZUt],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[HUt,qUt,XUt,YUt,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),eQt=bp.define({name:"yaml",parser:JUt.configure({props:[jp.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name=="BlockLiteralContent"&&t.frome.pos)return null}}return null},FlowMapping:yx({closing:"}"}),FlowSequence:yx({closing:"]"})}),Np.add({"FlowMapping FlowSequence":sT,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function tQt(){return new xg(eQt)}function nQt(e){a$e(e,"start");var t={},n=e.languageData||{},i=!1;for(var r in e)if(r!=n&&e.hasOwnProperty(r))for(var s=t[r]=[],o=e[r],l=0;l2&&o.token&&typeof o.token!="string"){n.pending=[];for(var u=2;u-1)return null;var r=n.indent.length-1,s=e[n.state];e:for(;;){for(var o=0;o{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=_H(e.state,n.from);return i.line?yQt(e):i.block?xQt(e):!1};function AH(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(i(n.update(r)),!0):!1}}const yQt=AH(kQt,0),vQt=AH(f$e,0),xQt=AH((e,t)=>f$e(e,t,OQt(t)),0);function _H(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const xO=50;function wQt(e,{open:t,close:n},i,r){let s=e.sliceDoc(i-xO,i),o=e.sliceDoc(r,r+xO),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+c,margin:c&&1}};let d,f;r-i<=2*xO?d=f=e.sliceDoc(i,r):(d=e.sliceDoc(i,i+xO),f=e.sliceDoc(r-xO,r));let h=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(f)[0].length,g=f.length-m-n.length;return d.slice(h,h+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:i+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:r-m-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function OQt(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function f$e(e,t,n=t.selection.ranges){let i=n.map(s=>_H(t,s.from).block);if(!i.every(s=>s))return null;let r=n.map((s,o)=>wQt(t,i[o],s.from,s.to));if(e!=2&&!r.every(s=>s))return{changes:t.changes(n.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(e!=1&&r.some(s=>s)){let s=[];for(let o=0,l;or&&(s==o||o>f.from)){r=f.from;let h=/^\s*/.exec(f.text)[0].length,m=h==f.length,g=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of i)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:c}of i)if(l>=0){let u=o.from+l,d=u+c.length;o.text[d-o.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const RB=qf.define(),SQt=qf.define(),EQt=an.define(),h$e=an.define({combine(e){return Wf(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),p$e=Qa.define({create(){return Sf.empty},update(e,t){let n=t.state.facet(h$e),i=t.annotation(RB);if(i){let c=oc.fromTransaction(t,i.selection),u=i.side,d=u==0?e.undone:e.done;return c?d=_R(d,d.length,n.minDepth,c):d=b$e(d,t.startState.selection),new Sf(u==0?i.rest:d,u==0?d:i.rest)}let r=t.annotation(SQt);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Ro.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=oc.fromTransaction(t),o=t.annotation(Ro.time),l=t.annotation(Ro.userEvent);return s?e=e.addChanges(s,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Sf(e.done.map(oc.fromJSON),e.undone.map(oc.fromJSON))}});function CQt(e={}){return[p$e,h$e.of(e),Xt.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?m$e:t.inputType=="historyRedo"?IB:null;return i?(t.preventDefault(),i(n)):!1}})]}function CD(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(p$e,!1);if(!r)return!1;let s=r.pop(e,n,t);return s?(i(s),!0):!1}}const m$e=CD(0,!1),IB=CD(1,!1),TQt=CD(0,!0),AQt=CD(1,!0);class oc{constructor(t,n,i,r,s){this.changes=t,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(t){return new oc(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,i;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new oc(t.changes&&Go.fromJSON(t.changes),[],t.mapped&&Nf.fromJSON(t.mapped),t.startSelection&&ut.fromJSON(t.startSelection),t.selectionsAfter.map(ut.fromJSON))}static fromTransaction(t,n){let i=$u;for(let r of t.startState.facet(EQt)){let s=r(t);s.length&&(i=i.concat(s))}return!i.length&&t.changes.empty?null:new oc(t.changes.invert(t.startState.doc),i,void 0,n||t.startState.selection,$u)}static selection(t){return new oc(void 0,$u,void 0,void 0,t)}}function _R(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function _Qt(e,t){let n=[],i=!1;return e.iterChangedRanges((r,s)=>n.push(r,s)),t.iterChangedRanges((r,s,o,l)=>{for(let c=0;c=u&&o<=d&&(i=!0)}}),i}function jQt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function g$e(e,t){return e.length?t.length?e.concat(t):e:t}const $u=[],NQt=200;function b$e(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-NQt));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),_R(e,e.length-1,1e9,n.setSelAfter(i)))}else return[oc.selection([t])]}function RQt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Z3(e,t){if(!e.length)return e;let n=e.length,i=$u;for(;n;){let r=IQt(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=e.slice(0,n);return s[n-1]=r,s}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[oc.selection(i)]:$u}function IQt(e,t,n){let i=g$e(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):$u,n);if(!e.changes)return oc.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new oc(r,Gn.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const PQt=/^(input\.type|delete)($|\.)/;class Sf{constructor(t,n,i=0,r=void 0){this.done=t,this.undone=n,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new Sf(this.done,this.undone):this}addChanges(t,n,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!i||PQt.test(i))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):TD(n,t))}function cl(e){return e.textDirectionAt(e.state.selection.main.head)==Qr.LTR}const v$e=e=>y$e(e,!cl(e)),x$e=e=>y$e(e,cl(e));function w$e(e,t){return Vd(e,n=>n.empty?e.moveByGroup(n,t):TD(n,t))}const MQt=e=>w$e(e,!cl(e)),LQt=e=>w$e(e,cl(e));function $Qt(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function AD(e,t,n){let i=Lr(e).resolveInner(t.head),r=n?Kn.closedBy:Kn.openedBy;for(let c=t.head;;){let u=n?i.childAfter(c):i.childBefore(c);if(!u)break;$Qt(e,u,r)?i=u:c=n?u.to:u.from}let s=i.type.prop(r),o,l;return s&&(o=n?kf(e,i.from,1):kf(e,i.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?i.to:i.from,ut.cursor(l,n?-1:1)}const FQt=e=>Vd(e,t=>AD(e.state,t,!cl(e))),BQt=e=>Vd(e,t=>AD(e.state,t,cl(e)));function O$e(e,t){return Vd(e,n=>{if(!n.empty)return TD(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}const k$e=e=>O$e(e,!1),S$e=e=>O$e(e,!0);function E$e(e){let t=e.scrollDOM.clientHeighto.empty?e.moveVertically(o,t,n.height):TD(o,t));if(r.eq(i.selection))return!1;let s;if(n.selfScroll){let o=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>c&&o.bottomC$e(e,!1),PB=e=>C$e(e,!0);function Lg(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let s=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&t.head!=i.from+s&&(r=ut.cursor(i.from+s))}return r}const UQt=e=>Vd(e,t=>Lg(e,t,!0)),QQt=e=>Vd(e,t=>Lg(e,t,!1)),zQt=e=>Vd(e,t=>Lg(e,t,!cl(e))),VQt=e=>Vd(e,t=>Lg(e,t,cl(e))),HQt=e=>Vd(e,t=>ut.cursor(e.lineBlockAt(t.head).from,1)),qQt=e=>Vd(e,t=>ut.cursor(e.lineBlockAt(t.head).to,-1));function WQt(e,t,n){let i=!1,r=p1(e.selection,s=>{let o=kf(e,s.head,-1)||kf(e,s.head,1)||s.head>0&&kf(e,s.head-1,1)||s.headWQt(e,t);function nd(e,t,n){let i=p1(e.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=t&&(r=ut.range(r.head,r.anchor));let s=n(r);return ut.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return i.eq(e.state.selection)?!1:(e.dispatch(zd(e.state,i)),!0)}function T$e(e,t){return nd(e,t,n=>e.moveByChar(n,t))}const A$e=e=>T$e(e,!cl(e)),_$e=e=>T$e(e,cl(e));function j$e(e,t){return nd(e,t,n=>e.moveByGroup(n,t))}const GQt=e=>j$e(e,!cl(e)),XQt=e=>j$e(e,cl(e)),YQt=e=>{let t=!cl(e);return nd(e,t,n=>AD(e.state,n,t))},ZQt=e=>{let t=cl(e);return nd(e,t,n=>AD(e.state,n,t))};function N$e(e,t){return nd(e,t,n=>e.moveVertically(n,t))}const R$e=e=>N$e(e,!1),I$e=e=>N$e(e,!0);function P$e(e,t){return nd(e,t,n=>e.moveVertically(n,t,E$e(e).height))}const Ire=e=>P$e(e,!1),Pre=e=>P$e(e,!0),JQt=e=>nd(e,!0,t=>Lg(e,t,!0)),ezt=e=>nd(e,!1,t=>Lg(e,t,!1)),tzt=e=>{let t=!cl(e);return nd(e,t,n=>Lg(e,n,t))},nzt=e=>{let t=cl(e);return nd(e,t,n=>Lg(e,n,t))},izt=e=>nd(e,!1,t=>ut.cursor(e.lineBlockAt(t.head).from)),rzt=e=>nd(e,!0,t=>ut.cursor(e.lineBlockAt(t.head).to)),Dre=({state:e,dispatch:t})=>(t(zd(e,{anchor:0})),!0),Mre=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.doc.length})),!0),Lre=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.selection.main.anchor,head:0})),!0),$re=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),szt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ozt=({state:e,dispatch:t})=>{let n=_D(e).map(({from:i,to:r})=>ut.range(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:ut.create(n),userEvent:"select"})),!0},azt=({state:e,dispatch:t})=>{let n=p1(e.selection,i=>{let r=Lr(e),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return ut.range(l.to,l.from)}return i});return n.eq(e.selection)?!1:(t(zd(e,n)),!0)};function D$e(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(t?o.to0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.heado.to){r.some(u=>u.head==c.head)||r.push(c);break}else{if(c.head==l.head)break;l=c}}}return r.length==i.ranges.length?!1:(e.dispatch(zd(n,ut.create(r,r.length-1))),!0)}const lzt=e=>D$e(e,!1),czt=e=>D$e(e,!0),uzt=({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=ut.create([n.main]):n.main.empty||(i=ut.create([ut.cursor(n.main.head)])),i?(t(zd(e,i)),!0):!1};function cT(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let c=t(s);co&&(n="delete.forward",c=R2(e,c,!0)),o=Math.min(o,c),l=Math.max(l,c)}else o=R2(e,o,!1),l=R2(e,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:ut.cursor(o,or(e)))i.between(t,t,(r,s)=>{rt&&(t=n?s:r)});return t}const M$e=(e,t,n)=>cT(e,i=>{let r=i.from,{state:s}=e,o=s.doc.lineAt(r),l,c;if(n&&!t&&r>o.from&&rM$e(e,!1,!0),L$e=e=>M$e(e,!0,!1),$$e=(e,t)=>cT(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(t?s.to:s.from)){i==n.head&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let c=ba(s.text,i-s.from,t)+s.from,u=s.text.slice(Math.min(i,c)-s.from,Math.max(i,c)-s.from),d=o(u);if(l!=null&&d!=l)break;(u!=" "||i!=n.head)&&(l=d),i=c}return i}),F$e=e=>$$e(e,!1),dzt=e=>$$e(e,!0),fzt=e=>cT(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headcT(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),pzt=e=>cT(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:sr.of(["",""])},range:ut.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},gzt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,s=e.doc.lineAt(r),o=r==s.from?r-1:ba(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:ba(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(o,r))},range:ut.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _D(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),s=e.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=e.doc.lineAt(i.to-1)),n>=r.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function B$e(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let s of _D(e)){if(n?s.to==e.doc.length:s.from==0)continue;let o=e.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+e.lineBreak});for(let c of s.ranges)r.push(ut.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:e.lineBreak+o.text});for(let c of s.ranges)r.push(ut.range(c.anchor-l,c.head-l))}}return i.length?(t(e.update({changes:i,scrollIntoView:!0,selection:ut.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const bzt=({state:e,dispatch:t})=>B$e(e,t,!1),yzt=({state:e,dispatch:t})=>B$e(e,t,!0);function U$e(e,t,n){if(e.readOnly)return!1;let i=[];for(let s of _D(e))n?i.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):i.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vzt=({state:e,dispatch:t})=>U$e(e,t,!1),xzt=({state:e,dispatch:t})=>U$e(e,t,!0),wzt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(_D(t).map(({from:r,to:s})=>(r>0?r--:s{let s;if(e.lineWrapping){let o=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,s)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ozt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Lr(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),s;return i&&r&&i.to<=t&&r.from>=t&&(s=i.type.prop(Kn.closedBy))&&s.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const Fre=Q$e(!1),kzt=Q$e(!0);function Q$e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{let{from:s,to:o}=r,l=t.doc.lineAt(s),c=!e&&s==o&&Ozt(t,s);e&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let u=new xD(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=ZV(u,s);for(d==null&&(d=Id(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let r=[];for(let o=i.from;o<=i.to;){let l=e.doc.lineAt(o);l.number>n&&(i.empty||i.to>l.from)&&(t(l,r,i),n=l.number),o=l.to+1}let s=e.changes(r);return{changes:r,range:ut.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Szt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new xD(e,{overrideIndentation:s=>{let o=n[s];return o??-1}}),r=jH(e,(s,o,l)=>{let c=ZV(i,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=TE(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(jH(e,(n,i)=>{i.push({from:n.from,insert:e.facet(f1)})}),{userEvent:"input.indent"})),!0),V$e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(jH(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let s=Id(r,e.tabSize),o=0,l=TE(e,Math.max(0,s-jy(e)));for(;o(e.setTabFocusMode(),!0),Czt=[{key:"Ctrl-b",run:v$e,shift:A$e,preventDefault:!0},{key:"Ctrl-f",run:x$e,shift:_$e},{key:"Ctrl-p",run:k$e,shift:R$e},{key:"Ctrl-n",run:S$e,shift:I$e},{key:"Ctrl-a",run:HQt,shift:izt},{key:"Ctrl-e",run:qQt,shift:rzt},{key:"Ctrl-d",run:L$e},{key:"Ctrl-h",run:DB},{key:"Ctrl-k",run:fzt},{key:"Ctrl-Alt-h",run:F$e},{key:"Ctrl-o",run:mzt},{key:"Ctrl-t",run:gzt},{key:"Ctrl-v",run:PB}],Tzt=[{key:"ArrowLeft",run:v$e,shift:A$e,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:MQt,shift:GQt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:zQt,shift:tzt,preventDefault:!0},{key:"ArrowRight",run:x$e,shift:_$e,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:LQt,shift:XQt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:VQt,shift:nzt,preventDefault:!0},{key:"ArrowUp",run:k$e,shift:R$e,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Dre,shift:Lre},{mac:"Ctrl-ArrowUp",run:Rre,shift:Ire},{key:"ArrowDown",run:S$e,shift:I$e,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mre,shift:$re},{mac:"Ctrl-ArrowDown",run:PB,shift:Pre},{key:"PageUp",run:Rre,shift:Ire},{key:"PageDown",run:PB,shift:Pre},{key:"Home",run:QQt,shift:ezt,preventDefault:!0},{key:"Mod-Home",run:Dre,shift:Lre},{key:"End",run:UQt,shift:JQt,preventDefault:!0},{key:"Mod-End",run:Mre,shift:$re},{key:"Enter",run:Fre,shift:Fre},{key:"Mod-a",run:szt},{key:"Backspace",run:DB,shift:DB,preventDefault:!0},{key:"Delete",run:L$e,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:F$e,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:dzt,preventDefault:!0},{mac:"Mod-Backspace",run:hzt,preventDefault:!0},{mac:"Mod-Delete",run:pzt,preventDefault:!0}].concat(Czt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Azt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:FQt,shift:YQt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:BQt,shift:ZQt},{key:"Alt-ArrowUp",run:bzt},{key:"Shift-Alt-ArrowUp",run:vzt},{key:"Alt-ArrowDown",run:yzt},{key:"Shift-Alt-ArrowDown",run:xzt},{key:"Mod-Alt-ArrowUp",run:lzt},{key:"Mod-Alt-ArrowDown",run:czt},{key:"Escape",run:uzt},{key:"Mod-Enter",run:kzt},{key:"Alt-l",mac:"Ctrl-l",run:ozt},{key:"Mod-i",run:azt,preventDefault:!0},{key:"Mod-[",run:V$e},{key:"Mod-]",run:z$e},{key:"Mod-Alt-\\",run:Szt},{key:"Shift-Mod-k",run:wzt},{key:"Shift-Mod-\\",run:KQt},{key:"Mod-/",run:bQt},{key:"Alt-A",run:vQt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ezt}].concat(Tzt),_zt={key:"Tab",run:z$e,shift:V$e},Bre=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Sw{constructor(t,n,i=0,r=t.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,r),this.bufferStart=i,this.normalize=s?l=>s(Bre(l)):Bre,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Zl(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=RV(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=hf(t);let r=this.normalize(n);if(r.length)for(let s=0,o=i,l=!0;;s++){let c=r.charCodeAt(s),u=this.match(c,o,l,this.bufferPos+this.bufferStart,s==r.length-1);if(u)return this.value=u,this;if(s==r.length-1)break;l&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let i=this.curLineStart+n.index,r=i+n[0].length;if(this.matchPos=jR(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||r.to<=n){let l=new Ox(n,t.sliceString(n,i));return J3.set(t,l),l}if(r.from==n&&r.to==i)return r;let{text:s,from:o}=r;return o>n&&(s=t.sliceString(n,o)+s,o=n),r.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let i=this.flat.from+n.index,r=i+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,precise:!0,match:n},this.matchPos=jR(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ox.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(q$e.prototype[Symbol.iterator]=W$e.prototype[Symbol.iterator]=function(){return this});function jzt(e){try{return new RegExp(e,NH),!0}catch{return!1}}function jR(e,t){if(t>=e.length)return t;let n=e.lineAt(t),i;for(;t=56320&&i<57344;)t++;return t}const Nzt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:i,result:r}=Q$t(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){e.dispatch({effects:i});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=o,h=d?+d.slice(1):0,m=u?+u:l.number;if(u&&f){let v=m/100;c&&(v=v*(c=="-"?-1:1)+l.number/t.doc.lines),m=Math.round(t.doc.lines*v)}else u&&c&&(m=m*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,m))),b=ut.cursor(g.from+Math.max(0,Math.min(h,g.length)));e.dispatch({effects:[i,Xt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},Rzt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Izt=an.define({combine(e){return Wf(e,Rzt,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Pzt(e){return[Fzt,$zt]}const Dzt=Cn.mark({class:"cm-selectionMatch"}),Mzt=Cn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ure(e,t,n,i){return(n==0||e(t.sliceDoc(n-1,n))!=Ts.Word)&&(i==t.doc.length||e(t.sliceDoc(i,i+1))!=Ts.Word)}function Lzt(e,t,n,i){return e(t.sliceDoc(n,n+1))==Ts.Word&&e(t.sliceDoc(i-1,i))==Ts.Word}const $zt=Zs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Izt),{state:n}=e,i=n.selection;if(i.ranges.length>1)return Cn.none;let r=i.main,s,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return Cn.none;let c=n.wordAt(r.head);if(!c)return Cn.none;o=n.charCategorizer(r.head),s=n.sliceDoc(c.from,c.to)}else{let c=r.to-r.from;if(c200)return Cn.none;if(t.wholeWords){if(s=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(Ure(o,n,r.from,r.to)&&Lzt(o,n,r.from,r.to)))return Cn.none}else if(s=n.sliceDoc(r.from,r.to),!s)return Cn.none}let l=[];for(let c of e.visibleRanges){let u=new Sw(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||Ure(o,n,d,f))&&(r.empty&&d<=r.from&&f>=r.to?l.push(Mzt.range(d,f)):(d>=r.to||f<=r.from)&&l.push(Dzt.range(d,f)),l.length>t.maxMatches))return Cn.none}}return Cn.set(l)}},{decorations:e=>e.decorations}),Fzt=Xt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Bzt=({state:e,dispatch:t})=>{let{selection:n}=e,i=ut.create(n.ranges.map(r=>e.wordAt(r.head)||ut.cursor(r.head)),n.mainIndex);return i.eq(n)?!1:(t(e.update({selection:i})),!0)};function Uzt(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),s=r&&r.from==n.from&&r.to==n.to;for(let o=!1,l=new Sw(e.doc,t,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Sw(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Qzt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Bzt({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=i))return!1;let r=Uzt(e,i);return r?(t(e.update({selection:e.selection.addRange(ut.range(r.from,r.to),!1),effects:Xt.scrollIntoView(r.to)})),!0):!1},m1=an.define({combine(e){return Wf(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new nVt(t),scrollToMatch:t=>Xt.scrollIntoView(t)})}});class K$e{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||jzt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new Kzt(this):new Hzt(this)}getCursor(t,n=0,i){let r=t.doc?t:Ui.create({doc:t});return i==null&&(i=r.doc.length),this.regexp?fv(this,r,n,i):dv(this,r,n,i)}}class G$e{constructor(t){this.spec=t}}function zzt(e,t,n){return(i,r,s,o)=>{if(n&&!n(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):t.doc.sliceString(i,r);return e(l,t,i,r)}}function dv(e,t,n,i){let r;return e.wholeWord&&(r=Vzt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=zzt(e.test,t,r)),new Sw(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:s=>s.toLowerCase(),r)}function Vzt(e,t){return(n,i,r,s)=>((s>n||s+r.length=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let s=dv(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function qzt(e,t,n){return(i,r,s)=>(!n||n(i,r,s))&&e(s[0],t,i,r)}function fv(e,t,n,i){let r;return e.wholeWord&&(r=Wzt(t.charCategorizer(t.selection.main.head))),e.test&&(r=qzt(e.test,t,r)),new q$e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,i)}function NR(e,t){return e.slice(ba(e,t,!1),t)}function RR(e,t){return e.slice(t,ba(e,t))}function Wzt(e){return(t,n,i)=>!i[0].length||(e(NR(i.input,i.index))!=Ts.Word||e(RR(i.input,i.index))!=Ts.Word)&&(e(RR(i.input,i.index+i[0].length))!=Ts.Word||e(NR(i.input,i.index+i[0].length))!=Ts.Word)}class Kzt extends G$e{nextMatch(t,n,i){let r=fv(this.spec,t,i,t.doc.length).next();return r.done&&(r=fv(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,i){for(let r=1;;r++){let s=Math.max(n,i-r*1e4),o=fv(this.spec,t,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(t,n,i){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,i)=>{if(i=="&")return t.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let s=fv(this.spec,t,Math.max(0,n-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const $E=Gn.define(),RH=Gn.define(),qm=Qa.define({create(e){return new e4(MB(e).create(),null)},update(e,t){for(let n of t.effects)n.is($E)?e=new e4(n.value.create(),e.panel):n.is(RH)&&(e=new e4(e.query,n.value?IH:null));return e},provide:e=>EE.from(e,t=>t.panel)});class e4{constructor(t,n){this.query=t,this.panel=n}}const Gzt=Cn.mark({class:"cm-searchMatch"}),Xzt=Cn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Yzt=Zs.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(qm))}update(e){let t=e.state.field(qm);(t!=e.startState.field(qm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Cn.none;let{view:n}=this,i=new pp;for(let r=0,s=n.visibleRanges,o=s.length;rs[r+1].from-2*250;)c=s[++r].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);i.add(u,d,f?Xzt:Gzt)})}return i.finish()}},{decorations:e=>e.decorations});function uT(e){return t=>{let n=t.state.field(qm,!1);return n&&n.query.spec.valid?e(t,n):Z$e(t)}}const IR=uT((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);if(!i)return!1;let r=ut.single(i.from,i.to),s=e.state.facet(m1);return e.dispatch({selection:r,effects:[PH(e,i),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),Y$e(e),!0}),PR=uT((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,r=t.prevMatch(n,i,i);if(!r)return!1;let s=ut.single(r.from,r.to),o=e.state.facet(m1);return e.dispatch({selection:s,effects:[PH(e,r),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),Y$e(e),!0}),Zzt=uT((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ut.create(n.map(i=>ut.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Jzt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,s=[],o=0;for(let l=new Sw(e.doc,e.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(ut.range(l.value.from,l.value.to))}return t(e.update({selection:ut.create(s,o),userEvent:"select.search.matches"})),!0},Qre=uT((e,{query:t})=>{let{state:n}=e,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,i,i);if(!s)return!1;let o=s,l=[],c,u,d=[];o.precise?o.from==i&&o.to==r&&(u=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),o=t.nextMatch(n,o.from,o.to),d.push(Xt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(l);return o&&(c=ut.single(o.from,o.to).map(f),d.push(PH(e,o)),d.push(n.facet(m1).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),eVt=uT((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:s,to:o,precise:l}=r;l&&n.push({from:s,to:o,insert:t.getReplacement(r)})}if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Xt.announce.of(i),userEvent:"input.replace.all"}),!0});function IH(e){return e.state.facet(m1).createPanel(e)}function MB(e,t){var n,i,r,s,o;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(m1);return new K$e({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(i=t==null?void 0:t.caseSensitive)!==null&&i!==void 0?i:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:u.literal,regexp:(s=t==null?void 0:t.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function X$e(e){let t=XV(e,IH);return t&&t.dom.querySelector("[main-field]")}function Y$e(e){let t=X$e(e);t&&t==e.root.activeElement&&t.select()}const Z$e=e=>{let t=e.state.field(qm,!1);if(t&&t.panel){let n=X$e(e);if(n&&n!=e.root.activeElement){let i=MB(e.state,t.query.spec);i.valid&&e.dispatch({effects:$E.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[RH.of(!0),t?$E.of(MB(e.state,t.query.spec)):Gn.appendConfig.of(rVt)]});return!0},J$e=e=>{let t=e.state.field(qm,!1);if(!t||!t.panel)return!1;let n=XV(e,IH);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:RH.of(!1)}),!0},tVt=[{key:"Mod-f",run:Z$e,scope:"editor search-panel"},{key:"F3",run:IR,shift:PR,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:IR,shift:PR,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:J$e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Jzt},{key:"Mod-Alt-g",run:Nzt},{key:"Mod-d",run:Qzt,preventDefault:!0}];class nVt{constructor(t){this.view=t;let n=this.query=t.state.field(qm).query.spec;this.commit=this.commit.bind(this),this.searchField=Ir("input",{value:n.search,placeholder:_c(t,"Find"),"aria-label":_c(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ir("input",{value:n.replace,placeholder:_c(t,"Replace"),"aria-label":_c(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ir("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ir("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ir("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function i(r,s,o){return Ir("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=Ir("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>IR(t),[_c(t,"next")]),i("prev",()=>PR(t),[_c(t,"previous")]),i("select",()=>Zzt(t),[_c(t,"all")]),Ir("label",null,[this.caseField,_c(t,"match case")]),Ir("label",null,[this.reField,_c(t,"regexp")]),Ir("label",null,[this.wordField,_c(t,"by word")]),...t.state.readOnly?[]:[Ir("br"),this.replaceField,i("replace",()=>Qre(t),[_c(t,"replace")]),i("replaceAll",()=>eVt(t),[_c(t,"replace all")])],Ir("button",{name:"close",onclick:()=>J$e(t),"aria-label":_c(t,"close"),type:"button"},["×"])])}commit(){let t=new K$e({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:$E.of(t)}))}keydown(t){Y4t(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?PR:IR)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Qre(this.view))}update(t){for(let n of t.transactions)for(let i of n.effects)i.is($E)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(m1).top}}function _c(e,t){return e.state.phrase(t)}const I2=30,P2=/[\s\.,:;?!]/;function PH(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,s=Math.max(i.from,t-I2),o=Math.min(r,n+I2),l=e.state.sliceDoc(s,o);if(s!=i.from){for(let c=0;cl.length-I2;c--)if(!P2.test(l[c-1])&&P2.test(l[c])){l=l.slice(0,c);break}}return Xt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const iVt=Xt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),rVt=[qm,Ap.low(Yzt),iVt];class zre{constructor(t,n,i){this.from=t,this.to=n,this.diagnostic=i}}class Tb{constructor(t,n,i){this.diagnostics=t,this.panel=n,this.selected=i}static init(t,n,i){let r=i.facet(FE).markerFilter;r&&(t=r(t,i));let s=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),o=new pp,l=[],c=0,u=i.doc.iter(),d=0,f=i.doc.length;for(let m=0;;){let g=m==s.length?null:s[m];if(!g&&!l.length)break;let b,v;if(l.length)b=c,v=l.reduce((w,O)=>Math.min(w,O.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;v=g.to,l.push(g),m++}for(;mw.from||w.to==b))l.push(w),m++,v=Math.min(w.to,v);else{v=Math.min(w.from,v);break}}v=Math.min(v,f);let y=!1;if(l.some(w=>w.from==b&&(w.to==v||v==f))&&(y=b==v,!y&&v-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let O=b;;){if(O>=v){y=!0;break}if(!u.lineBreak&&d+u.value.length>O)break;O=d+u.value.length,d+=u.value.length,u.next()}}let x=bVt(l);if(y)o.add(b,b,Cn.widget({widget:new hVt(x),diagnostics:l.slice()}));else{let w=l.reduce((O,S)=>S.markClass?O+" "+S.markClass:O,"");o.add(b,v,Cn.mark({class:"cm-lintRange cm-lintRange-"+x+w,diagnostics:l.slice(),inclusiveEnd:l.some(O=>O.to>v)}))}if(c=v,c==f)break;for(let w=0;w{if(!(t&&o.diagnostics.indexOf(t)<0))if(!i)i=new zre(r,s,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new zre(i.from,s,i.diagnostic)}}),i}function sVt(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(FE).hideOn(e,n,i);if(r!=null)return r;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(e6e))||e.changes.touchesRange(s.from,Math.max(s.to,i)))}function oVt(e,t){return e.field(Wc,!1)?t:t.concat(Gn.appendConfig.of(yVt))}const e6e=Gn.define(),DH=Gn.define(),t6e=Gn.define(),Wc=Qa.define({create(){return new Tb(Cn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);i=wg(n,e.selected.diagnostic,s)||wg(n,null,s)}!n.size&&r&&t.state.facet(FE).autoPanel&&(r=null),e=new Tb(n,r,i)}for(let n of t.effects)if(n.is(e6e)){let i=t.state.facet(FE).autoPanel?n.value.length?BE.open:null:e.panel;e=Tb.init(n.value,i,t.state)}else n.is(DH)?e=new Tb(e.diagnostics,n.value?BE.open:null,e.selected):n.is(t6e)&&(e=new Tb(e.diagnostics,e.panel,n.value));return e},provide:e=>[EE.from(e,t=>t.panel),Xt.decorations.from(e,t=>t.diagnostics)]}),aVt=Cn.mark({class:"cm-lintRange cm-lintRange-active"});function lVt(e,t,n){let{diagnostics:i}=e.state.field(Wc),r,s=-1,o=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(ti6e(e,n,!1)))}const uVt=e=>{let t=e.state.field(Wc,!1);(!t||!t.panel)&&e.dispatch({effects:oVt(e.state,[DH.of(!0)])});let n=XV(e,BE.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Vre=e=>{let t=e.state.field(Wc,!1);return!t||!t.panel?!1:(e.dispatch({effects:DH.of(!1)}),!0)},dVt=e=>{let t=e.state.field(Wc,!1);if(!t)return!1;let n=e.state.selection.main,i=wg(t.diagnostics,null,n.to+1);return!i&&(i=wg(t.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),B$t(e,i.from,1,{tooltip:r6e,until:r=>r.docChanged||r.newSelection.main.headi.to}),!0)},fVt=[{key:"Mod-Shift-m",run:uVt,preventDefault:!0},{key:"F8",run:dVt}],FE=an.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Wf(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Hre,tooltipFilter:Hre,needsRefresh:(t,n)=>t?n?i=>t(i)||n(i):t:n,hideOn:(t,n)=>t?n?(i,r,s)=>t(i,r,s)||n(i,r,s):t:n,autoPanel:(t,n)=>t||n})}}});function Hre(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function n6e(e){let t=[];if(e)e:for(let{name:n}of e){for(let i=0;is.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function i6e(e,t,n){var i;let r=n?n6e(t.actions):[];return Ir("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ir("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(i=t.actions)===null||i===void 0?void 0:i.map((s,o)=>{let l=!1,c=m=>{if(m.preventDefault(),l)return;l=!0;let g=wg(e.state.field(Wc).diagnostics,t);g&&s.apply(e,g.from,g.to)},{name:u}=s,d=r[o]?u.indexOf(r[o]):-1,f=d<0?u:[u.slice(0,d),Ir("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return Ir("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},f)}),t.source&&Ir("div",{class:"cm-diagnosticSource"},t.source))}class hVt extends Qd{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Ir("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qre{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=i6e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class BE{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)Vre(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=n6e(s.actions);for(let l=0;l{for(let s=0;sVre(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Wc).selected;if(!t)return-1;for(let n=0;n{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let f=-1,h;for(let m=i;mi&&(this.items.splice(i,f-i),r=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),i++}});i({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let i=t;t=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)n();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Wc),i=wg(n.diagnostics,this.items[t].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:t6e.of(i)})}static open(t){return new BE(t)}}function pVt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function D2(e){return pVt(``,'width="6" height="3"')}const mVt=Xt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:D2("#f11")},".cm-lintRange-warning":{backgroundImage:D2("orange")},".cm-lintRange-info":{backgroundImage:D2("#999")},".cm-lintRange-hint":{backgroundImage:D2("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function gVt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function bVt(e){let t="hint",n=1;for(let i of e){let r=gVt(i.severity);r>n&&(n=r,t=i.severity)}return t}const r6e=F$t(lVt,{hideOn:sVt}),yVt=[Wc,Xt.decorations.compute([Wc],e=>{let{selected:t,panel:n}=e.field(Wc);return!t||!n||t.from==t.to?Cn.none:Cn.set([aVt.range(t.from,t.to)])}),r6e,mVt];var Wre=function(t){t===void 0&&(t={});var n=t,i=n.crosshairCursor,r=i===void 0?!1:i,s=[];t.closeBracketsKeymap!==!1&&(s=s.concat(E8t)),t.defaultKeymap!==!1&&(s=s.concat(Azt)),t.searchKeymap!==!1&&(s=s.concat(tVt)),t.historyKeymap!==!1&&(s=s.concat(DQt)),t.foldKeymap!==!1&&(s=s.concat(_6t)),t.completionKeymap!==!1&&(s=s.concat(M3e)),t.lintKeymap!==!1&&(s=s.concat(fVt));var o=[];return t.lineNumbers!==!1&&o.push(J5e()),t.highlightActiveLineGutter!==!1&&o.push(t6t()),t.highlightSpecialChars!==!1&&o.push(p$t()),t.history!==!1&&o.push(CQt()),t.foldGutter!==!1&&o.push(I6t()),t.drawSelection!==!1&&o.push(i$t()),t.dropCursor!==!1&&o.push(l$t()),t.allowMultipleSelections!==!1&&o.push(Ui.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&o.push(w6t()),t.syntaxHighlighting!==!1&&o.push(p3e(L6t,{fallback:!0})),t.bracketMatching!==!1&&o.push(V6t()),t.closeBrackets!==!1&&o.push(w8t()),t.autocompletion!==!1&&o.push(R8t()),t.rectangularSelection!==!1&&o.push(A$t()),r!==!1&&o.push(N$t()),t.highlightActiveLine!==!1&&o.push(x$t()),t.highlightSelectionMatches!==!1&&o.push(Pzt()),t.tabSize&&typeof t.tabSize=="number"&&o.push(f1.of(" ".repeat(t.tabSize))),o.concat([d1.of(s.flat())]).filter(Boolean)};const vVt="#e5c07b",Kre="#e06c75",xVt="#56b6c2",wVt="#ffffff",pj="#abb2bf",LB="#7d8799",OVt="#61afef",kVt="#98c379",Gre="#d19a66",SVt="#c678dd",EVt="#21252b",Xre="#2c313a",Yre="#282c34",t4="#353a42",CVt="#3E4451",Zre="#528bff",TVt=Xt.theme({"&":{color:pj,backgroundColor:Yre},".cm-content":{caretColor:Zre},".cm-cursor, .cm-dropCursor":{borderLeftColor:Zre},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:CVt},".cm-panels":{backgroundColor:EVt,color:pj},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yre,color:LB,border:"none"},".cm-activeLineGutter":{backgroundColor:Xre},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:t4},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:t4,borderBottomColor:t4},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xre,color:pj}}},{dark:!0}),AVt=aT.define([{tag:oe.keyword,color:SVt},{tag:[oe.name,oe.deleted,oe.character,oe.propertyName,oe.macroName],color:Kre},{tag:[oe.function(oe.variableName),oe.labelName],color:OVt},{tag:[oe.color,oe.constant(oe.name),oe.standard(oe.name)],color:Gre},{tag:[oe.definition(oe.name),oe.separator],color:pj},{tag:[oe.typeName,oe.className,oe.number,oe.changed,oe.annotation,oe.modifier,oe.self,oe.namespace],color:vVt},{tag:[oe.operator,oe.operatorKeyword,oe.url,oe.escape,oe.regexp,oe.link,oe.special(oe.string)],color:xVt},{tag:[oe.meta,oe.comment],color:LB},{tag:oe.strong,fontWeight:"bold"},{tag:oe.emphasis,fontStyle:"italic"},{tag:oe.strikethrough,textDecoration:"line-through"},{tag:oe.link,color:LB,textDecoration:"underline"},{tag:oe.heading,fontWeight:"bold",color:Kre},{tag:[oe.atom,oe.bool,oe.special(oe.variableName)],color:Gre},{tag:[oe.processingInstruction,oe.string,oe.inserted],color:kVt},{tag:oe.invalid,color:wVt}]),_Vt=[TVt,p3e(AVt)];var jVt=Xt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),NVt=function(t){t===void 0&&(t={});var n=t,i=n.indentWithTab,r=i===void 0?!0:i,s=n.editable,o=s===void 0?!0:s,l=n.readOnly,c=l===void 0?!1:l,u=n.theme,d=u===void 0?"light":u,f=n.placeholder,h=f===void 0?"":f,m=n.basicSetup,g=m===void 0?!0:m,b=[];switch(r&&b.unshift(d1.of([_zt])),g&&(typeof g=="boolean"?b.unshift(Wre()):b.unshift(Wre(g))),h&&b.unshift(S$t(h)),d){case"light":b.push(jVt);break;case"dark":b.push(_Vt);break;case"none":break;default:b.push(d);break}return o===!1&&b.push(Xt.editable.of(!1)),c&&b.push(Ui.readOnly.of(!0)),[...b]},RVt=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class IVt{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class Jre{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var n4=null,PVt=()=>typeof window>"u"?new Jre:(n4||(n4=new Jre),n4),DVt=Xt.theme({"& .cm-scroller":{height:"100% !important"}}),ese=null,i4=null;function MVt(e,t,n,i,r,s){if(!e&&!t&&!n&&!i&&!r&&!s)return null;var o=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s});return o===ese||(ese=o,i4=Xt.theme({"&":{height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s}})),i4}var tse=qf.define(),LVt=200,$Vt=[];function FVt(e){var t=e.value,n=e.selection,i=e.onChange,r=e.onStatistics,s=e.onCreateEditor,o=e.onUpdate,l=e.extensions,c=l===void 0?$Vt:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,m=h===void 0?null:h,g=e.minHeight,b=g===void 0?null:g,v=e.maxHeight,y=v===void 0?null:v,x=e.width,w=x===void 0?null:x,O=e.minWidth,S=O===void 0?null:O,k=e.maxWidth,C=k===void 0?null:k,E=e.placeholder,R=E===void 0?"":E,_=e.editable,j=_===void 0?!0:_,T=e.readOnly,N=T===void 0?!1:T,A=e.indentWithTab,P=A===void 0?!0:A,D=e.basicSetup,M=D===void 0?!0:D,L=e.root,U=e.initialState,I=p.useState(),H=I[0],K=I[1],F=p.useState(),W=F[0],V=F[1],X=p.useState(),ie=X[0],Q=X[1],Z=p.useState(()=>({current:null}))[0],ce=p.useState(()=>({current:null}))[0],Ee=MVt(m,b,y,w,S,C),Y=Xt.updateListener.of(ye=>{if(ye.docChanged&&typeof i=="function"&&!ye.transactions.some(me=>me.annotation(tse))){Z.current?Z.current.reset():(Z.current=new IVt(()=>{if(ce.current){var me=ce.current;ce.current=null,me()}Z.current=null},LVt),PVt().add(Z.current));var Ne=ye.state.doc,pe=Ne.toString();i(pe,ye)}r&&r(RVt(ye))}),G=NVt({theme:f,editable:j,readOnly:N,placeholder:R,indentWithTab:P,basicSetup:M}),te=[Y,...Ee?[Ee]:[],DVt,...G];return o&&typeof o=="function"&&te.push(Xt.updateListener.of(o)),te=te.concat(c),p.useLayoutEffect(()=>{if(H&&!ie){var ye={doc:t,selection:n,extensions:te},Ne=U?Ui.fromJSON(U.json,ye,U.fields):Ui.create(ye);if(Q(Ne),!W){var pe=new Xt({state:Ne,parent:H,root:L});V(pe),s&&s(pe,Ne)}}return()=>{W&&(Q(void 0),V(void 0))}},[H,ie]),p.useEffect(()=>{e.container&&K(e.container)},[e.container]),p.useEffect(()=>()=>{W&&(W.destroy(),V(void 0)),Z.current&&(Z.current.cancel(),Z.current=null)},[W]),p.useEffect(()=>{u&&W&&W.focus()},[u,W]),p.useEffect(()=>{W&&W.dispatch({effects:Gn.reconfigure.of(te)})},[f,c,m,b,y,w,S,C,R,j,N,P,M,i,o]),p.useEffect(()=>{if(t!==void 0){var ye=W?W.state.doc.toString():"";if(W&&t!==ye){var Ne=Z.current&&!Z.current.isDone,pe=()=>{W&&t!==W.state.doc.toString()&&W.dispatch({changes:{from:0,to:W.state.doc.toString().length,insert:t||""},annotations:[tse.of(!0)]})};Ne?ce.current=pe:pe()}}},[t,W]),{state:ie,setState:Q,view:W,setView:V,container:H,setContainer:K}}var BVt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],s6e=p.forwardRef((e,t)=>{var n=e.className,i=e.value,r=i===void 0?"":i,s=e.selection,o=e.extensions,l=o===void 0?[]:o,c=e.onChange,u=e.onStatistics,d=e.onCreateEditor,f=e.onUpdate,h=e.autoFocus,m=e.theme,g=m===void 0?"light":m,b=e.height,v=e.minHeight,y=e.maxHeight,x=e.width,w=e.minWidth,O=e.maxWidth,S=e.basicSetup,k=e.placeholder,C=e.indentWithTab,E=e.editable,R=e.readOnly,_=e.root,j=e.initialState,T=gQt(e,BVt),N=p.useRef(null),A=FVt({root:_,value:r,autoFocus:h,theme:g,height:b,minHeight:v,maxHeight:y,width:x,minWidth:w,maxWidth:O,basicSetup:S,placeholder:k,indentWithTab:C,editable:E,readOnly:R,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:j}),P=A.state,D=A.view,M=A.container,L=A.setContainer;p.useImperativeHandle(t,()=>({editor:N.current,state:P,view:D}),[N,M,P,D]);var U=p.useCallback(H=>{N.current=H,L(H)},[L]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var I=typeof g=="string"?"cm-theme-"+g:"cm-theme";return a.jsx("div",NB({ref:U,className:""+I+(n?" "+n:"")},T))});s6e.displayName="CodeMirror";function o6e(e){const t=e.toLowerCase(),n=t.split("/").pop()??t,i=n.includes(".")?n.split(".").pop():"";return n==="dockerfile"||n.startsWith("dockerfile.")||n.endsWith(".dockerfile")?[eH.define(mQt)]:i==="py"||i==="pyi"?[EUt()]:["ts","tsx","mts","cts"].includes(i??"")?[yB({typescript:!0,jsx:i==="tsx"})]:["js","jsx","mjs","cjs"].includes(i??"")?[yB({jsx:i==="jsx"})]:i==="json"||i==="jsonc"?[H8t()]:i==="yaml"||i==="yml"?[tQt()]:["md","markdown"].includes(i??"")?[s7t()]:[]}function dT({value:e,path:t,onChange:n,readOnly:i=!1,theme:r="light",lineNumberStart:s=1,height:o="100%",minHeight:l,maxHeight:c,extensions:u}){const d=p.useMemo(()=>[...o6e(t),...s===1?[]:[J5e({formatNumber:f=>String(f+s-1)})],...u??[]],[s,t,u]);return a.jsx(s6e,{value:e,height:o,minHeight:l,maxHeight:c,theme:r,extensions:d,editable:!i,onChange:n,basicSetup:{lineNumbers:s===1,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const a6e=Object.freeze(Object.defineProperty({__proto__:null,default:dT,languageFor:o6e},Symbol.toStringTag,{value:"Module"}));function UVt(e){var s;const t=e.split(/\r?\n/);if(((s=t[0])==null?void 0:s.trim())!=="---")return{body:e,frontmatter:[]};const n=t.findIndex((o,l)=>l>0&&o.trim()==="---");if(n<0)return{body:e,frontmatter:[]};const i=OLe(t.slice(1,n).join(` +`,{label:"if",detail:"block",type:"keyword"}),Ms("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ms("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ms("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ms("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],CUt=T3e(J4e,rH(SUt.concat(EUt)));function K3(e){let{node:t,pos:n}=e,i=e.lineIndent(n,-1),r=null;for(;;){let s=t.childBefore(n);if(s)if(s.name=="Comment")n=s.from;else if(s.name=="Body"||s.name=="MatchBody")e.baseIndentFor(s)+e.unit<=i&&(r=s),t=s;else if(s.name=="MatchClause")t=s;else if(s.type.is("Statement"))t=s;else break;else break}return r}function G3(e,t){let n=e.baseIndentFor(t),i=e.lineAt(e.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&e.node.ton?null:n+e.unit}const X3=bp.define({name:"python",parser:wUt.configure({props:[jp.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&K3(e)||e.node;return(t=G3(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=K3(e);return(t=G3(e,n||e.node))!==null&&t!==void 0?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":yx({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":yx({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":yx({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=K3(e);return(t=n&&G3(e,n))!==null&&t!==void 0?t:e.continue()}}),Np.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":sT,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function TUt(){return new xg(X3,[X3.data.of({autocomplete:kUt}),X3.data.of({autocomplete:CUt})])}const uv=63,_re=64,AUt=1,_Ut=2,e$e=3,jUt=4,t$e=5,NUt=6,RUt=7,n$e=65,IUt=66,PUt=8,DUt=9,MUt=10,LUt=11,$Ut=12,i$e=13,FUt=19,BUt=20,UUt=29,QUt=33,zUt=34,VUt=47,HUt=0,CH=1,TB=2,LE=3,AB=4;class Cb{constructor(t,n,i){this.parent=t,this.depth=n,this.type=i,this.hash=(t?t.hash+t.hash<<8:0)+n+(n<<4)+i}}Cb.top=new Cb(null,-1,HUt);function lS(e,t){for(let n=0,i=t-e.pos-1;;i--,n++){let r=e.peek(i);if(vp(r)||r==-1)return n}}function _B(e){return e==32||e==9}function vp(e){return e==10||e==13}function r$e(e){return _B(e)||vp(e)}function Bb(e){return e<0||r$e(e)}const qUt=new OD({start:Cb.top,reduce(e,t){return e.type==LE&&(t==BUt||t==zUt)?e.parent:e},shift(e,t,n,i){if(t==e$e)return new Cb(e,lS(i,i.pos),CH);if(t==n$e||t==t$e)return new Cb(e,lS(i,i.pos),TB);if(t==uv)return e.parent;if(t==FUt||t==QUt)return new Cb(e,0,LE);if(t==i$e&&e.type==AB)return e.parent;if(t==VUt){let r=/[1-9]/.exec(i.read(i.pos,n.pos));if(r)return new Cb(e,e.depth+ +r[0],AB)}return e},hash(e){return e.hash}});function kw(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&Bb(e.peek(n+3))}const WUt=new yo((e,t)=>{if(e.next==-1&&t.canShift(_re))return e.acceptToken(_re);let n=e.peek(-1);if((vp(n)||n<0)&&t.context.type!=LE){if(kw(e,45))if(t.canShift(uv))e.acceptToken(uv);else return e.acceptToken(AUt,3);if(kw(e,46))if(t.canShift(uv))e.acceptToken(uv);else return e.acceptToken(_Ut,3);let i=0;for(;e.next==32;)i++,e.advance();(i{if(t.context.type==LE){e.next==63&&(e.advance(),Bb(e.next)&&e.acceptToken(RUt));return}if(e.next==45)e.advance(),Bb(e.next)&&e.acceptToken(t.context.type==CH&&t.context.depth==lS(e,e.pos-1)?jUt:e$e);else if(e.next==63)e.advance(),Bb(e.next)&&e.acceptToken(t.context.type==TB&&t.context.depth==lS(e,e.pos-1)?NUt:t$e);else{let n=e.pos;for(;;)if(_B(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)s$e(e);else if(e.next==38)jB(e);else if(e.next==42){jB(e);break}else if(e.next==39||e.next==34){if(TH(e,!0))break;return}else if(e.next==91||e.next==123){if(!XUt(e))return;break}else{o$e(e,!0,!1,0);break}for(;_B(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(UUt))return;let i=e.peek(1);Bb(i)&&e.acceptTokenTo(t.context.type==TB&&t.context.depth==lS(e,n)?IUt:n$e,n)}}},{contextual:!0});function GUt(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function jre(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Nre(e,t){return e.next==37?(e.advance(),jre(e.next)&&e.advance(),jre(e.next)&&e.advance(),!0):GUt(e.next)||t&&e.next==44?(e.advance(),!0):!1}function s$e(e){if(e.advance(),e.next==60){for(e.advance();;)if(!Nre(e,!0)){e.next==62&&e.advance();break}}else for(;Nre(e,!1););}function jB(e){for(e.advance();!Bb(e.next)&&AR(e.next)!="f";)e.advance()}function TH(e,t){let n=e.next,i=!1,r=e.pos;for(e.advance();;){let s=e.next;if(s<0)break;if(e.advance(),s==n)if(s==39)if(e.next==39)e.advance();else break;else break;else if(s==92&&n==34)e.next>=0&&e.advance();else if(vp(s)){if(t)return!1;i=!0}else if(t&&e.pos>=r+1024)return!1}return!i}function XUt(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!TH(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else{if(e.next<0||e.pos>n||vp(e.next))return!1;e.advance()}}const YUt="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function AR(e){return e<33?"u":e>125?"s":YUt[e-33]}function Y3(e,t){let n=AR(e);return n!="u"&&!(t&&n=="f")}function o$e(e,t,n,i){if(AR(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&Y3(e.peek(1),n))e.advance();else return!1;let r=e.pos;for(;;){let s=e.next,o=0,l=i+1;for(;r$e(s);){if(vp(s)){if(t)return!1;l=0}else l++;s=e.peek(++o)}if(!(s>=0&&(s==58?Y3(e.peek(o+1),n):s==35?e.peek(o-1)!=32:Y3(s,n)))||!n&&l<=i||l==0&&!n&&(kw(e,45,o)||kw(e,46,o)))break;if(t&&AR(s)=="f")return!1;for(let u=o;u>=0;u--)e.advance();if(t&&e.pos>r+1024)return!1}return!0}const ZUt=new yo((e,t)=>{if(e.next==33)s$e(e),e.acceptToken($Ut);else if(e.next==38||e.next==42){let n=e.next==38?MUt:LUt;jB(e),e.acceptToken(n)}else e.next==39||e.next==34?(TH(e,!1),e.acceptToken(DUt)):o$e(e,!1,t.context.type==LE,t.context.depth)&&e.acceptToken(PUt)}),JUt=new yo((e,t)=>{let n=t.context.type==AB?t.context.depth:-1,i=e.pos;e:for(;;){let r=0,s=e.next;for(;s==32;)s=e.peek(++r);if(!r&&(kw(e,45,r)||kw(e,46,r))||!vp(s)&&(n<0&&(n=Math.max(t.context.depth+1,r)),rYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:qUt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[eQt],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[WUt,KUt,ZUt,JUt,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),nQt=bp.define({name:"yaml",parser:tQt.configure({props:[jp.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name=="BlockLiteralContent"&&t.frome.pos)return null}}return null},FlowMapping:yx({closing:"}"}),FlowSequence:yx({closing:"]"})}),Np.add({"FlowMapping FlowSequence":sT,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function iQt(){return new xg(nQt)}function rQt(e){a$e(e,"start");var t={},n=e.languageData||{},i=!1;for(var r in e)if(r!=n&&e.hasOwnProperty(r))for(var s=t[r]=[],o=e[r],l=0;l2&&o.token&&typeof o.token!="string"){n.pending=[];for(var u=2;u-1)return null;var r=n.indent.length-1,s=e[n.state];e:for(;;){for(var o=0;o{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=_H(e.state,n.from);return i.line?xQt(e):i.block?OQt(e):!1};function AH(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(i(n.update(r)),!0):!1}}const xQt=AH(EQt,0),wQt=AH(f$e,0),OQt=AH((e,t)=>f$e(e,t,SQt(t)),0);function _H(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const xO=50;function kQt(e,{open:t,close:n},i,r){let s=e.sliceDoc(i-xO,i),o=e.sliceDoc(r,r+xO),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&o.slice(c,c+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+c,margin:c&&1}};let d,f;r-i<=2*xO?d=f=e.sliceDoc(i,r):(d=e.sliceDoc(i,i+xO),f=e.sliceDoc(r-xO,r));let h=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(f)[0].length,g=f.length-m-n.length;return d.slice(h,h+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:i+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:r-m-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function SQt(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function f$e(e,t,n=t.selection.ranges){let i=n.map(s=>_H(t,s.from).block);if(!i.every(s=>s))return null;let r=n.map((s,o)=>kQt(t,i[o],s.from,s.to));if(e!=2&&!r.every(s=>s))return{changes:t.changes(n.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(e!=1&&r.some(s=>s)){let s=[];for(let o=0,l;or&&(s==o||o>f.from)){r=f.from;let h=/^\s*/.exec(f.text)[0].length,m=h==f.length,g=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of i)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:c}of i)if(l>=0){let u=o.from+l,d=u+c.length;o.text[d-o.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const RB=qf.define(),CQt=qf.define(),TQt=an.define(),h$e=an.define({combine(e){return Wf(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),p$e=Qa.define({create(){return Sf.empty},update(e,t){let n=t.state.facet(h$e),i=t.annotation(RB);if(i){let c=oc.fromTransaction(t,i.selection),u=i.side,d=u==0?e.undone:e.done;return c?d=_R(d,d.length,n.minDepth,c):d=b$e(d,t.startState.selection),new Sf(u==0?i.rest:d,u==0?d:i.rest)}let r=t.annotation(CQt);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Ro.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=oc.fromTransaction(t),o=t.annotation(Ro.time),l=t.annotation(Ro.userEvent);return s?e=e.addChanges(s,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Sf(e.done.map(oc.fromJSON),e.undone.map(oc.fromJSON))}});function AQt(e={}){return[p$e,h$e.of(e),Xt.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?m$e:t.inputType=="historyRedo"?IB:null;return i?(t.preventDefault(),i(n)):!1}})]}function CD(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(p$e,!1);if(!r)return!1;let s=r.pop(e,n,t);return s?(i(s),!0):!1}}const m$e=CD(0,!1),IB=CD(1,!1),_Qt=CD(0,!0),jQt=CD(1,!0);class oc{constructor(t,n,i,r,s){this.changes=t,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(t){return new oc(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,i;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new oc(t.changes&&Go.fromJSON(t.changes),[],t.mapped&&Nf.fromJSON(t.mapped),t.startSelection&&ut.fromJSON(t.startSelection),t.selectionsAfter.map(ut.fromJSON))}static fromTransaction(t,n){let i=$u;for(let r of t.startState.facet(TQt)){let s=r(t);s.length&&(i=i.concat(s))}return!i.length&&t.changes.empty?null:new oc(t.changes.invert(t.startState.doc),i,void 0,n||t.startState.selection,$u)}static selection(t){return new oc(void 0,$u,void 0,void 0,t)}}function _R(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function NQt(e,t){let n=[],i=!1;return e.iterChangedRanges((r,s)=>n.push(r,s)),t.iterChangedRanges((r,s,o,l)=>{for(let c=0;c=u&&o<=d&&(i=!0)}}),i}function RQt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function g$e(e,t){return e.length?t.length?e.concat(t):e:t}const $u=[],IQt=200;function b$e(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-IQt));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),_R(e,e.length-1,1e9,n.setSelAfter(i)))}else return[oc.selection([t])]}function PQt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Z3(e,t){if(!e.length)return e;let n=e.length,i=$u;for(;n;){let r=DQt(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=e.slice(0,n);return s[n-1]=r,s}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[oc.selection(i)]:$u}function DQt(e,t,n){let i=g$e(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):$u,n);if(!e.changes)return oc.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new oc(r,Gn.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const MQt=/^(input\.type|delete)($|\.)/;class Sf{constructor(t,n,i=0,r=void 0){this.done=t,this.undone=n,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new Sf(this.done,this.undone):this}addChanges(t,n,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!i||MQt.test(i))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):TD(n,t))}function cl(e){return e.textDirectionAt(e.state.selection.main.head)==Qr.LTR}const v$e=e=>y$e(e,!cl(e)),x$e=e=>y$e(e,cl(e));function w$e(e,t){return Vd(e,n=>n.empty?e.moveByGroup(n,t):TD(n,t))}const $Qt=e=>w$e(e,!cl(e)),FQt=e=>w$e(e,cl(e));function BQt(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function AD(e,t,n){let i=Lr(e).resolveInner(t.head),r=n?Kn.closedBy:Kn.openedBy;for(let c=t.head;;){let u=n?i.childAfter(c):i.childBefore(c);if(!u)break;BQt(e,u,r)?i=u:c=n?u.to:u.from}let s=i.type.prop(r),o,l;return s&&(o=n?kf(e,i.from,1):kf(e,i.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?i.to:i.from,ut.cursor(l,n?-1:1)}const UQt=e=>Vd(e,t=>AD(e.state,t,!cl(e))),QQt=e=>Vd(e,t=>AD(e.state,t,cl(e)));function O$e(e,t){return Vd(e,n=>{if(!n.empty)return TD(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}const k$e=e=>O$e(e,!1),S$e=e=>O$e(e,!0);function E$e(e){let t=e.scrollDOM.clientHeighto.empty?e.moveVertically(o,t,n.height):TD(o,t));if(r.eq(i.selection))return!1;let s;if(n.selfScroll){let o=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>c&&o.bottomC$e(e,!1),PB=e=>C$e(e,!0);function Lg(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let s=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&t.head!=i.from+s&&(r=ut.cursor(i.from+s))}return r}const zQt=e=>Vd(e,t=>Lg(e,t,!0)),VQt=e=>Vd(e,t=>Lg(e,t,!1)),HQt=e=>Vd(e,t=>Lg(e,t,!cl(e))),qQt=e=>Vd(e,t=>Lg(e,t,cl(e))),WQt=e=>Vd(e,t=>ut.cursor(e.lineBlockAt(t.head).from,1)),KQt=e=>Vd(e,t=>ut.cursor(e.lineBlockAt(t.head).to,-1));function GQt(e,t,n){let i=!1,r=p1(e.selection,s=>{let o=kf(e,s.head,-1)||kf(e,s.head,1)||s.head>0&&kf(e,s.head-1,1)||s.headGQt(e,t);function nd(e,t,n){let i=p1(e.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=t&&(r=ut.range(r.head,r.anchor));let s=n(r);return ut.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return i.eq(e.state.selection)?!1:(e.dispatch(zd(e.state,i)),!0)}function T$e(e,t){return nd(e,t,n=>e.moveByChar(n,t))}const A$e=e=>T$e(e,!cl(e)),_$e=e=>T$e(e,cl(e));function j$e(e,t){return nd(e,t,n=>e.moveByGroup(n,t))}const YQt=e=>j$e(e,!cl(e)),ZQt=e=>j$e(e,cl(e)),JQt=e=>{let t=!cl(e);return nd(e,t,n=>AD(e.state,n,t))},ezt=e=>{let t=cl(e);return nd(e,t,n=>AD(e.state,n,t))};function N$e(e,t){return nd(e,t,n=>e.moveVertically(n,t))}const R$e=e=>N$e(e,!1),I$e=e=>N$e(e,!0);function P$e(e,t){return nd(e,t,n=>e.moveVertically(n,t,E$e(e).height))}const Ire=e=>P$e(e,!1),Pre=e=>P$e(e,!0),tzt=e=>nd(e,!0,t=>Lg(e,t,!0)),nzt=e=>nd(e,!1,t=>Lg(e,t,!1)),izt=e=>{let t=!cl(e);return nd(e,t,n=>Lg(e,n,t))},rzt=e=>{let t=cl(e);return nd(e,t,n=>Lg(e,n,t))},szt=e=>nd(e,!1,t=>ut.cursor(e.lineBlockAt(t.head).from)),ozt=e=>nd(e,!0,t=>ut.cursor(e.lineBlockAt(t.head).to)),Dre=({state:e,dispatch:t})=>(t(zd(e,{anchor:0})),!0),Mre=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.doc.length})),!0),Lre=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.selection.main.anchor,head:0})),!0),$re=({state:e,dispatch:t})=>(t(zd(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),azt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),lzt=({state:e,dispatch:t})=>{let n=_D(e).map(({from:i,to:r})=>ut.range(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:ut.create(n),userEvent:"select"})),!0},czt=({state:e,dispatch:t})=>{let n=p1(e.selection,i=>{let r=Lr(e),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return ut.range(l.to,l.from)}return i});return n.eq(e.selection)?!1:(t(zd(e,n)),!0)};function D$e(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(t?o.to0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.heado.to){r.some(u=>u.head==c.head)||r.push(c);break}else{if(c.head==l.head)break;l=c}}}return r.length==i.ranges.length?!1:(e.dispatch(zd(n,ut.create(r,r.length-1))),!0)}const uzt=e=>D$e(e,!1),dzt=e=>D$e(e,!0),fzt=({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=ut.create([n.main]):n.main.empty||(i=ut.create([ut.cursor(n.main.head)])),i?(t(zd(e,i)),!0):!1};function cT(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let c=t(s);co&&(n="delete.forward",c=R2(e,c,!0)),o=Math.min(o,c),l=Math.max(l,c)}else o=R2(e,o,!1),l=R2(e,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:ut.cursor(o,or(e)))i.between(t,t,(r,s)=>{rt&&(t=n?s:r)});return t}const M$e=(e,t,n)=>cT(e,i=>{let r=i.from,{state:s}=e,o=s.doc.lineAt(r),l,c;if(n&&!t&&r>o.from&&rM$e(e,!1,!0),L$e=e=>M$e(e,!0,!1),$$e=(e,t)=>cT(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(t?s.to:s.from)){i==n.head&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let c=ba(s.text,i-s.from,t)+s.from,u=s.text.slice(Math.min(i,c)-s.from,Math.max(i,c)-s.from),d=o(u);if(l!=null&&d!=l)break;(u!=" "||i!=n.head)&&(l=d),i=c}return i}),F$e=e=>$$e(e,!1),hzt=e=>$$e(e,!0),pzt=e=>cT(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headcT(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),gzt=e=>cT(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:sr.of(["",""])},range:ut.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},yzt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,s=e.doc.lineAt(r),o=r==s.from?r-1:ba(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:ba(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(o,r))},range:ut.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _D(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),s=e.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=e.doc.lineAt(i.to-1)),n>=r.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function B$e(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let s of _D(e)){if(n?s.to==e.doc.length:s.from==0)continue;let o=e.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+e.lineBreak});for(let c of s.ranges)r.push(ut.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:e.lineBreak+o.text});for(let c of s.ranges)r.push(ut.range(c.anchor-l,c.head-l))}}return i.length?(t(e.update({changes:i,scrollIntoView:!0,selection:ut.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const vzt=({state:e,dispatch:t})=>B$e(e,t,!1),xzt=({state:e,dispatch:t})=>B$e(e,t,!0);function U$e(e,t,n){if(e.readOnly)return!1;let i=[];for(let s of _D(e))n?i.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):i.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const wzt=({state:e,dispatch:t})=>U$e(e,t,!1),Ozt=({state:e,dispatch:t})=>U$e(e,t,!0),kzt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(_D(t).map(({from:r,to:s})=>(r>0?r--:s{let s;if(e.lineWrapping){let o=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,s)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Szt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Lr(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),s;return i&&r&&i.to<=t&&r.from>=t&&(s=i.type.prop(Kn.closedBy))&&s.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const Fre=Q$e(!1),Ezt=Q$e(!0);function Q$e(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{let{from:s,to:o}=r,l=t.doc.lineAt(s),c=!e&&s==o&&Szt(t,s);e&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let u=new xD(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=ZV(u,s);for(d==null&&(d=Id(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let r=[];for(let o=i.from;o<=i.to;){let l=e.doc.lineAt(o);l.number>n&&(i.empty||i.to>l.from)&&(t(l,r,i),n=l.number),o=l.to+1}let s=e.changes(r);return{changes:r,range:ut.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Czt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new xD(e,{overrideIndentation:s=>{let o=n[s];return o??-1}}),r=jH(e,(s,o,l)=>{let c=ZV(i,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=TE(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(jH(e,(n,i)=>{i.push({from:n.from,insert:e.facet(f1)})}),{userEvent:"input.indent"})),!0),V$e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(jH(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let s=Id(r,e.tabSize),o=0,l=TE(e,Math.max(0,s-jy(e)));for(;o(e.setTabFocusMode(),!0),Azt=[{key:"Ctrl-b",run:v$e,shift:A$e,preventDefault:!0},{key:"Ctrl-f",run:x$e,shift:_$e},{key:"Ctrl-p",run:k$e,shift:R$e},{key:"Ctrl-n",run:S$e,shift:I$e},{key:"Ctrl-a",run:WQt,shift:szt},{key:"Ctrl-e",run:KQt,shift:ozt},{key:"Ctrl-d",run:L$e},{key:"Ctrl-h",run:DB},{key:"Ctrl-k",run:pzt},{key:"Ctrl-Alt-h",run:F$e},{key:"Ctrl-o",run:bzt},{key:"Ctrl-t",run:yzt},{key:"Ctrl-v",run:PB}],_zt=[{key:"ArrowLeft",run:v$e,shift:A$e,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:$Qt,shift:YQt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:HQt,shift:izt,preventDefault:!0},{key:"ArrowRight",run:x$e,shift:_$e,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:FQt,shift:ZQt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:qQt,shift:rzt,preventDefault:!0},{key:"ArrowUp",run:k$e,shift:R$e,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Dre,shift:Lre},{mac:"Ctrl-ArrowUp",run:Rre,shift:Ire},{key:"ArrowDown",run:S$e,shift:I$e,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Mre,shift:$re},{mac:"Ctrl-ArrowDown",run:PB,shift:Pre},{key:"PageUp",run:Rre,shift:Ire},{key:"PageDown",run:PB,shift:Pre},{key:"Home",run:VQt,shift:nzt,preventDefault:!0},{key:"Mod-Home",run:Dre,shift:Lre},{key:"End",run:zQt,shift:tzt,preventDefault:!0},{key:"Mod-End",run:Mre,shift:$re},{key:"Enter",run:Fre,shift:Fre},{key:"Mod-a",run:azt},{key:"Backspace",run:DB,shift:DB,preventDefault:!0},{key:"Delete",run:L$e,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:F$e,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:hzt,preventDefault:!0},{mac:"Mod-Backspace",run:mzt,preventDefault:!0},{mac:"Mod-Delete",run:gzt,preventDefault:!0}].concat(Azt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),jzt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:UQt,shift:JQt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:QQt,shift:ezt},{key:"Alt-ArrowUp",run:vzt},{key:"Shift-Alt-ArrowUp",run:wzt},{key:"Alt-ArrowDown",run:xzt},{key:"Shift-Alt-ArrowDown",run:Ozt},{key:"Mod-Alt-ArrowUp",run:uzt},{key:"Mod-Alt-ArrowDown",run:dzt},{key:"Escape",run:fzt},{key:"Mod-Enter",run:Ezt},{key:"Alt-l",mac:"Ctrl-l",run:lzt},{key:"Mod-i",run:czt,preventDefault:!0},{key:"Mod-[",run:V$e},{key:"Mod-]",run:z$e},{key:"Mod-Alt-\\",run:Czt},{key:"Shift-Mod-k",run:kzt},{key:"Shift-Mod-\\",run:XQt},{key:"Mod-/",run:vQt},{key:"Alt-A",run:wQt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Tzt}].concat(_zt),Nzt={key:"Tab",run:z$e,shift:V$e},Bre=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Sw{constructor(t,n,i=0,r=t.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,r),this.bufferStart=i,this.normalize=s?l=>s(Bre(l)):Bre,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Zl(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=RV(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=hf(t);let r=this.normalize(n);if(r.length)for(let s=0,o=i,l=!0;;s++){let c=r.charCodeAt(s),u=this.match(c,o,l,this.bufferPos+this.bufferStart,s==r.length-1);if(u)return this.value=u,this;if(s==r.length-1)break;l&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let i=this.curLineStart+n.index,r=i+n[0].length;if(this.matchPos=jR(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||r.to<=n){let l=new Ox(n,t.sliceString(n,i));return J3.set(t,l),l}if(r.from==n&&r.to==i)return r;let{text:s,from:o}=r;return o>n&&(s=t.sliceString(n,o)+s,o=n),r.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let i=this.flat.from+n.index,r=i+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,precise:!0,match:n},this.matchPos=jR(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ox.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(q$e.prototype[Symbol.iterator]=W$e.prototype[Symbol.iterator]=function(){return this});function Rzt(e){try{return new RegExp(e,NH),!0}catch{return!1}}function jR(e,t){if(t>=e.length)return t;let n=e.lineAt(t),i;for(;t=56320&&i<57344;)t++;return t}const Izt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:i,result:r}=V$t(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){e.dispatch({effects:i});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=o,h=d?+d.slice(1):0,m=u?+u:l.number;if(u&&f){let v=m/100;c&&(v=v*(c=="-"?-1:1)+l.number/t.doc.lines),m=Math.round(t.doc.lines*v)}else u&&c&&(m=m*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,m))),b=ut.cursor(g.from+Math.max(0,Math.min(h,g.length)));e.dispatch({effects:[i,Xt.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},Pzt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Dzt=an.define({combine(e){return Wf(e,Pzt,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Mzt(e){return[Uzt,Bzt]}const Lzt=Cn.mark({class:"cm-selectionMatch"}),$zt=Cn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ure(e,t,n,i){return(n==0||e(t.sliceDoc(n-1,n))!=Ts.Word)&&(i==t.doc.length||e(t.sliceDoc(i,i+1))!=Ts.Word)}function Fzt(e,t,n,i){return e(t.sliceDoc(n,n+1))==Ts.Word&&e(t.sliceDoc(i-1,i))==Ts.Word}const Bzt=Zs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Dzt),{state:n}=e,i=n.selection;if(i.ranges.length>1)return Cn.none;let r=i.main,s,o=null;if(r.empty){if(!t.highlightWordAroundCursor)return Cn.none;let c=n.wordAt(r.head);if(!c)return Cn.none;o=n.charCategorizer(r.head),s=n.sliceDoc(c.from,c.to)}else{let c=r.to-r.from;if(c200)return Cn.none;if(t.wholeWords){if(s=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(Ure(o,n,r.from,r.to)&&Fzt(o,n,r.from,r.to)))return Cn.none}else if(s=n.sliceDoc(r.from,r.to),!s)return Cn.none}let l=[];for(let c of e.visibleRanges){let u=new Sw(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!o||Ure(o,n,d,f))&&(r.empty&&d<=r.from&&f>=r.to?l.push($zt.range(d,f)):(d>=r.to||f<=r.from)&&l.push(Lzt.range(d,f)),l.length>t.maxMatches))return Cn.none}}return Cn.set(l)}},{decorations:e=>e.decorations}),Uzt=Xt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Qzt=({state:e,dispatch:t})=>{let{selection:n}=e,i=ut.create(n.ranges.map(r=>e.wordAt(r.head)||ut.cursor(r.head)),n.mainIndex);return i.eq(n)?!1:(t(e.update({selection:i})),!0)};function zzt(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),s=r&&r.from==n.from&&r.to==n.to;for(let o=!1,l=new Sw(e.doc,t,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Sw(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Vzt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Qzt({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=i))return!1;let r=zzt(e,i);return r?(t(e.update({selection:e.selection.addRange(ut.range(r.from,r.to),!1),effects:Xt.scrollIntoView(r.to)})),!0):!1},m1=an.define({combine(e){return Wf(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new rVt(t),scrollToMatch:t=>Xt.scrollIntoView(t)})}});class K$e{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||Rzt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new Xzt(this):new Wzt(this)}getCursor(t,n=0,i){let r=t.doc?t:Ui.create({doc:t});return i==null&&(i=r.doc.length),this.regexp?fv(this,r,n,i):dv(this,r,n,i)}}class G$e{constructor(t){this.spec=t}}function Hzt(e,t,n){return(i,r,s,o)=>{if(n&&!n(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):t.doc.sliceString(i,r);return e(l,t,i,r)}}function dv(e,t,n,i){let r;return e.wholeWord&&(r=qzt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=Hzt(e.test,t,r)),new Sw(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:s=>s.toLowerCase(),r)}function qzt(e,t){return(n,i,r,s)=>((s>n||s+r.length=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let s=dv(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function Kzt(e,t,n){return(i,r,s)=>(!n||n(i,r,s))&&e(s[0],t,i,r)}function fv(e,t,n,i){let r;return e.wholeWord&&(r=Gzt(t.charCategorizer(t.selection.main.head))),e.test&&(r=Kzt(e.test,t,r)),new q$e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,i)}function NR(e,t){return e.slice(ba(e,t,!1),t)}function RR(e,t){return e.slice(t,ba(e,t))}function Gzt(e){return(t,n,i)=>!i[0].length||(e(NR(i.input,i.index))!=Ts.Word||e(RR(i.input,i.index))!=Ts.Word)&&(e(RR(i.input,i.index+i[0].length))!=Ts.Word||e(NR(i.input,i.index+i[0].length))!=Ts.Word)}class Xzt extends G$e{nextMatch(t,n,i){let r=fv(this.spec,t,i,t.doc.length).next();return r.done&&(r=fv(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,i){for(let r=1;;r++){let s=Math.max(n,i-r*1e4),o=fv(this.spec,t,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(t,n,i){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,i)=>{if(i=="&")return t.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let s=fv(this.spec,t,Math.max(0,n-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const $E=Gn.define(),RH=Gn.define(),qm=Qa.define({create(e){return new e4(MB(e).create(),null)},update(e,t){for(let n of t.effects)n.is($E)?e=new e4(n.value.create(),e.panel):n.is(RH)&&(e=new e4(e.query,n.value?IH:null));return e},provide:e=>EE.from(e,t=>t.panel)});class e4{constructor(t,n){this.query=t,this.panel=n}}const Yzt=Cn.mark({class:"cm-searchMatch"}),Zzt=Cn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Jzt=Zs.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(qm))}update(e){let t=e.state.field(qm);(t!=e.startState.field(qm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Cn.none;let{view:n}=this,i=new pp;for(let r=0,s=n.visibleRanges,o=s.length;rs[r+1].from-2*250;)c=s[++r].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);i.add(u,d,f?Zzt:Yzt)})}return i.finish()}},{decorations:e=>e.decorations});function uT(e){return t=>{let n=t.state.field(qm,!1);return n&&n.query.spec.valid?e(t,n):Z$e(t)}}const IR=uT((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);if(!i)return!1;let r=ut.single(i.from,i.to),s=e.state.facet(m1);return e.dispatch({selection:r,effects:[PH(e,i),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),Y$e(e),!0}),PR=uT((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,r=t.prevMatch(n,i,i);if(!r)return!1;let s=ut.single(r.from,r.to),o=e.state.facet(m1);return e.dispatch({selection:s,effects:[PH(e,r),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),Y$e(e),!0}),eVt=uT((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ut.create(n.map(i=>ut.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),tVt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,s=[],o=0;for(let l=new Sw(e.doc,e.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(ut.range(l.value.from,l.value.to))}return t(e.update({selection:ut.create(s,o),userEvent:"select.search.matches"})),!0},Qre=uT((e,{query:t})=>{let{state:n}=e,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,i,i);if(!s)return!1;let o=s,l=[],c,u,d=[];o.precise?o.from==i&&o.to==r&&(u=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),o=t.nextMatch(n,o.from,o.to),d.push(Xt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(l);return o&&(c=ut.single(o.from,o.to).map(f),d.push(PH(e,o)),d.push(n.facet(m1).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),nVt=uT((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:s,to:o,precise:l}=r;l&&n.push({from:s,to:o,insert:t.getReplacement(r)})}if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Xt.announce.of(i),userEvent:"input.replace.all"}),!0});function IH(e){return e.state.facet(m1).createPanel(e)}function MB(e,t){var n,i,r,s,o;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(m1);return new K$e({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(i=t==null?void 0:t.caseSensitive)!==null&&i!==void 0?i:u.caseSensitive,literal:(r=t==null?void 0:t.literal)!==null&&r!==void 0?r:u.literal,regexp:(s=t==null?void 0:t.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function X$e(e){let t=XV(e,IH);return t&&t.dom.querySelector("[main-field]")}function Y$e(e){let t=X$e(e);t&&t==e.root.activeElement&&t.select()}const Z$e=e=>{let t=e.state.field(qm,!1);if(t&&t.panel){let n=X$e(e);if(n&&n!=e.root.activeElement){let i=MB(e.state,t.query.spec);i.valid&&e.dispatch({effects:$E.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[RH.of(!0),t?$E.of(MB(e.state,t.query.spec)):Gn.appendConfig.of(oVt)]});return!0},J$e=e=>{let t=e.state.field(qm,!1);if(!t||!t.panel)return!1;let n=XV(e,IH);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:RH.of(!1)}),!0},iVt=[{key:"Mod-f",run:Z$e,scope:"editor search-panel"},{key:"F3",run:IR,shift:PR,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:IR,shift:PR,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:J$e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:tVt},{key:"Mod-Alt-g",run:Izt},{key:"Mod-d",run:Vzt,preventDefault:!0}];class rVt{constructor(t){this.view=t;let n=this.query=t.state.field(qm).query.spec;this.commit=this.commit.bind(this),this.searchField=Ir("input",{value:n.search,placeholder:_c(t,"Find"),"aria-label":_c(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ir("input",{value:n.replace,placeholder:_c(t,"Replace"),"aria-label":_c(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ir("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ir("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ir("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function i(r,s,o){return Ir("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=Ir("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>IR(t),[_c(t,"next")]),i("prev",()=>PR(t),[_c(t,"previous")]),i("select",()=>eVt(t),[_c(t,"all")]),Ir("label",null,[this.caseField,_c(t,"match case")]),Ir("label",null,[this.reField,_c(t,"regexp")]),Ir("label",null,[this.wordField,_c(t,"by word")]),...t.state.readOnly?[]:[Ir("br"),this.replaceField,i("replace",()=>Qre(t),[_c(t,"replace")]),i("replaceAll",()=>nVt(t),[_c(t,"replace all")])],Ir("button",{name:"close",onclick:()=>J$e(t),"aria-label":_c(t,"close"),type:"button"},["×"])])}commit(){let t=new K$e({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:$E.of(t)}))}keydown(t){J4t(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?PR:IR)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Qre(this.view))}update(t){for(let n of t.transactions)for(let i of n.effects)i.is($E)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(m1).top}}function _c(e,t){return e.state.phrase(t)}const I2=30,P2=/[\s\.,:;?!]/;function PH(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,s=Math.max(i.from,t-I2),o=Math.min(r,n+I2),l=e.state.sliceDoc(s,o);if(s!=i.from){for(let c=0;cl.length-I2;c--)if(!P2.test(l[c-1])&&P2.test(l[c])){l=l.slice(0,c);break}}return Xt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const sVt=Xt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),oVt=[qm,Ap.low(Jzt),sVt];class zre{constructor(t,n,i){this.from=t,this.to=n,this.diagnostic=i}}class Tb{constructor(t,n,i){this.diagnostics=t,this.panel=n,this.selected=i}static init(t,n,i){let r=i.facet(FE).markerFilter;r&&(t=r(t,i));let s=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),o=new pp,l=[],c=0,u=i.doc.iter(),d=0,f=i.doc.length;for(let m=0;;){let g=m==s.length?null:s[m];if(!g&&!l.length)break;let b,v;if(l.length)b=c,v=l.reduce((w,O)=>Math.min(w,O.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;v=g.to,l.push(g),m++}for(;mw.from||w.to==b))l.push(w),m++,v=Math.min(w.to,v);else{v=Math.min(w.from,v);break}}v=Math.min(v,f);let y=!1;if(l.some(w=>w.from==b&&(w.to==v||v==f))&&(y=b==v,!y&&v-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let O=b;;){if(O>=v){y=!0;break}if(!u.lineBreak&&d+u.value.length>O)break;O=d+u.value.length,d+=u.value.length,u.next()}}let x=vVt(l);if(y)o.add(b,b,Cn.widget({widget:new mVt(x),diagnostics:l.slice()}));else{let w=l.reduce((O,S)=>S.markClass?O+" "+S.markClass:O,"");o.add(b,v,Cn.mark({class:"cm-lintRange cm-lintRange-"+x+w,diagnostics:l.slice(),inclusiveEnd:l.some(O=>O.to>v)}))}if(c=v,c==f)break;for(let w=0;w{if(!(t&&o.diagnostics.indexOf(t)<0))if(!i)i=new zre(r,s,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new zre(i.from,s,i.diagnostic)}}),i}function aVt(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(FE).hideOn(e,n,i);if(r!=null)return r;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(e6e))||e.changes.touchesRange(s.from,Math.max(s.to,i)))}function lVt(e,t){return e.field(Wc,!1)?t:t.concat(Gn.appendConfig.of(xVt))}const e6e=Gn.define(),DH=Gn.define(),t6e=Gn.define(),Wc=Qa.define({create(){return new Tb(Cn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);i=wg(n,e.selected.diagnostic,s)||wg(n,null,s)}!n.size&&r&&t.state.facet(FE).autoPanel&&(r=null),e=new Tb(n,r,i)}for(let n of t.effects)if(n.is(e6e)){let i=t.state.facet(FE).autoPanel?n.value.length?BE.open:null:e.panel;e=Tb.init(n.value,i,t.state)}else n.is(DH)?e=new Tb(e.diagnostics,n.value?BE.open:null,e.selected):n.is(t6e)&&(e=new Tb(e.diagnostics,e.panel,n.value));return e},provide:e=>[EE.from(e,t=>t.panel),Xt.decorations.from(e,t=>t.diagnostics)]}),cVt=Cn.mark({class:"cm-lintRange cm-lintRange-active"});function uVt(e,t,n){let{diagnostics:i}=e.state.field(Wc),r,s=-1,o=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(ti6e(e,n,!1)))}const fVt=e=>{let t=e.state.field(Wc,!1);(!t||!t.panel)&&e.dispatch({effects:lVt(e.state,[DH.of(!0)])});let n=XV(e,BE.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Vre=e=>{let t=e.state.field(Wc,!1);return!t||!t.panel?!1:(e.dispatch({effects:DH.of(!1)}),!0)},hVt=e=>{let t=e.state.field(Wc,!1);if(!t)return!1;let n=e.state.selection.main,i=wg(t.diagnostics,null,n.to+1);return!i&&(i=wg(t.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),Q$t(e,i.from,1,{tooltip:r6e,until:r=>r.docChanged||r.newSelection.main.headi.to}),!0)},pVt=[{key:"Mod-Shift-m",run:fVt,preventDefault:!0},{key:"F8",run:hVt}],FE=an.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Wf(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Hre,tooltipFilter:Hre,needsRefresh:(t,n)=>t?n?i=>t(i)||n(i):t:n,hideOn:(t,n)=>t?n?(i,r,s)=>t(i,r,s)||n(i,r,s):t:n,autoPanel:(t,n)=>t||n})}}});function Hre(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function n6e(e){let t=[];if(e)e:for(let{name:n}of e){for(let i=0;is.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function i6e(e,t,n){var i;let r=n?n6e(t.actions):[];return Ir("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ir("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(i=t.actions)===null||i===void 0?void 0:i.map((s,o)=>{let l=!1,c=m=>{if(m.preventDefault(),l)return;l=!0;let g=wg(e.state.field(Wc).diagnostics,t);g&&s.apply(e,g.from,g.to)},{name:u}=s,d=r[o]?u.indexOf(r[o]):-1,f=d<0?u:[u.slice(0,d),Ir("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return Ir("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},f)}),t.source&&Ir("div",{class:"cm-diagnosticSource"},t.source))}class mVt extends Qd{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Ir("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qre{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=i6e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class BE{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)Vre(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=n6e(s.actions);for(let l=0;l{for(let s=0;sVre(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Wc).selected;if(!t)return-1;for(let n=0;n{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let f=-1,h;for(let m=i;mi&&(this.items.splice(i,f-i),r=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),i++}});i({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let i=t;t=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)n();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Wc),i=wg(n.diagnostics,this.items[t].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:t6e.of(i)})}static open(t){return new BE(t)}}function gVt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function D2(e){return gVt(``,'width="6" height="3"')}const bVt=Xt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:D2("#f11")},".cm-lintRange-warning":{backgroundImage:D2("orange")},".cm-lintRange-info":{backgroundImage:D2("#999")},".cm-lintRange-hint":{backgroundImage:D2("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function yVt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function vVt(e){let t="hint",n=1;for(let i of e){let r=yVt(i.severity);r>n&&(n=r,t=i.severity)}return t}const r6e=U$t(uVt,{hideOn:aVt}),xVt=[Wc,Xt.decorations.compute([Wc],e=>{let{selected:t,panel:n}=e.field(Wc);return!t||!n||t.from==t.to?Cn.none:Cn.set([cVt.range(t.from,t.to)])}),r6e,bVt];var Wre=function(t){t===void 0&&(t={});var n=t,i=n.crosshairCursor,r=i===void 0?!1:i,s=[];t.closeBracketsKeymap!==!1&&(s=s.concat(T8t)),t.defaultKeymap!==!1&&(s=s.concat(jzt)),t.searchKeymap!==!1&&(s=s.concat(iVt)),t.historyKeymap!==!1&&(s=s.concat(LQt)),t.foldKeymap!==!1&&(s=s.concat(N6t)),t.completionKeymap!==!1&&(s=s.concat(M3e)),t.lintKeymap!==!1&&(s=s.concat(pVt));var o=[];return t.lineNumbers!==!1&&o.push(J5e()),t.highlightActiveLineGutter!==!1&&o.push(i6t()),t.highlightSpecialChars!==!1&&o.push(g$t()),t.history!==!1&&o.push(AQt()),t.foldGutter!==!1&&o.push(D6t()),t.drawSelection!==!1&&o.push(s$t()),t.dropCursor!==!1&&o.push(u$t()),t.allowMultipleSelections!==!1&&o.push(Ui.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&o.push(k6t()),t.syntaxHighlighting!==!1&&o.push(p3e(F6t,{fallback:!0})),t.bracketMatching!==!1&&o.push(q6t()),t.closeBrackets!==!1&&o.push(k8t()),t.autocompletion!==!1&&o.push(P8t()),t.rectangularSelection!==!1&&o.push(j$t()),r!==!1&&o.push(I$t()),t.highlightActiveLine!==!1&&o.push(O$t()),t.highlightSelectionMatches!==!1&&o.push(Mzt()),t.tabSize&&typeof t.tabSize=="number"&&o.push(f1.of(" ".repeat(t.tabSize))),o.concat([d1.of(s.flat())]).filter(Boolean)};const wVt="#e5c07b",Kre="#e06c75",OVt="#56b6c2",kVt="#ffffff",pj="#abb2bf",LB="#7d8799",SVt="#61afef",EVt="#98c379",Gre="#d19a66",CVt="#c678dd",TVt="#21252b",Xre="#2c313a",Yre="#282c34",t4="#353a42",AVt="#3E4451",Zre="#528bff",_Vt=Xt.theme({"&":{color:pj,backgroundColor:Yre},".cm-content":{caretColor:Zre},".cm-cursor, .cm-dropCursor":{borderLeftColor:Zre},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:AVt},".cm-panels":{backgroundColor:TVt,color:pj},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yre,color:LB,border:"none"},".cm-activeLineGutter":{backgroundColor:Xre},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:t4},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:t4,borderBottomColor:t4},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xre,color:pj}}},{dark:!0}),jVt=aT.define([{tag:oe.keyword,color:CVt},{tag:[oe.name,oe.deleted,oe.character,oe.propertyName,oe.macroName],color:Kre},{tag:[oe.function(oe.variableName),oe.labelName],color:SVt},{tag:[oe.color,oe.constant(oe.name),oe.standard(oe.name)],color:Gre},{tag:[oe.definition(oe.name),oe.separator],color:pj},{tag:[oe.typeName,oe.className,oe.number,oe.changed,oe.annotation,oe.modifier,oe.self,oe.namespace],color:wVt},{tag:[oe.operator,oe.operatorKeyword,oe.url,oe.escape,oe.regexp,oe.link,oe.special(oe.string)],color:OVt},{tag:[oe.meta,oe.comment],color:LB},{tag:oe.strong,fontWeight:"bold"},{tag:oe.emphasis,fontStyle:"italic"},{tag:oe.strikethrough,textDecoration:"line-through"},{tag:oe.link,color:LB,textDecoration:"underline"},{tag:oe.heading,fontWeight:"bold",color:Kre},{tag:[oe.atom,oe.bool,oe.special(oe.variableName)],color:Gre},{tag:[oe.processingInstruction,oe.string,oe.inserted],color:EVt},{tag:oe.invalid,color:kVt}]),NVt=[_Vt,p3e(jVt)];var RVt=Xt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),IVt=function(t){t===void 0&&(t={});var n=t,i=n.indentWithTab,r=i===void 0?!0:i,s=n.editable,o=s===void 0?!0:s,l=n.readOnly,c=l===void 0?!1:l,u=n.theme,d=u===void 0?"light":u,f=n.placeholder,h=f===void 0?"":f,m=n.basicSetup,g=m===void 0?!0:m,b=[];switch(r&&b.unshift(d1.of([Nzt])),g&&(typeof g=="boolean"?b.unshift(Wre()):b.unshift(Wre(g))),h&&b.unshift(C$t(h)),d){case"light":b.push(RVt);break;case"dark":b.push(NVt);break;case"none":break;default:b.push(d);break}return o===!1&&b.push(Xt.editable.of(!1)),c&&b.push(Ui.readOnly.of(!0)),[...b]},PVt=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class DVt{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class Jre{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var n4=null,MVt=()=>typeof window>"u"?new Jre:(n4||(n4=new Jre),n4),LVt=Xt.theme({"& .cm-scroller":{height:"100% !important"}}),ese=null,i4=null;function $Vt(e,t,n,i,r,s){if(!e&&!t&&!n&&!i&&!r&&!s)return null;var o=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s});return o===ese||(ese=o,i4=Xt.theme({"&":{height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:s}})),i4}var tse=qf.define(),FVt=200,BVt=[];function UVt(e){var t=e.value,n=e.selection,i=e.onChange,r=e.onStatistics,s=e.onCreateEditor,o=e.onUpdate,l=e.extensions,c=l===void 0?BVt:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,m=h===void 0?null:h,g=e.minHeight,b=g===void 0?null:g,v=e.maxHeight,y=v===void 0?null:v,x=e.width,w=x===void 0?null:x,O=e.minWidth,S=O===void 0?null:O,k=e.maxWidth,C=k===void 0?null:k,E=e.placeholder,R=E===void 0?"":E,_=e.editable,j=_===void 0?!0:_,T=e.readOnly,N=T===void 0?!1:T,A=e.indentWithTab,P=A===void 0?!0:A,D=e.basicSetup,M=D===void 0?!0:D,L=e.root,U=e.initialState,I=p.useState(),H=I[0],K=I[1],F=p.useState(),W=F[0],V=F[1],X=p.useState(),ie=X[0],Q=X[1],Z=p.useState(()=>({current:null}))[0],ce=p.useState(()=>({current:null}))[0],Ee=$Vt(m,b,y,w,S,C),Y=Xt.updateListener.of(ye=>{if(ye.docChanged&&typeof i=="function"&&!ye.transactions.some(me=>me.annotation(tse))){Z.current?Z.current.reset():(Z.current=new DVt(()=>{if(ce.current){var me=ce.current;ce.current=null,me()}Z.current=null},FVt),MVt().add(Z.current));var Ne=ye.state.doc,pe=Ne.toString();i(pe,ye)}r&&r(PVt(ye))}),G=IVt({theme:f,editable:j,readOnly:N,placeholder:R,indentWithTab:P,basicSetup:M}),te=[Y,...Ee?[Ee]:[],LVt,...G];return o&&typeof o=="function"&&te.push(Xt.updateListener.of(o)),te=te.concat(c),p.useLayoutEffect(()=>{if(H&&!ie){var ye={doc:t,selection:n,extensions:te},Ne=U?Ui.fromJSON(U.json,ye,U.fields):Ui.create(ye);if(Q(Ne),!W){var pe=new Xt({state:Ne,parent:H,root:L});V(pe),s&&s(pe,Ne)}}return()=>{W&&(Q(void 0),V(void 0))}},[H,ie]),p.useEffect(()=>{e.container&&K(e.container)},[e.container]),p.useEffect(()=>()=>{W&&(W.destroy(),V(void 0)),Z.current&&(Z.current.cancel(),Z.current=null)},[W]),p.useEffect(()=>{u&&W&&W.focus()},[u,W]),p.useEffect(()=>{W&&W.dispatch({effects:Gn.reconfigure.of(te)})},[f,c,m,b,y,w,S,C,R,j,N,P,M,i,o]),p.useEffect(()=>{if(t!==void 0){var ye=W?W.state.doc.toString():"";if(W&&t!==ye){var Ne=Z.current&&!Z.current.isDone,pe=()=>{W&&t!==W.state.doc.toString()&&W.dispatch({changes:{from:0,to:W.state.doc.toString().length,insert:t||""},annotations:[tse.of(!0)]})};Ne?ce.current=pe:pe()}}},[t,W]),{state:ie,setState:Q,view:W,setView:V,container:H,setContainer:K}}var QVt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],s6e=p.forwardRef((e,t)=>{var n=e.className,i=e.value,r=i===void 0?"":i,s=e.selection,o=e.extensions,l=o===void 0?[]:o,c=e.onChange,u=e.onStatistics,d=e.onCreateEditor,f=e.onUpdate,h=e.autoFocus,m=e.theme,g=m===void 0?"light":m,b=e.height,v=e.minHeight,y=e.maxHeight,x=e.width,w=e.minWidth,O=e.maxWidth,S=e.basicSetup,k=e.placeholder,C=e.indentWithTab,E=e.editable,R=e.readOnly,_=e.root,j=e.initialState,T=yQt(e,QVt),N=p.useRef(null),A=UVt({root:_,value:r,autoFocus:h,theme:g,height:b,minHeight:v,maxHeight:y,width:x,minWidth:w,maxWidth:O,basicSetup:S,placeholder:k,indentWithTab:C,editable:E,readOnly:R,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:j}),P=A.state,D=A.view,M=A.container,L=A.setContainer;p.useImperativeHandle(t,()=>({editor:N.current,state:P,view:D}),[N,M,P,D]);var U=p.useCallback(H=>{N.current=H,L(H)},[L]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var I=typeof g=="string"?"cm-theme-"+g:"cm-theme";return a.jsx("div",NB({ref:U,className:""+I+(n?" "+n:"")},T))});s6e.displayName="CodeMirror";function o6e(e){const t=e.toLowerCase(),n=t.split("/").pop()??t,i=n.includes(".")?n.split(".").pop():"";return n==="dockerfile"||n.startsWith("dockerfile.")||n.endsWith(".dockerfile")?[eH.define(bQt)]:i==="py"||i==="pyi"?[TUt()]:["ts","tsx","mts","cts"].includes(i??"")?[yB({typescript:!0,jsx:i==="tsx"})]:["js","jsx","mjs","cjs"].includes(i??"")?[yB({jsx:i==="jsx"})]:i==="json"||i==="jsonc"?[W8t()]:i==="yaml"||i==="yml"?[iQt()]:["md","markdown"].includes(i??"")?[a7t()]:[]}function dT({value:e,path:t,onChange:n,readOnly:i=!1,theme:r="light",lineNumberStart:s=1,height:o="100%",minHeight:l,maxHeight:c,extensions:u}){const d=p.useMemo(()=>[...o6e(t),...s===1?[]:[J5e({formatNumber:f=>String(f+s-1)})],...u??[]],[s,t,u]);return a.jsx(s6e,{value:e,height:o,minHeight:l,maxHeight:c,theme:r,extensions:d,editable:!i,onChange:n,basicSetup:{lineNumbers:s===1,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const a6e=Object.freeze(Object.defineProperty({__proto__:null,default:dT,languageFor:o6e},Symbol.toStringTag,{value:"Module"}));function zVt(e){var s;const t=e.split(/\r?\n/);if(((s=t[0])==null?void 0:s.trim())!=="---")return{body:e,frontmatter:[]};const n=t.findIndex((o,l)=>l>0&&o.trim()==="---");if(n<0)return{body:e,frontmatter:[]};const i=OLe(t.slice(1,n).join(` `));if(i.errors.length>0)return{body:e,frontmatter:[]};const r=i.toJS();return!r||typeof r!="object"||Array.isArray(r)?{body:e,frontmatter:[]}:{body:t.slice(n+1).join(` -`).replace(/^\s*\n/,""),frontmatter:Object.entries(r).map(([o,l])=>({key:o,value:typeof l=="string"?l:uD(l).trim()}))}}function QVt(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M2.75 5.5h5l1.5 1.75h8v7.25a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-9Z"})})}function zVt(){return a.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2.75h6l4 4v10.5H5z"}),a.jsx("path",{d:"M11 2.75v4h4"})]})}function VVt(e){const t={children:[]};for(const i of e){let r=t;const s=i.path.split("/").filter(Boolean);s.forEach((o,l)=>{let c=r.children.find(u=>u.name===o);if(!c){const u=s.slice(0,l+1).join("/");c={name:o,path:u,children:[]},r.children.push(c)}l===s.length-1&&(c.file=i),r=c})}const n=i=>{i.sort((r,s)=>+!!r.file-+!!s.file||r.name.localeCompare(s.name)),i.forEach(r=>n(r.children))};return n(t.children),t.children}function l6e({nodes:e,depth:t,activePath:n,onSelect:i}){return e.map(r=>a.jsxs("div",{children:[r.file?a.jsxs("button",{type:"button",className:`skill-file-tree__row${r.path===n?" is-active":""}`,style:{paddingLeft:`${12+t*16}px`},onClick:()=>i(r.file),title:r.path,children:[a.jsx(zVt,{}),a.jsx("span",{children:r.name}),a.jsxs("small",{children:[r.file.size.toLocaleString()," B"]})]}):a.jsxs("div",{className:"skill-file-tree__row is-folder",style:{paddingLeft:`${12+t*16}px`},title:r.path,children:[a.jsx(QVt,{}),a.jsx("span",{children:r.name})]}),r.children.length>0?a.jsx(l6e,{nodes:r.children,depth:t+1,activePath:n,onSelect:i}):null]},r.path))}function HVt(e){if(e.content===void 0)return;if(e.content.startsWith("data:")){const i=document.createElement("a");i.href=e.content,i.download=e.path.split("/").pop()||"skill-file",i.click();return}const t=URL.createObjectURL(new Blob([e.content])),n=document.createElement("a");n.href=t,n.download=e.path.split("/").pop()||"skill-file",n.click(),URL.revokeObjectURL(t)}function jD({files:e}){var m;const{t,i18n:n}=Ae("skills"),i=p.useMemo(()=>VVt(e),[e]),[r,s]=p.useState(((m=e[0])==null?void 0:m.path)||""),[o,l]=p.useState("preview"),c=e.find(g=>g.path===r)||e[0],u=(c==null?void 0:c.path.toLowerCase())||"",d=u.endsWith(".md")||u.endsWith(".markdown"),f=/\.(png|jpe?g|gif|webp|svg)$/.test(u),h=p.useMemo(()=>UVt(d&&(c==null?void 0:c.content)!==void 0?c.content:""),[c==null?void 0:c.content,d]);return a.jsxs("div",{className:"skill-file-browser",children:[a.jsx("aside",{className:"skill-file-tree","aria-label":t("fileTree.ariaLabel"),children:a.jsx(l6e,{nodes:i,depth:0,activePath:(c==null?void 0:c.path)||"",onSelect:g=>s(g.path)})}),a.jsx("section",{className:"skill-file-preview",children:c?a.jsxs(a.Fragment,{children:[a.jsxs("header",{children:[a.jsx("span",{title:c.path,children:c.path}),a.jsxs("div",{children:[d?a.jsx("button",{type:"button",onClick:()=>l(g=>g==="preview"?"source":"preview"),children:t(o==="preview"?"fileTree.viewSource":"fileTree.viewPreview")}):null,a.jsx("button",{type:"button",disabled:c.content===void 0,onClick:()=>HVt(c),children:t("fileTree.download")})]})]}),a.jsx("div",{className:"skill-file-preview__body",children:c.kind==="binary"||c.content===void 0?a.jsxs("div",{className:"skill-file-preview__binary",children:[a.jsx("strong",{children:t("fileTree.binaryFile")}),a.jsx("span",{children:t("fileTree.bytes",{value:new Intl.NumberFormat(n.resolvedLanguage).format(c.size)})}),a.jsx("span",{children:t("fileTree.binaryDescription")})]}):f?a.jsx("img",{src:c.content.startsWith("data:")?c.content:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c.content)}`,alt:c.path}):d&&o==="preview"?a.jsxs("div",{className:"skill-file-preview__markdown",children:[h.frontmatter.length>0?a.jsx("dl",{className:"skill-file-preview__frontmatter","aria-label":t("fileTree.metadata"),children:h.frontmatter.map(g=>a.jsxs("div",{children:[a.jsx("dt",{children:g.key}),a.jsx("dd",{children:g.value})]},g.key))}):null,a.jsx(Yu,{text:h.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):a.jsx(dT,{value:c.content,path:c.path,readOnly:!0,onChange:()=>{}})})]}):a.jsx("div",{className:"skill-file-preview__binary",children:t("fileTree.noFiles")})})]})}const qVt=Object.freeze(Object.defineProperty({__proto__:null,SkillFileTree:jD},Symbol.toStringTag,{value:"Module"})),WVt=1200,KVt=3,c6e=2,GVt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,nse={concise:"generation.styles.concise",strict:"generation.styles.strict",tutorial:"generation.styles.tutorial",automation:"generation.styles.automation"};function ise(e,t){var n;return{id:`group-${Date.now()}-${e}`,model:((n=t.models[e%Math.max(1,t.models.length)])==null?void 0:n.id)||"",style:"concise",customStyle:""}}function XVt(e){return e?e.state==="ready"?Jt("generation.stages.ready"):e.state==="failed"?Jt("generation.stages.failed"):e.state==="cancelled"?Jt("generation.stages.cancelled"):e.stage==="validating"?Jt("generation.stages.validating"):e.stage==="packaging"?Jt("generation.stages.packaging"):Jt("generation.stages.generating"):Jt("generation.stages.preparing")}function r4(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>GVt.test(n))}function rse(e){var n;const t=((n=e.validation)==null?void 0:n.errors.join(` +`).replace(/^\s*\n/,""),frontmatter:Object.entries(r).map(([o,l])=>({key:o,value:typeof l=="string"?l:uD(l).trim()}))}}function VVt(){return a.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M2.75 5.5h5l1.5 1.75h8v7.25a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-9Z"})})}function HVt(){return a.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2.75h6l4 4v10.5H5z"}),a.jsx("path",{d:"M11 2.75v4h4"})]})}function qVt(e){const t={children:[]};for(const i of e){let r=t;const s=i.path.split("/").filter(Boolean);s.forEach((o,l)=>{let c=r.children.find(u=>u.name===o);if(!c){const u=s.slice(0,l+1).join("/");c={name:o,path:u,children:[]},r.children.push(c)}l===s.length-1&&(c.file=i),r=c})}const n=i=>{i.sort((r,s)=>+!!r.file-+!!s.file||r.name.localeCompare(s.name)),i.forEach(r=>n(r.children))};return n(t.children),t.children}function l6e({nodes:e,depth:t,activePath:n,onSelect:i}){return e.map(r=>a.jsxs("div",{children:[r.file?a.jsxs("button",{type:"button",className:`skill-file-tree__row${r.path===n?" is-active":""}`,style:{paddingLeft:`${12+t*16}px`},onClick:()=>i(r.file),title:r.path,children:[a.jsx(HVt,{}),a.jsx("span",{children:r.name}),a.jsxs("small",{children:[r.file.size.toLocaleString()," B"]})]}):a.jsxs("div",{className:"skill-file-tree__row is-folder",style:{paddingLeft:`${12+t*16}px`},title:r.path,children:[a.jsx(VVt,{}),a.jsx("span",{children:r.name})]}),r.children.length>0?a.jsx(l6e,{nodes:r.children,depth:t+1,activePath:n,onSelect:i}):null]},r.path))}function WVt(e){if(e.content===void 0)return;if(e.content.startsWith("data:")){const i=document.createElement("a");i.href=e.content,i.download=e.path.split("/").pop()||"skill-file",i.click();return}const t=URL.createObjectURL(new Blob([e.content])),n=document.createElement("a");n.href=t,n.download=e.path.split("/").pop()||"skill-file",n.click(),URL.revokeObjectURL(t)}function jD({files:e}){var m;const{t,i18n:n}=Ae("skills"),i=p.useMemo(()=>qVt(e),[e]),[r,s]=p.useState(((m=e[0])==null?void 0:m.path)||""),[o,l]=p.useState("preview"),c=e.find(g=>g.path===r)||e[0],u=(c==null?void 0:c.path.toLowerCase())||"",d=u.endsWith(".md")||u.endsWith(".markdown"),f=/\.(png|jpe?g|gif|webp|svg)$/.test(u),h=p.useMemo(()=>zVt(d&&(c==null?void 0:c.content)!==void 0?c.content:""),[c==null?void 0:c.content,d]);return a.jsxs("div",{className:"skill-file-browser",children:[a.jsx("aside",{className:"skill-file-tree","aria-label":t("fileTree.ariaLabel"),children:a.jsx(l6e,{nodes:i,depth:0,activePath:(c==null?void 0:c.path)||"",onSelect:g=>s(g.path)})}),a.jsx("section",{className:"skill-file-preview",children:c?a.jsxs(a.Fragment,{children:[a.jsxs("header",{children:[a.jsx("span",{title:c.path,children:c.path}),a.jsxs("div",{children:[d?a.jsx("button",{type:"button",onClick:()=>l(g=>g==="preview"?"source":"preview"),children:t(o==="preview"?"fileTree.viewSource":"fileTree.viewPreview")}):null,a.jsx("button",{type:"button",disabled:c.content===void 0,onClick:()=>WVt(c),children:t("fileTree.download")})]})]}),a.jsx("div",{className:"skill-file-preview__body",children:c.kind==="binary"||c.content===void 0?a.jsxs("div",{className:"skill-file-preview__binary",children:[a.jsx("strong",{children:t("fileTree.binaryFile")}),a.jsx("span",{children:t("fileTree.bytes",{value:new Intl.NumberFormat(n.resolvedLanguage).format(c.size)})}),a.jsx("span",{children:t("fileTree.binaryDescription")})]}):f?a.jsx("img",{src:c.content.startsWith("data:")?c.content:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c.content)}`,alt:c.path}):d&&o==="preview"?a.jsxs("div",{className:"skill-file-preview__markdown",children:[h.frontmatter.length>0?a.jsx("dl",{className:"skill-file-preview__frontmatter","aria-label":t("fileTree.metadata"),children:h.frontmatter.map(g=>a.jsxs("div",{children:[a.jsx("dt",{children:g.key}),a.jsx("dd",{children:g.value})]},g.key))}):null,a.jsx(Yu,{text:h.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):a.jsx(dT,{value:c.content,path:c.path,readOnly:!0,onChange:()=>{}})})]}):a.jsx("div",{className:"skill-file-preview__binary",children:t("fileTree.noFiles")})})]})}const KVt=Object.freeze(Object.defineProperty({__proto__:null,SkillFileTree:jD},Symbol.toStringTag,{value:"Module"})),GVt=1200,XVt=3,c6e=2,YVt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,nse={concise:"generation.styles.concise",strict:"generation.styles.strict",tutorial:"generation.styles.tutorial",automation:"generation.styles.automation"};function ise(e,t){var n;return{id:`group-${Date.now()}-${e}`,model:((n=t.models[e%Math.max(1,t.models.length)])==null?void 0:n.id)||"",style:"concise",customStyle:""}}function ZVt(e){return e?e.state==="ready"?Jt("generation.stages.ready"):e.state==="failed"?Jt("generation.stages.failed"):e.state==="cancelled"?Jt("generation.stages.cancelled"):e.stage==="validating"?Jt("generation.stages.validating"):e.stage==="packaging"?Jt("generation.stages.packaging"):Jt("generation.stages.generating"):Jt("generation.stages.preparing")}function r4(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>YVt.test(n))}function rse(e){var n;const t=((n=e.validation)==null?void 0:n.errors.join(` `))||e.error||Jt("generation.validation.fallback");return[Jt("generation.validation.repairInstruction"),Jt("generation.validation.recheckInstruction"),t.slice(0,2e3)].join(` -`)}function YVt(e){var t;if(e.repairing||((t=e.task)==null?void 0:t.state)==="running"&&e.repairMode){if(e.repairMode==="manual")return Jt("generation.stages.repairingAgain");const n=Math.max(1,e.repairAttempts||1);return Jt("generation.stages.autoRepairing",{attempt:n,max:c6e})}return XVt(e.task)}function sse(){return a.jsxs("svg",{className:"skill-generation__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[a.jsx("circle",{cx:"10",cy:"10",r:"7"}),a.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function ZVt(e,t=Date.now()){if(!(e!=null&&e.expiresAt))return Jt("generation.sessionMax");const n=Math.max(0,new Date(e.expiresAt).getTime()-t),i=Math.floor(n/6e4),r=Math.floor(n%6e4/1e3);return Jt("generation.remaining",{minutes:i,seconds:String(r).padStart(2,"0")})}function JVt(e){return e?e.length>64?Jt("generation.validation.nameTooLong"):/^[a-z0-9-]+$/.test(e)?"":Jt("generation.validation.invalidName"):""}function ose(e){return e?e.length>128?Jt("generation.validation.modelTooLong"):/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":Jt("generation.validation.invalidModel"):""}function s4(e){return`${e.region||""}:${e.id}`}function eHt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function tHt({operation:e,cloudProvider:t,space:n,availableSpaces:i=[],spacesLoading:r=!1,initialIntent:s="",source:o,onBack:l,onPublished:c}){var Ce,ke,Ke,it;const{t:u}=Ae("skills"),[d,f]=p.useState(null),[h,m]=p.useState(null),[g,b]=p.useState(s),[v,y]=p.useState(""),[x,w]=p.useState([]),[O,S]=p.useState([]),[k,C]=p.useState(""),[E,R]=p.useState(!1),[_,j]=p.useState(""),[T,N]=p.useState(""),[A,P]=p.useState(null),[D,M]=p.useState(""),[L,U]=p.useState(""),[I,H]=p.useState(n?s4(n):""),[K,F]=p.useState(Date.now()),W=p.useRef([]);p.useEffect(()=>{const ue=new AbortController;return KP(ue.signal).then(xe=>{f(xe),w([ise(0,xe)])}).catch(xe=>{ue.signal.aborted||m(vr(xe,Jt("generation.errors.loadCapability")))}),()=>ue.abort()},[]),p.useEffect(()=>{W.current=O},[O]),p.useEffect(()=>{const ue=window.setInterval(()=>F(Date.now()),1e3);return()=>window.clearInterval(ue)},[]),p.useEffect(()=>{const ue=xe=>{W.current.some(Te=>{var qe;return((qe=Te.task)==null?void 0:qe.state)==="running"||Te.repairing})&&xe.preventDefault()};return window.addEventListener("beforeunload",ue),()=>{var xe;window.removeEventListener("beforeunload",ue);for(const Te of W.current)(xe=Te.task)!=null&&xe.jobId&&BPt(Te.task.jobId).catch(()=>{})}},[]),p.useEffect(()=>{if(!O.some(qe=>{var De;return((De=qe.task)==null?void 0:De.state)==="running"||qe.repairing}))return;let ue=!1,xe;const Te=async()=>{const qe=W.current,De=await Promise.all(qe.map(async At=>{var It;if(((It=At.task)==null?void 0:It.state)!=="running")return At;try{const lt=await LPt(At.task.jobId);if(r4(lt)&&(At.repairAttempts||0)dt.map(yt=>yt.id===At.id?{...yt,task:lt,repairing:!0,repairMode:"auto",repairAttempts:Ct,repairError:void 0}:yt));try{const dt=await Z5({jobId:lt.jobId,intent:rse(lt),expectedRevision:lt.revision});return{...At,task:dt,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ct,repairError:void 0,error:void 0,pollError:void 0}}catch(dt){return{...At,task:lt,repairing:!1,repairMode:void 0,repairAttempts:Ct,repairError:vr(dt,Jt("generation.errors.autoRepair")),pollError:void 0}}}let Ot=At.artifact;return lt.state==="ready"&&(Ot=await Y5(lt.jobId,lt.revision)),{...At,task:lt,artifact:Ot,repairing:!1,repairMode:lt.state==="running"?At.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(lt){return{...At,pollError:vr(lt,Jt("generation.errors.pollCandidate"))}}}));ue||(S(De),xe=window.setTimeout(()=>void Te(),WVt))};return Te(),()=>{ue=!0,xe!==void 0&&window.clearTimeout(xe)}},[O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"||ue.repairing})]);const V=O.find(ue=>ue.id===k)||O[0],X=e==="create"&&!n,ie=i.find(ue=>s4(ue)===I)??null,Q=n??ie,Z=i.map(ue=>({value:s4(ue),label:`${rc(ue)||u("generation.unnamedSpace")} · ${If(ue.region||"cn-beijing",t)}`})),ce=JVt(v),Ee=!!(d!=null&&d.enabled&&g.trim()&&!ce&&x.length>0&&x.every(ue=>ue.model.trim()&&!ose(ue.model.trim()))),Y=(ue,xe)=>{w(Te=>Te.map(qe=>qe.id===ue?{...qe,...xe}:qe))},G=async ue=>{const xe={...ue,model:ue.model.trim()},Te=ue.style==="custom"?ue.customStyle.trim():ue.style;try{const qe=await MPt({operation:e,intent:g.trim(),model:xe.model,style:Te,name:v.trim()||void 0,source:o});return{id:ue.id,config:xe,task:qe}}catch(qe){return{id:ue.id,config:xe,error:vr(qe,Jt("generation.errors.createCandidate"))}}},te=async()=>{if(!Ee)return;R(!0),P(null);const ue=x.map(Te=>({id:Te.id,config:Te}));S(ue),C(x[0].id);const xe=await Promise.all(x.map(G));S(xe)},ye=async ue=>{S(Te=>Te.map(qe=>qe.id===ue.id?{...qe,error:void 0}:qe));const xe=await G(ue.config);S(Te=>Te.map(qe=>qe.id===ue.id?xe:qe))},Ne=async()=>{if(!(!(V!=null&&V.task)||!_.trim()||V.task.state!=="ready")){N("refine"),P(null);try{const ue=await Z5({jobId:V.task.jobId,intent:_.trim(),expectedRevision:V.task.revision});S(xe=>xe.map(Te=>Te.id===V.id?{...Te,task:ue,artifact:void 0}:Te)),j("")}catch(ue){P(vr(ue,Jt("generation.errors.refine")))}finally{N("")}}},pe=async()=>{if(!(!(V!=null&&V.task)||!r4(V.task))){N("refine"),P(null),S(ue=>ue.map(xe=>xe.id===V.id?{...xe,repairing:!0,repairMode:"manual",repairError:void 0}:xe));try{const ue=await Z5({jobId:V.task.jobId,intent:rse(V.task),expectedRevision:V.task.revision});S(xe=>xe.map(Te=>Te.id===V.id?{...Te,task:ue,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:Te))}catch(ue){S(xe=>xe.map(Te=>Te.id===V.id?{...Te,repairing:!1,repairMode:void 0,repairError:vr(ue,Jt("generation.errors.repairAgain"))}:Te))}finally{N("")}}},me=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||L)){N("publish"),P(null);try{if(!Q)throw new Error(Jt("generation.errors.selectSpace"));const ue=V.artifact||await Y5(V.task.jobId,V.task.revision),xe=(o==null?void 0:o.region)||Q.region||"";if(!_I(xe))throw new Error(Jt("generation.errors.unsupportedRegion"));await FPt({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:ue.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[Q.id],projectName:(o==null?void 0:o.projectName)||Q.projectName,region:xe,onProgress:Te=>M(Te.message)}),U(V.id),c()}catch(ue){P(vr(ue,Jt("generation.errors.upload")))}finally{N(""),M("")}}},se=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){N("download");try{const ue=V.artifact||await Y5(V.task.jobId,V.task.revision);await UPt(V.task.jobId,V.task.revision,ue.sha256)}catch(ue){P(vr(ue,Jt("generation.errors.download")))}finally{N("")}}},Se=async()=>{O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"})&&!window.confirm(Jt("generation.leaveConfirmation"))||(await Promise.allSettled(O.flatMap(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"?[$Pt({jobId:ue.task.jobId,expectedRevision:ue.task.revision})]:[]})),l())},Le=e==="create"?u("generation.createTitle"):u("generation.optimizeTitle",{name:(o==null?void 0:o.name)||u("generation.skillFallback")}),be=ue=>{var xe;return((xe=d==null?void 0:d.models.find(Te=>Te.id===ue))==null?void 0:xe.label)||ue},Ve=ue=>ue.config.style==="custom"?ue.config.customStyle.trim()||u("generation.styles.customFallback"):u(nse[ue.config.style]),ve=[...Object.entries(nse).map(([ue,xe])=>({value:ue,label:u(xe)})),{value:"custom",label:u("generation.styles.custom")}],Re=ue=>ue.error||ue.repairError?u("generation.stages.failed"):YVt(ue),ne=ue=>!ue.error&&!ue.repairError&&(ue.repairing||!ue.task||ue.task.state==="running"),ge=O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="ready"});return a.jsxs("section",{className:"skill-generation",children:[a.jsxs("header",{className:"skill-generation__header",children:[a.jsx("button",{type:"button",className:"skillcenter-back",onClick:()=>void Se(),"aria-label":u("generation.back"),children:a.jsx(eHt,{})}),a.jsxs("div",{children:[a.jsx("h1",{children:Le}),a.jsx("p",{children:rc(n)||u("generation.home")})]}),O.length>0?a.jsx("span",{className:"skill-generation__ttl",children:ZVt(V==null?void 0:V.task,K)}):null]}),E?a.jsxs("div",{className:"skill-generation__workspace",children:[a.jsx("div",{className:"skill-generation__candidate-tabs",role:"tablist","aria-label":u("generation.candidates"),children:O.map(ue=>a.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===ue.id,className:(V==null?void 0:V.id)===ue.id?"is-active":"",onClick:()=>C(ue.id),children:[a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.style")}),a.jsx("strong",{children:Ve(ue)})]}),a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.model")}),a.jsx("strong",{children:be(ue.config.model)})]}),a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.progress")}),a.jsxs("strong",{children:[ne(ue)?a.jsx(sse,{}):null,Re(ue)]})]})]},ue.id))}),V?a.jsxs("div",{className:"skill-generation__candidate",children:[a.jsxs("section",{className:"skill-generation__activity",children:[a.jsx("header",{children:a.jsxs("div",{className:"skill-generation__candidate-summary",children:[a.jsxs("div",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.style")}),a.jsx("strong",{children:Ve(V)})]}),a.jsxs("div",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.model")}),a.jsx("strong",{children:be(V.config.model)})]}),a.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[a.jsx("span",{children:u("generation.progress")}),a.jsxs("strong",{children:[ne(V)?a.jsx(sse,{}):null,ne(V)?a.jsx(yn,{children:Re(V)}):Re(V)]})]})]})}),V.task?a.jsx(wLt,{activities:V.task.activities}):null,V.pollError?a.jsx("div",{className:"skill-inline-notice",children:a.jsx(ms,{error:V.pollError})}):null,V.repairError?a.jsx("div",{className:"skill-inline-notice",children:a.jsx(ms,{error:V.repairError})}):null,V.error?a.jsxs("div",{className:"skill-inline-error",children:[a.jsx(ms,{error:V.error}),a.jsx("button",{type:"button",onClick:()=>void ye(V),children:u("generation.retryCandidate")})]}):null,(Ce=V.task)!=null&&Ce.validation&&!V.task.validation.valid&&!V.repairing&&V.task.state==="failed"?a.jsxs("div",{className:"skill-validation-errors",children:[a.jsx("strong",{children:u("generation.formatValidationFailed")}),V.task.validation.errors.map(ue=>a.jsx("p",{children:ue},ue)),r4(V.task)?a.jsx("button",{type:"button",disabled:!!T,onClick:()=>void pe(),children:u("generation.repairAgain")}):null]}):null]}),a.jsxs("section",{className:"skill-generation__files",children:[a.jsxs("header",{children:[a.jsx("h2",{children:u("generation.files")}),((ke=V.task)==null?void 0:ke.state)==="ready"?a.jsx("button",{type:"button",onClick:()=>void se(),disabled:!!T,children:u("generation.downloadZip")}):null]}),V.artifact?a.jsx(jD,{files:V.artifact.files}):a.jsx("div",{className:"skill-generation__files-empty",children:((Ke=V.task)==null?void 0:Ke.state)==="ready"?u("generation.loadingFiles"):u("generation.filesPending")})]}),((it=V.task)==null?void 0:it.state)==="ready"?a.jsxs("div",{className:"skill-generation__ready-actions",children:[X?a.jsx("div",{className:"skill-generation__publish-target",children:a.jsx(Y_,{label:u("generation.uploadToSpace"),value:I,options:Z,onChange:H,disabled:r,placeholder:u(r?"generation.loadingSpaces":"generation.selectSpace")})}):null,a.jsxs("footer",{className:"skill-generation__followup",children:[a.jsx("textarea",{value:_,onChange:ue=>j(ue.target.value),placeholder:u("generation.continuePlaceholder")}),a.jsx("button",{type:"button",className:"skill-button",disabled:!_.trim()||!!T,onClick:()=>void Ne(),children:u("generation.continue")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!T||!!L||!Q,onClick:()=>void me(),children:T==="publish"?D||u("generation.uploading"):u(e==="optimize"?"generation.overwrite":X?"generation.uploadToSelectedSpace":"generation.uploadToCurrentSpace")})]})]}):null,A?a.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:a.jsx(ms,{error:A})}):null]}):null,!ge&&O.every(ue=>ue.error)?a.jsx("div",{className:"skill-inline-error",children:u("generation.allCandidatesFailed")}):null]}):a.jsxs("div",{className:"skill-generation__setup",children:[a.jsx("div",{className:"skill-generation__section-head is-basic",children:a.jsx("div",{children:a.jsx("strong",{children:u("generation.basicInfo")})})}),a.jsxs("label",{children:[a.jsxs("span",{children:[u("generation.goal"),a.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"})]}),a.jsx("textarea",{required:!0,value:g,onChange:ue=>b(ue.target.value),placeholder:u(e==="create"?"generation.createIntentPlaceholder":"generation.optimizeIntentPlaceholder")})]}),a.jsxs("label",{children:[a.jsx("span",{children:u("generation.skillName")}),a.jsx("input",{value:v,onChange:ue=>y(ue.target.value),placeholder:u("generation.autoNamePlaceholder"),"aria-invalid":!!ce,"aria-describedby":"skill-name-help"}),ce?a.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:ce}):a.jsx("span",{id:"skill-name-help",className:"skill-generation__field-help",children:u("generation.nameHelp")})]}),a.jsx("div",{className:"skill-generation__section-head",children:a.jsxs("div",{children:[a.jsx("strong",{children:u(e==="create"?"generation.createPlans":"generation.optimizePlans")}),a.jsx("span",{children:u(e==="create"?"generation.createPlansDescription":"generation.optimizePlansDescription")})]})}),a.jsxs("div",{className:"skill-generation__groups",children:[x.map((ue,xe)=>a.jsxs("article",{className:"skill-generation__group",children:[a.jsxs("header",{children:[a.jsx("strong",{children:u("generation.plan",{count:xe+1})}),x.length>1?a.jsx("button",{type:"button",onClick:()=>w(Te=>Te.filter(qe=>qe.id!==ue.id)),children:u("generation.remove")}):null]}),a.jsx(Y_,{label:u("generation.model"),required:!0,value:ue.model,options:(d==null?void 0:d.models.map(Te=>({value:Te.id,label:Te.label})))||[],onChange:Te=>Y(ue.id,{model:Te}),allowCustom:!0,placeholder:u("generation.modelPlaceholder"),error:ose(ue.model.trim())}),a.jsx(Y_,{label:u("generation.style"),required:!0,value:ue.style,options:ve,onChange:Te=>Y(ue.id,{style:Te})}),ue.style==="custom"?a.jsxs("label",{children:[a.jsx("span",{children:u("generation.customStyle")}),a.jsx("textarea",{value:ue.customStyle,onChange:Te=>Y(ue.id,{customStyle:Te.target.value}),placeholder:u("generation.customStylePlaceholder")})]}):null]},ue.id)),d&&x.lengthw(ue=>[...ue,ise(ue.length,d)]),children:u("generation.addConfiguration")}):null]}),h?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:h})}):null,d&&!d.enabled?a.jsx("div",{className:"skill-inline-notice",children:u("generation.notConfigured")}):null,a.jsx("div",{className:"skill-generation__setup-actions",children:a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!Ee,onClick:()=>void te(),children:u("generation.generate")})})]})]})}async function u6e(e,t,n,i){const r=new URLSearchParams({region:e.region}),s=await fetch(Zo(`/web/skill-management/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/versions?${r}`),{...t,headers:Pl(uu(t.headers)),signal:Ua(e.signal,i)});if(!s.ok)throw await qP(s,n);return s.json()}function nHt(e){return u6e(e,{},z("skills.listVersionsFailed"),Ba)}function iHt(e){return u6e(e,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},z("skills.uploadVersionFailed"),xr)}function d6e(e){const t=new Map;for(const n of e){const i=`${n.sourceSkillId}:${n.version}`,r=t.get(i);(!r||n.submittedAt>r.submittedAt)&&t.set(i,n)}return t}function rHt(e,t,n,i){const r=i.trim().toLocaleLowerCase();return e.filter(s=>s.kind===t&&(n==="all"||s.status===n)&&`${s.name} ${s.description} ${s.author} ${s.version}`.toLocaleLowerCase().includes(r))}const f6e=p.createContext(void 0);function o0(e){const t=p.useContext(f6e);if(!e&&t===void 0)throw new Error(du(27));return t}const ND=p.forwardRef(function(t,n){const{render:i,className:r,style:s,forceRender:o=!1,...l}=t,c=o0(),u=c.useState("open"),d=c.useState("nested"),f=c.useState("mounted"),h=c.useState("transitionStatus");return Do("div",t,{state:{open:u,transitionStatus:h},ref:[c.context.backdropRef,n],stateAttributesMapping:dAe,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:o||!d})}),MH=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:o=!1,nativeButton:l=!0,...c}=t,u=o0(),d=u.useState("open"),{getButtonProps:f,buttonRef:h}=QU({disabled:o,native:l}),m={disabled:o};function g(b){d&&u.setOpen(!1,Gs(wTe,b.nativeEvent))}return Do("button",t,{state:m,ref:[n,h],props:[{onClick:g},c,f]})}),RD=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,...l}=t,c=o0(),u=hg(o);return c.useSyncedValueWithCleanup("descriptionElementId",u),Do("p",t,{ref:n,props:[{id:u},l]})}),h6e=p.createContext(void 0);function sHt(){const e=p.useContext(h6e);if(e===void 0)throw new Error(du(26));return e}const oHt={...GU,...KI,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},ID=p.forwardRef(function(t,n){const{render:i,className:r,style:s,finalFocus:o,initialFocus:l,...c}=t,u=o0(),d=u.useState("descriptionElementId"),f=u.useState("disablePointerDismissal"),h=u.useState("floatingRootContext"),m=u.useState("popupProps"),g=u.useState("modal"),b=u.useState("mounted"),v=u.useState("nested"),y=u.useState("nestedOpenDialogCount"),x=u.useState("open"),w=u.useState("openMethod"),O=u.useState("titleElementId"),S=u.useState("transitionStatus"),k=u.useState("role"),C=h.useState("floatingId");sHt(),mC({open:x,ref:u.context.popupRef,onComplete(){var N,A;x&&((A=(N=u.context).onOpenChangeComplete)==null||A.call(N,!0))}});const E=l===void 0?XTe(u.context.popupRef):l,R=y>0,_=u.useStateSetter("popupElement"),T=Do("div",t,{state:{open:x,nested:v,transitionStatus:S,nestedDialogOpen:R},props:[m,{id:C,"aria-labelledby":O,"aria-describedby":d,role:k,...GTe,hidden:!b,onKeyDown(N){iMe.has(N.key)&&N.stopPropagation()},style:{"--nested-dialogs":y}},c],ref:[n,u.context.popupRef,_],stateAttributesMapping:oHt});return a.jsx(ITe,{context:h,openInteractionType:w,disabled:!b,closeOnFocusOut:!f,initialFocus:E,returnFocus:o,modal:g!==!1,restoreFocus:"popup",children:T})}),PD=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t,s=o0(),o=s.useState("mounted"),l=s.useState("modal"),c=s.useState("open");return o||i?a.jsx(h6e.Provider,{value:i,children:a.jsxs(TTe,{ref:n,...r,children:[o&&l===!0&&a.jsx(tMe,{ref:s.context.internalBackdropRef,inert:BU(!c)}),t.children]})}):null});function aHt({store:e,parentContext:t,isDrawer:n}){const i=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),o=e.useState("popupElement"),l=e.useState("floatingRootContext"),[c,u]=p.useState(0),[d,f]=p.useState(0),h=c===0,m=PTe(l,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const b=Yo(g);if(h&&!r){if(s){const v=e.context.internalBackdropRef.current,y=e.context.backdropRef.current;return v||y?v===b||y===b||zn(b,o)&&!(b!=null&&b.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:h});return nMe(i&&s===!0,o),e.useContextCallback("onNestedDialogOpen",(g,b)=>{u(g),f(b)}),Un(()=>(t!=null&&t.onNestedDialogOpen&&(i?t.onNestedDialogOpen(c+1,d+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&i&&t.onNestedDialogOpen(0,0)}),[n,i,c,d,t]),nAe(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:d}),null}const lHt={...aAe,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class cHt extends BI{constructor(n,i,r){const s=new qU,o=uHt(n,s,i,r);super(o,dHt(s),lHt);rn(this,"setOpen",(n,i)=>{var s,o;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(o=(s=this.context).onOpenChange)==null||o.call(s,n,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,i);const r={open:n};JTe(r,n,i.trigger),this.update(r)})}}function uHt(e,t,n,i=!1){const r={...rAe(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return r.floatingRootContext=sAe(t,n,i),r}function dHt(e){return{popupRef:p.createRef(),backdropRef:p.createRef(),internalBackdropRef:p.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function fHt(e,t){const{children:n,open:i,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:l=!1,modal:c=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:h=null}=t,m=e==="drawer",g=c,b=l,v="dialog",y=o0(!0),x=y!=null,w={modal:g,disablePointerDismissal:b,nested:x,role:v},O=YTe((_,j)=>new cHt({open:r,openProp:i,activeTriggerId:h,triggerIdProp:f,...w},_,j),!0);O.useControlledProp("openProp",i),O.useControlledProp("triggerIdProp",f),O.useSyncedValues(w),O.useContextCallback("onOpenChange",s),O.useContextCallback("onOpenChangeComplete",o);const S=O.useState("open"),k=O.useState("mounted"),C=O.useState("payload");iAe(O,S),eAe(O);const{forceUnmount:E}=tAe(S,O);p.useImperativeHandle(u,()=>({unmount:E,close:()=>O.setOpen(!1,Gs(kTe))}),[E,O]);const R=S||k;return a.jsxs(f6e.Provider,{value:O,children:[d&&a.jsx(ZTe,{handle:d,store:O}),R&&a.jsx(aHt,{store:O,parentContext:y==null?void 0:y.context,isDrawer:m}),typeof n=="function"?n({payload:C}):n]})}function DD(e){return fHt("dialog",e)}const MD=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,...l}=t,c=o0(),u=hg(o);return c.useSyncedValueWithCleanup("titleElementId",u),Do("h2",t,{ref:n,props:[{id:u},l]})});async function p6e(e,t){const n=new URLSearchParams({region:e.region}),i=t?"/retry":`?${n}`,r=await fetch(Zo(`/web/skill-management/reviews/${encodeURIComponent(e.id)}/score${i}`),{method:t?"POST":"GET",headers:Pl(uu(t?{"Content-Type":"application/json"}:void 0)),...t?{body:JSON.stringify({region:e.region})}:{},signal:Ua(e.signal,Ba)});if(!r.ok)throw await qP(r,mn.t(t?"score.retryFailed":"score.loadFailed",{ns:"reviews"}));return r.json()}const hHt=e=>p6e(e,!1),pHt=e=>p6e(e,!0),mHt=["safety","usability","completeness","reliability","maintainability"];function m6e(e){return(e==null?void 0:e.status)==="queued"||(e==null?void 0:e.status)==="running"}function gHt(e){if(e.status!=="not_requested")return{status:e.status,overallScore:e.overallScore,scoredAt:e.scoredAt,modelName:e.modelName,rubricVersion:e.rubricVersion,error:e.error}}function LH({score:e}){const{t}=Ae("reviews");return a.jsx("span",{className:`review-score-label is-${(e==null?void 0:e.status)||"unscored"}`,children:(e==null?void 0:e.status)==="completed"?typeof e.overallScore=="number"?t("score.points",{score:e.overallScore}):t("score.insufficient"):t(`score.status.${(e==null?void 0:e.status)||"unscored"}`)})}function g6e({application:e,canRetry:t=!1,onScoreChanged:n}){const{t:i,i18n:r}=Ae("reviews"),[s,o]=p.useState(e.aiReview),[l,c]=p.useState(!!e.aiReview),[u,d]=p.useState(null),[f,h]=p.useState({revision:0,retry:!1}),[m,g]=p.useState(""),b=p.useRef(-1),v=p.useRef(n);v.current=n;const{id:y,region:x}=e,w=!!e.aiReview;p.useEffect(()=>{if(!w&&f.revision===0)return;const k=new AbortController;let C,E=!1,R=!0;const _=async(N,A=!1)=>{var P;if(!(E||k.signal.aborted)&&!(!A&&document.visibilityState==="hidden")){E=!0,A&&c(!0),d(null);try{const D=await(N?pHt:hHt)({id:y,region:x,signal:k.signal});if(k.signal.aborted)return;o(D),(P=v.current)==null||P.call(v,D,N),R=m6e(D),R&&document.visibilityState!=="hidden"&&(C=setTimeout(()=>void _(!1),5e3))}catch(D){k.signal.aborted||(R=!1,d(vr(D,i(N?"score.retryFailed":"score.loadFailed"))))}finally{E=!1,k.signal.aborted||c(!1)}}},j=()=>{clearTimeout(C),R&&document.visibilityState!=="hidden"&&_(!1)},T=f.retry&&b.current!==f.revision;return T&&(b.current=f.revision),_(T,!0),document.addEventListener("visibilitychange",j),()=>{k.abort(),clearTimeout(C),document.removeEventListener("visibilitychange",j)}},[y,x,w,f,i]);const O=(s==null?void 0:s.status)==="completed"?s.result:void 0;p.useEffect(()=>{if(!O){g("");return}const k=URL.createObjectURL(new Blob([JSON.stringify(O,null,2)],{type:"application/json"}));return g(k),()=>URL.revokeObjectURL(k)},[O]);const S=k=>h(C=>({revision:C.revision+1,retry:k}));return a.jsxs("section",{className:"review-score","aria-label":i("score.title"),children:[a.jsxs("div",{className:"review-score__header",children:[a.jsx("div",{"aria-live":"polite",children:l?a.jsx(yn,{children:i(f.retry?"score.starting":"score.loading")}):a.jsx(LH,{score:s})}),a.jsxs("div",{className:"review-score__actions",children:[m?a.jsx("a",{className:"cw-btn cw-btn-ghost",href:m,download:`${y}-score.json`,children:i("score.download")}):null,t&&(!s||s.status==="failed"||s.status==="not_requested")?a.jsx("button",{type:"button",className:"cw-btn cw-btn-ghost",disabled:l,onClick:()=>S(!0),children:i((s==null?void 0:s.status)==="failed"?"score.retry":"score.start")}):null]})]}),a.jsx("p",{className:"review-score__hint",children:i("score.hint")}),u?a.jsxs("div",{className:"review-score__error",role:"alert",children:[a.jsx(ms,{error:u}),a.jsx("button",{type:"button",className:"cw-btn cw-btn-ghost",disabled:l,onClick:()=>S(!1),children:i("score.reload")})]}):null,s!=null&&s.error?a.jsx("div",{role:"alert",className:"review-score__error",children:a.jsxs("details",{className:"review-score__raw-error",open:!0,children:[a.jsx("summary",{children:i("score.originalError")}),a.jsx("pre",{children:s.error})]})}):(s==null?void 0:s.status)==="failed"?a.jsx("p",{role:"alert",className:"review-score__error",children:i("score.failed")}):null,O?a.jsxs(a.Fragment,{children:[O.riskFlags.length?a.jsxs("div",{className:"review-score__risks",children:[a.jsx("h3",{children:i("score.risks")}),a.jsx("ul",{children:O.riskFlags.map((k,C)=>a.jsxs("li",{children:[a.jsx("strong",{children:i(`score.severity.${k.severity}`)})," · ",k.reason]},`${C}:${k.reason}`))})]}):null,O.coverage&&!O.coverage.complete?a.jsxs("div",{className:"review-score__coverage",children:[a.jsx("h3",{children:i("score.coverage")}),a.jsx("p",{children:i("score.coverageIncomplete")}),a.jsx("p",{children:i("score.coverageCount",{included:O.coverage.includedFiles,total:O.coverage.totalFiles})}),a.jsxs("ul",{children:[O.coverage.omittedFiles.map(k=>a.jsx("li",{children:i("score.omittedFile",k)},`omitted:${k.path}`)),O.coverage.truncatedFiles.map(k=>a.jsx("li",{children:i("score.truncatedFile",k)},`truncated:${k.path}`))]})]}):null,a.jsx("dl",{className:"review-score__dimensions",children:mHt.map(k=>{const C=O.dimensions[k];return a.jsxs("div",{className:k==="safety"&&C.score!==null&&C.score<60?"is-risk":void 0,children:[a.jsxs("dt",{children:[a.jsx("span",{children:i(`score.dimensions.${k}`)}),a.jsx("strong",{children:C.score===null?i("score.insufficient"):i("score.points",{score:C.score})})]}),a.jsx("dd",{children:C.reason})]},k)})}),O.suggestions.length?a.jsxs("div",{className:"review-score__suggestions",children:[a.jsx("h3",{children:i("score.suggestions")}),a.jsx("ul",{children:O.suggestions.map((k,C)=>a.jsx("li",{children:k},`${C}:${k}`))})]}):null,a.jsxs("dl",{className:"review-score__metadata",children:[a.jsxs("div",{children:[a.jsx("dt",{children:i("score.model")}),a.jsx("dd",{children:O.modelName})]}),a.jsxs("div",{children:[a.jsx("dt",{children:i("score.rubric")}),a.jsx("dd",{children:O.rubricVersion})]}),a.jsxs("div",{children:[a.jsx("dt",{children:i("score.time")}),a.jsx("dd",{children:a.jsx("time",{dateTime:O.scoredAt,children:new Date(O.scoredAt).toLocaleString(r.language,{hour12:!1})})})]})]})]}):null]})}function bHt({application:e}){const{t}=Ae("reviews"),[n,i]=p.useState(!1),[r,s]=p.useState(e.aiReview),o=p.useId();return p.useEffect(()=>s(e.aiReview),[e.aiReview]),a.jsxs("div",{className:"review-score-history",children:[a.jsxs("button",{type:"button",className:"review-score-history__toggle","aria-expanded":n,"aria-controls":o,onClick:()=>i(l=>!l),children:[a.jsx("span",{children:t("score.title")}),a.jsx(LH,{score:r}),a.jsx("span",{children:t(n?"score.collapse":"score.expand")})]}),n?a.jsx("div",{id:o,children:a.jsx(g6e,{application:e,onScoreChanged:s},`${e.region}:${e.id}`)}):null]})}function fT({status:e}){const{t}=Ae("reviews");return a.jsxs("span",{className:`review-status is-${e}`,children:[a.jsx("span",{"aria-hidden":"true"}),t(`status.${e}`)]})}function $H({person:e,fallback:t,compact:n=!1}){const{t:i}=Ae("reviews"),[r,s]=p.useState(""),o=(e==null?void 0:e.name)||t||i("detail.unknownReviewer"),l=e==null?void 0:e.avatarUrl;return a.jsxs("span",{className:`review-person${n?" is-compact":""}`,children:[l&&l!==r?a.jsx("img",{className:"review-person__avatar",src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>s(l)}):a.jsx("span",{className:"review-person__avatar is-fallback","aria-hidden":"true",children:Array.from(o)[0]}),a.jsxs("span",{className:"review-person__text",children:[a.jsx("span",{children:o}),!n&&(e!=null&&e.email)?a.jsx("span",{className:"review-person__email",children:e.email}):null]})]})}function FH({application:e}){const{t,i18n:n}=Ae("reviews");return a.jsxs("div",{className:"review-outcome",children:[a.jsx(fT,{status:e.status}),e.reviewer||e.reviewedBy||e.reviewedAt?a.jsxs("dl",{className:"review-outcome__facts",children:[e.reviewer||e.reviewedBy?a.jsxs("div",{children:[a.jsx("dt",{children:t(`detail.${e.status==="returned"?"returnedBy":e.status==="approved"?"approvedBy":"reviewer"}`)}),a.jsx("dd",{children:a.jsx($H,{person:e.reviewer,fallback:e.reviewedBy})})]}):null,e.reviewedAt?a.jsxs("div",{children:[a.jsx("dt",{children:t("detail.reviewedAt")}),a.jsx("dd",{children:a.jsx("time",{dateTime:e.reviewedAt,children:new Date(e.reviewedAt).toLocaleString(n.language,{hour12:!1})})})]}):null]}):null,e.reason?a.jsxs("div",{className:"review-outcome__message is-returned",children:[a.jsx("strong",{children:t("decision.reason")}),a.jsx("p",{children:e.reason})]}):null,e.comment?a.jsxs("div",{className:"review-outcome__message",children:[a.jsx("strong",{children:t("detail.comment")}),a.jsx("p",{children:e.comment})]}):null,e.status==="pending"?a.jsx("p",{className:"review-outcome__hint",children:t("detail.pendingHint")}):null,e.status==="approving"?a.jsx("p",{className:"review-outcome__hint",children:t("detail.approvingHint")}):null]})}function BH({applications:e}){const{t,i18n:n}=Ae("reviews");return e.length?a.jsx("ol",{className:"review-source-history",children:[...e].sort((i,r)=>r.submittedAt.localeCompare(i.submittedAt)).map(i=>a.jsxs("li",{children:[a.jsxs("div",{className:"review-source-history__submission",children:[a.jsx("strong",{children:i.version}),a.jsx("span",{children:t("detail.submitted",{name:i.author})}),a.jsx("time",{dateTime:i.submittedAt,children:new Date(i.submittedAt).toLocaleString(n.language,{hour12:!1})})]}),a.jsx(FH,{application:i}),a.jsx(bHt,{application:i})]},i.id))}):a.jsx("p",{className:"review-outcome__hint",children:t("detail.noHistory")})}function yHt({name:e,applications:t,onClose:n}){const{t:i}=Ae("reviews"),r=p.useRef(document.activeElement instanceof HTMLElement?document.activeElement:null);return a.jsx(DD,{open:!0,onOpenChange:s=>{s||n()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"review-backdrop"}),a.jsxs(ID,{className:"review-drawer",finalFocus:()=>{var s;return(s=r.current)!=null&&s.isConnected?r.current:null},children:[a.jsxs("header",{className:"review-drawer__header",children:[a.jsxs("div",{children:[a.jsx(MD,{children:i("detail.history")}),a.jsx(RD,{children:e})]}),a.jsx(MH,{className:"review-icon-button","aria-label":i("actions.close"),children:a.jsx(tD,{})})]}),a.jsx("div",{className:"review-drawer__body",children:a.jsx(BH,{applications:t})})]})]})})}function vHt({skill:e,space:t,region:n,reviews:i,onClose:r,onChanged:s,onSubmitReview:o}){const{t:l,i18n:c}=Ae("ui"),[u,d]=p.useState(null),[f,h]=p.useState(e.version),[m,g]=p.useState(!0),[b,v]=p.useState(null),[y,x]=p.useState(null),[w,O]=p.useState([]),[S,k]=p.useState(!1),[C,E]=p.useState(null),[R,_]=p.useState(0),[j,T]=p.useState(0),[N,A]=p.useState(null),P=p.useRef(null),D=p.useRef(null),M=p.useRef(null),L=p.useRef(!1),U=p.useRef(!0),I=p.useRef({onClose:r,busy:N});I.current={onClose:r,busy:N};const H=u==null?void 0:u.items.find(Z=>Z.version===f),K=p.useMemo(()=>d6e(i),[i]),F=K.get(`${e.skillId}:${f}`),W=i.filter(Z=>Z.sourceSkillId===e.skillId&&Z.version===f&&Z.id!==(F==null?void 0:F.id)),V=!!(o&&(u!=null&&u.canUpdate)&&H&&["running","ready"].includes(H.status.toLowerCase())&&(!F||F.status==="returned"));p.useEffect(()=>{var Ee;U.current=!0;const Z=document.activeElement instanceof HTMLElement?document.activeElement:null;(Ee=M.current)==null||Ee.focus();const ce=Y=>{var Ne;if(Y.key==="Escape"&&(Y.preventDefault(),I.current.busy||I.current.onClose()),Y.key!=="Tab")return;const G=Array.from(((Ne=P.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]):not([type="file"]), a[href], summary, [tabindex="0"]'))||[]),te=G[0],ye=G[G.length-1];Y.shiftKey&&document.activeElement===te&&(Y.preventDefault(),ye==null||ye.focus()),!Y.shiftKey&&document.activeElement===ye&&(Y.preventDefault(),te==null||te.focus())};return document.addEventListener("keydown",ce),()=>{U.current=!1,document.removeEventListener("keydown",ce),Z!=null&&Z.isConnected&&Z.focus()}},[]),p.useEffect(()=>{const Z=new AbortController;return g(!0),v(null),nHt({spaceId:t.id,skillId:e.skillId,region:n,signal:Z.signal}).then(ce=>{Z.signal.aborted||(d(ce),h(Ee=>{var Y;return ce.items.some(G=>G.version===Ee)?Ee:((Y=ce.items[0])==null?void 0:Y.version)||""}))}).catch(ce=>{Z.signal.aborted||v(vr(ce,l("skillCenter.versions.loadFailed")))}).finally(()=>{Z.signal.aborted||g(!1)}),()=>Z.abort()},[t.id,e.skillId,n,R,l]),p.useEffect(()=>{if(!f||!H)return;let Z=!0;return k(!0),E(null),O([]),GDe({spaceId:t.id,skillId:e.skillId,region:n,version:f}).then(ce=>{Z&&O(ce)}).catch(ce=>{Z&&E(vr(ce,l("skillCenter.versions.filesFailed")))}).finally(()=>{Z&&k(!1)}),()=>{Z=!1}},[t.id,e.skillId,n,f,!!H,j,l]);async function X(Z){if(!L.current){L.current=!0,A("upload"),x(null);try{const ce=await iHt({spaceId:t.id,skillId:e.skillId,region:n,file:Z});if(!U.current)return;h(ce.version),_(Ee=>Ee+1),s()}catch(ce){U.current&&x(vr(ce,l("skillCenter.versions.uploadFailed")))}finally{L.current=!1,U.current&&A(null)}}}async function ie(){if(!(!V||!o||L.current)){L.current=!0,A("submit"),x(null);try{await o(f)}catch(Z){U.current&&x(vr(Z,l("skillCenter.versions.submitFailed")))}finally{L.current=!1,U.current&&A(null)}}}function Q(Z){if(!Z)return"—";const ce=new Date(Z);return Number.isNaN(ce.getTime())?Z:ce.toLocaleString(c.resolvedLanguage||c.language)}return a.jsx("div",{className:"skill-detail-backdrop",onMouseDown:Z=>{Z.target===Z.currentTarget&&!N&&r()},children:a.jsxs("section",{className:"skill-detail-dialog skill-versions",role:"dialog","aria-modal":"true","aria-labelledby":"skill-versions-title",ref:P,children:[a.jsxs("header",{className:"skill-detail-head",children:[a.jsx("div",{className:"skill-detail-heading",children:a.jsxs("div",{children:[a.jsx("h2",{id:"skill-versions-title",children:l("skillCenter.versions.title")}),a.jsx("p",{title:e.skillName,children:e.skillName})]})}),a.jsxs("div",{className:"skill-detail-actions",children:[a.jsx("button",{type:"button",disabled:m||!!N,onClick:()=>_(Z=>Z+1),children:l("skillCenter.versions.refresh")}),u!=null&&u.canUpdate?a.jsx("button",{type:"button",disabled:!!N,onClick:()=>{var Z;return(Z=D.current)==null?void 0:Z.click()},children:l(N==="upload"?"skillCenter.versions.uploading":"skillCenter.versions.upload")}):null,a.jsx("button",{type:"button",ref:M,disabled:!!N,onClick:r,children:l("skillCenter.versions.close")})]}),a.jsx("input",{className:"skill-versions__file-input",ref:D,type:"file",accept:".zip,application/zip","aria-label":l("skillCenter.versions.upload"),onChange:Z=>{var Ee;const ce=(Ee=Z.target.files)==null?void 0:Ee[0];Z.target.value="",ce&&X(ce)}})]}),y?a.jsx("div",{className:"skill-versions__notice",role:"alert",children:a.jsx(ms,{error:y})}):null,u!=null&&u.canUpdate?a.jsx("p",{className:"skill-versions__hint",children:l("skillCenter.versions.hint")}):null,a.jsxs("div",{className:"skill-versions__body",children:[a.jsxs("div",{className:"skill-versions__history","aria-busy":m,children:[m&&!u?a.jsx("p",{role:"status",children:l("skillCenter.versions.loading")}):null,b?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:b}),a.jsx("button",{className:"cw-btn cw-btn-ghost",type:"button",onClick:()=>_(Z=>Z+1),children:l("skillCenter.versions.retry")})]}):null,!m&&!b&&!(u!=null&&u.items.length)?a.jsx("p",{children:l("skillCenter.versions.empty")}):null,a.jsx("div",{className:"skill-versions__list",role:"list","aria-label":l("skillCenter.versions.title"),children:u==null?void 0:u.items.map(Z=>a.jsx("div",{role:"listitem",children:a.jsxs("button",{type:"button",className:`skill-versions__version${f===Z.version?" is-active":""}`,"aria-pressed":f===Z.version,onClick:()=>h(Z.version),children:[a.jsxs("span",{className:"skill-versions__version-title",children:[a.jsx("strong",{children:Z.sourceVersion||Z.version}),Z.isCurrent?a.jsx("span",{children:l("skillCenter.versions.current")}):null]}),a.jsx("time",{dateTime:Z.createdAt,children:Q(Z.createdAt)}),K.get(`${e.skillId}:${Z.version}`)?a.jsx(fT,{status:K.get(`${e.skillId}:${Z.version}`).status}):a.jsx("span",{children:l(t.isShared?"skillCenter.versions.shared":"skillCenter.versions.notSubmitted")})]})},Z.version))})]}),a.jsx("div",{className:"skill-versions__detail",children:H?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"skill-versions__summary",children:[a.jsxs("div",{children:[a.jsx("h3",{children:H.sourceVersion||H.version}),a.jsx("p",{title:H.description,children:H.description}),H.author||e.author?a.jsx("p",{className:"skill-versions__author",children:l("skillCenter.authorName",{name:H.author||e.author})}):null]}),o&&(u!=null&&u.canUpdate)?a.jsx("button",{type:"button",className:"cw-btn cw-btn-primary",disabled:!V||!!N,onClick:()=>void ie(),children:l(N==="submit"?"skillCenter.versions.submitting":"skillCenter.versions.submit")}):null]}),H.error?a.jsx("p",{className:"skill-versions__notice",role:"alert",children:H.error}):null,["running","ready"].includes(H.status.toLowerCase())?null:a.jsx("p",{role:"status",children:l("skillCenter.versions.processing",{status:H.status})}),F?a.jsx(FH,{application:F}):null,W.length?a.jsxs("details",{className:"skill-versions__review-history",children:[a.jsx("summary",{children:l("skillCenter.versions.history")}),a.jsx(BH,{applications:W})]}):null,a.jsx("div",{className:"skill-versions__files",children:S?a.jsx("p",{role:"status",children:l("skillCenter.versions.filesLoading")}):C?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:C}),a.jsx("button",{className:"cw-btn cw-btn-ghost",type:"button",onClick:()=>T(Z=>Z+1),children:l("skillCenter.versions.retry")})]}):w.length?a.jsx(jD,{files:w},f):a.jsx("p",{children:l("skillCenter.versions.filesEmpty")})})]}):null})]})]})})}function xHt({region:e,active:t,revision:n,onOpen:i}){const{t:r}=Ae("ui"),[s,o]=p.useState(null),[l,c]=p.useState(null),[u,d]=p.useState(0);return p.useEffect(()=>{if(!t)return;const f=new AbortController;return c(null),gPt({region:e,signal:f.signal}).then(h=>{f.signal.aborted||o(h)}).catch(h=>{f.signal.aborted||c(vr(h,r("skillCenter.sharedLoadFailed")))}),()=>f.abort()},[t,e,u,n,r]),a.jsxs("div",{className:"skillcenter-shared-space",children:[a.jsx(Jy,{className:"skillcenter-space-card",title:r("skillCenter.sharedSpace"),description:r("skillCenter.sharedDescription"),status:a.jsx("span",{className:"skillcenter-shared-badge",children:r("skillCenter.sharedVisibility")}),metadata:[{label:r("skillCenter.skillCount"),value:s?r("skillCenter.skillCountValue",{count:s.skillCount??0}):r(l?"skillCenter.sharedLoadFailed":"skillCenter.sharedPreparing")}],detailAction:{label:r("common.viewDetails"),disabled:!s||!!l,onClick:()=>{s&&i(s)}},action:l?{label:r("common.reload"),onClick:()=>d(f=>f+1)}:void 0}),l?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:l})}):null]})}function UH({title:e,children:t,onClose:n,className:i=""}){const{t:r}=Ae("skills"),s=p.useRef(null);return p.useEffect(()=>{var l;(l=s.current)==null||l.focus();const o=c=>c.key==="Escape"&&n();return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),a.jsx("div",{className:"skill-dialog-backdrop",onMouseDown:n,children:a.jsxs("section",{className:`skill-dialog${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-label":e,onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("header",{children:[a.jsx("h2",{children:e}),a.jsx("button",{ref:s,type:"button",onClick:n,"aria-label":r("management.close"),children:r("management.close")})]}),t]})})}function wHt({region:e,regionOptions:t,onClose:n,onCreated:i}){const{t:r}=Ae("skills"),[s,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(e),[f,h]=p.useState(!1),[m,g]=p.useState(null),b=async()=>{if(s.trim()){h(!0),g(null);try{const v=await mPt({name:s.trim(),description:l.trim()||void 0,region:u});i({...v,region:v.region||u})}catch(v){g(vr(v,r("management.createSpaceFailed")))}finally{h(!1)}}};return a.jsxs(UH,{title:r("management.createSpaceTitle"),onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("management.name")}),a.jsx("input",{autoFocus:!0,value:s,maxLength:128,onChange:v=>o(v.target.value)})]}),a.jsx(Y_,{label:r("management.region"),value:u,options:t,onChange:d,required:!0}),a.jsxs("label",{children:[a.jsx("span",{children:r("management.optionalDescription")}),a.jsx("textarea",{value:l,maxLength:1024,onChange:v=>c(v.target.value)})]}),m?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:m})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!s.trim()||f,onClick:()=>void b(),children:r(f?"management.creating":"management.create")})]})]})}function OHt({space:e,region:t,onClose:n,onUpdated:i}){const{t:r}=Ae("skills"),[s,o]=p.useState(e.name),[l,c]=p.useState(e.description||""),[u,d]=p.useState(!1),[f,h]=p.useState(null),m=async()=>{if(s.trim()){d(!0),h(null);try{const g=await OPt({spaceId:e.id,name:s.trim(),description:l.trim()||void 0,region:t});i({...e,...g,skillCount:e.skillCount})}catch(g){h(vr(g,r("management.updateSpaceFailed")))}finally{d(!1)}}};return a.jsxs(UH,{title:r("management.editSpaceTitle"),onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("management.name")}),a.jsx("input",{autoFocus:!0,value:s,maxLength:128,onChange:g=>o(g.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("management.optionalDescription")}),a.jsx("textarea",{value:l,maxLength:1024,onChange:g=>c(g.target.value)})]}),f?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:f})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!s.trim()||u,onClick:()=>void m(),children:r(u?"management.saving":"management.save")})]})]})}function kHt({space:e,region:t,onClose:n,onUploaded:i}){const{t:r,i18n:s}=Ae("skills"),[o,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,b]=p.useState(null),[v,y]=p.useState(!1),x=p.useRef(0),w=p.useRef(null),O=async k=>{const C=x.current+1;if(x.current=C,l(k),u(null),b(null),f(!!k),!!k)try{const E=await EPt(k);x.current===C&&u({name:E.name,fileCount:E.files.length})}catch(E){x.current===C&&b(vr(E,r("management.archiveValidationFailed")))}finally{x.current===C&&f(!1)}},S=async()=>{if(!(!o||!c)){m(!0),b(null);try{await SPt({spaceId:e.id,region:t,project:e.projectName,file:o}),i()}catch(k){b(vr(k,r("management.uploadFailed")))}finally{m(!1)}}};return a.jsxs(UH,{title:r("management.uploadTitle",{name:rc(e)}),className:"skill-upload-dialog",onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsx("input",{ref:w,className:"skill-upload-dialog__input",type:"file",accept:".zip,application/zip",onChange:k=>{var C;return void O(((C=k.target.files)==null?void 0:C[0])||null)}}),a.jsxs("button",{type:"button",className:`skill-upload-dropzone${v?" is-dragging":""}`,onClick:()=>{var k;return(k=w.current)==null?void 0:k.click()},onDragEnter:k=>{k.preventDefault(),y(!0)},onDragOver:k=>{k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0)},onDragLeave:k=>{k.currentTarget.contains(k.relatedTarget)||y(!1)},onDrop:k=>{var C;k.preventDefault(),y(!1),O(((C=k.dataTransfer.files)==null?void 0:C[0])||null)},children:[a.jsx("strong",{children:o?o.name:r("management.dropzone")}),a.jsx("span",{children:o?r("fileTree.bytes",{value:new Intl.NumberFormat(s.resolvedLanguage).format(o.size)}):r("management.chooseLocalFile")})]}),a.jsx("p",{children:r("management.archiveHelp")}),d?a.jsx("div",{className:"skill-inline-notice",children:r("management.validating")}):null,c?a.jsx("div",{className:"skill-inline-notice",children:r("management.validationPassed",{name:c.name,count:c.fileCount})}):null,g?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:g})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!o||!c||d||h,onClick:()=>void S(),children:r(h?"management.uploading":"management.upload")})]})]})}function SHt(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=e.trim(),n=Number(t);return/^\d+(?:\.\d+)?$/.test(t)?n<1e12?n*1e3:n:Date.parse(t)}function LD(e,t=Date.now(),n="zh-CN"){if(e===void 0||e==="")return"—";const i=SHt(e);if(!Number.isFinite(i))return"—";const r=Math.floor(Math.max(0,t-i)/1e3),s=new Intl.RelativeTimeFormat(n,{numeric:"always"}),o=(f,h,m)=>n.toLowerCase().startsWith("zh")?`${f} ${m}前`:s.format(-f,h);if(r<60)return o(r,"second","秒");const l=Math.floor(r/60);if(l<60)return o(l,"minute","分钟");const c=Math.floor(l/60);if(c<24)return o(c,"hour","小时");const u=Math.floor(c/24);if(u<30)return o(u,"day","天");const d=Math.floor(u/30);return d<12?o(d,"month","个月"):o(Math.floor(d/12),"year","年")}const EHt=12,ase=12;function DR({disabled:e,placement:t="top",children:n}){const{t:i}=Ae("ui"),r=p.useId();return a.jsxs("span",{className:`skillcenter-disabled-action${e?" is-disabled":""} is-${t}`,tabIndex:e?0:void 0,"aria-describedby":e?r:void 0,children:[n,e?a.jsx("span",{id:r,className:"skillcenter-disabled-tooltip",role:"tooltip",children:i("skillCenter.sandboxNotConfigured")}):null]})}const CHt=new Set(["active","available","creating","disabled","enabled","failed","inactive","pending","published","ready","released","running","success","unavailable","unreleased","updating"]);function b6e(e,t){const n=(e||"").trim().toLowerCase();return CHt.has(n)?t(`skillCenter.status.${n}`):t("skillCenter.status.unknown")}function THt(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)||t==="running"?"is-positive":["creating","pending","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function AHt(e,t){if(!e)return"";const n=e.trim(),i=Number(n),r=/^\d+(?:\.\d+)?$/.test(n)?new Date(i<1e12?i*1e3:i):new Date(n);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat(t,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function lse(e){if(!e)return 0;const t=e.trim(),n=Number(t),i=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(i.getTime())?0:i.getTime()}function Pc(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function _Ht(e,t){const n=new Map(e.map(i=>[Pc(i),i]));for(const i of t)n.set(Pc(i),i);return[...n.values()].sort((i,r)=>lse(r.updatedAt)-lse(i.updatedAt))}function jHt(e){const t=e.replace(/\r\n/g,` +`)}function JVt(e){var t;if(e.repairing||((t=e.task)==null?void 0:t.state)==="running"&&e.repairMode){if(e.repairMode==="manual")return Jt("generation.stages.repairingAgain");const n=Math.max(1,e.repairAttempts||1);return Jt("generation.stages.autoRepairing",{attempt:n,max:c6e})}return ZVt(e.task)}function sse(){return a.jsxs("svg",{className:"skill-generation__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[a.jsx("circle",{cx:"10",cy:"10",r:"7"}),a.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function eHt(e,t=Date.now()){if(!(e!=null&&e.expiresAt))return Jt("generation.sessionMax");const n=Math.max(0,new Date(e.expiresAt).getTime()-t),i=Math.floor(n/6e4),r=Math.floor(n%6e4/1e3);return Jt("generation.remaining",{minutes:i,seconds:String(r).padStart(2,"0")})}function tHt(e){return e?e.length>64?Jt("generation.validation.nameTooLong"):/^[a-z0-9-]+$/.test(e)?"":Jt("generation.validation.invalidName"):""}function ose(e){return e?e.length>128?Jt("generation.validation.modelTooLong"):/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":Jt("generation.validation.invalidModel"):""}function s4(e){return`${e.region||""}:${e.id}`}function nHt(){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function iHt({operation:e,cloudProvider:t,space:n,availableSpaces:i=[],spacesLoading:r=!1,initialIntent:s="",source:o,onBack:l,onPublished:c}){var Ce,ke,Ke,it;const{t:u}=Ae("skills"),[d,f]=p.useState(null),[h,m]=p.useState(null),[g,b]=p.useState(s),[v,y]=p.useState(""),[x,w]=p.useState([]),[O,S]=p.useState([]),[k,C]=p.useState(""),[E,R]=p.useState(!1),[_,j]=p.useState(""),[T,N]=p.useState(""),[A,P]=p.useState(null),[D,M]=p.useState(""),[L,U]=p.useState(""),[I,H]=p.useState(n?s4(n):""),[K,F]=p.useState(Date.now()),W=p.useRef([]);p.useEffect(()=>{const ue=new AbortController;return KP(ue.signal).then(xe=>{f(xe),w([ise(0,xe)])}).catch(xe=>{ue.signal.aborted||m(vr(xe,Jt("generation.errors.loadCapability")))}),()=>ue.abort()},[]),p.useEffect(()=>{W.current=O},[O]),p.useEffect(()=>{const ue=window.setInterval(()=>F(Date.now()),1e3);return()=>window.clearInterval(ue)},[]),p.useEffect(()=>{const ue=xe=>{W.current.some(Te=>{var qe;return((qe=Te.task)==null?void 0:qe.state)==="running"||Te.repairing})&&xe.preventDefault()};return window.addEventListener("beforeunload",ue),()=>{var xe;window.removeEventListener("beforeunload",ue);for(const Te of W.current)(xe=Te.task)!=null&&xe.jobId&&QPt(Te.task.jobId).catch(()=>{})}},[]),p.useEffect(()=>{if(!O.some(qe=>{var De;return((De=qe.task)==null?void 0:De.state)==="running"||qe.repairing}))return;let ue=!1,xe;const Te=async()=>{const qe=W.current,De=await Promise.all(qe.map(async At=>{var It;if(((It=At.task)==null?void 0:It.state)!=="running")return At;try{const lt=await FPt(At.task.jobId);if(r4(lt)&&(At.repairAttempts||0)dt.map(yt=>yt.id===At.id?{...yt,task:lt,repairing:!0,repairMode:"auto",repairAttempts:Ct,repairError:void 0}:yt));try{const dt=await Z5({jobId:lt.jobId,intent:rse(lt),expectedRevision:lt.revision});return{...At,task:dt,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ct,repairError:void 0,error:void 0,pollError:void 0}}catch(dt){return{...At,task:lt,repairing:!1,repairMode:void 0,repairAttempts:Ct,repairError:vr(dt,Jt("generation.errors.autoRepair")),pollError:void 0}}}let Ot=At.artifact;return lt.state==="ready"&&(Ot=await Y5(lt.jobId,lt.revision)),{...At,task:lt,artifact:Ot,repairing:!1,repairMode:lt.state==="running"?At.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(lt){return{...At,pollError:vr(lt,Jt("generation.errors.pollCandidate"))}}}));ue||(S(De),xe=window.setTimeout(()=>void Te(),GVt))};return Te(),()=>{ue=!0,xe!==void 0&&window.clearTimeout(xe)}},[O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"||ue.repairing})]);const V=O.find(ue=>ue.id===k)||O[0],X=e==="create"&&!n,ie=i.find(ue=>s4(ue)===I)??null,Q=n??ie,Z=i.map(ue=>({value:s4(ue),label:`${rc(ue)||u("generation.unnamedSpace")} · ${If(ue.region||"cn-beijing",t)}`})),ce=tHt(v),Ee=!!(d!=null&&d.enabled&&g.trim()&&!ce&&x.length>0&&x.every(ue=>ue.model.trim()&&!ose(ue.model.trim()))),Y=(ue,xe)=>{w(Te=>Te.map(qe=>qe.id===ue?{...qe,...xe}:qe))},G=async ue=>{const xe={...ue,model:ue.model.trim()},Te=ue.style==="custom"?ue.customStyle.trim():ue.style;try{const qe=await $Pt({operation:e,intent:g.trim(),model:xe.model,style:Te,name:v.trim()||void 0,source:o});return{id:ue.id,config:xe,task:qe}}catch(qe){return{id:ue.id,config:xe,error:vr(qe,Jt("generation.errors.createCandidate"))}}},te=async()=>{if(!Ee)return;R(!0),P(null);const ue=x.map(Te=>({id:Te.id,config:Te}));S(ue),C(x[0].id);const xe=await Promise.all(x.map(G));S(xe)},ye=async ue=>{S(Te=>Te.map(qe=>qe.id===ue.id?{...qe,error:void 0}:qe));const xe=await G(ue.config);S(Te=>Te.map(qe=>qe.id===ue.id?xe:qe))},Ne=async()=>{if(!(!(V!=null&&V.task)||!_.trim()||V.task.state!=="ready")){N("refine"),P(null);try{const ue=await Z5({jobId:V.task.jobId,intent:_.trim(),expectedRevision:V.task.revision});S(xe=>xe.map(Te=>Te.id===V.id?{...Te,task:ue,artifact:void 0}:Te)),j("")}catch(ue){P(vr(ue,Jt("generation.errors.refine")))}finally{N("")}}},pe=async()=>{if(!(!(V!=null&&V.task)||!r4(V.task))){N("refine"),P(null),S(ue=>ue.map(xe=>xe.id===V.id?{...xe,repairing:!0,repairMode:"manual",repairError:void 0}:xe));try{const ue=await Z5({jobId:V.task.jobId,intent:rse(V.task),expectedRevision:V.task.revision});S(xe=>xe.map(Te=>Te.id===V.id?{...Te,task:ue,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:Te))}catch(ue){S(xe=>xe.map(Te=>Te.id===V.id?{...Te,repairing:!1,repairMode:void 0,repairError:vr(ue,Jt("generation.errors.repairAgain"))}:Te))}finally{N("")}}},me=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||L)){N("publish"),P(null);try{if(!Q)throw new Error(Jt("generation.errors.selectSpace"));const ue=V.artifact||await Y5(V.task.jobId,V.task.revision),xe=(o==null?void 0:o.region)||Q.region||"";if(!_I(xe))throw new Error(Jt("generation.errors.unsupportedRegion"));await UPt({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:ue.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[Q.id],projectName:(o==null?void 0:o.projectName)||Q.projectName,region:xe,onProgress:Te=>M(Te.message)}),U(V.id),c()}catch(ue){P(vr(ue,Jt("generation.errors.upload")))}finally{N(""),M("")}}},se=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){N("download");try{const ue=V.artifact||await Y5(V.task.jobId,V.task.revision);await zPt(V.task.jobId,V.task.revision,ue.sha256)}catch(ue){P(vr(ue,Jt("generation.errors.download")))}finally{N("")}}},Se=async()=>{O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"})&&!window.confirm(Jt("generation.leaveConfirmation"))||(await Promise.allSettled(O.flatMap(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="running"?[BPt({jobId:ue.task.jobId,expectedRevision:ue.task.revision})]:[]})),l())},Le=e==="create"?u("generation.createTitle"):u("generation.optimizeTitle",{name:(o==null?void 0:o.name)||u("generation.skillFallback")}),be=ue=>{var xe;return((xe=d==null?void 0:d.models.find(Te=>Te.id===ue))==null?void 0:xe.label)||ue},Ve=ue=>ue.config.style==="custom"?ue.config.customStyle.trim()||u("generation.styles.customFallback"):u(nse[ue.config.style]),ve=[...Object.entries(nse).map(([ue,xe])=>({value:ue,label:u(xe)})),{value:"custom",label:u("generation.styles.custom")}],Re=ue=>ue.error||ue.repairError?u("generation.stages.failed"):JVt(ue),ne=ue=>!ue.error&&!ue.repairError&&(ue.repairing||!ue.task||ue.task.state==="running"),ge=O.some(ue=>{var xe;return((xe=ue.task)==null?void 0:xe.state)==="ready"});return a.jsxs("section",{className:"skill-generation",children:[a.jsxs("header",{className:"skill-generation__header",children:[a.jsx("button",{type:"button",className:"skillcenter-back",onClick:()=>void Se(),"aria-label":u("generation.back"),children:a.jsx(nHt,{})}),a.jsxs("div",{children:[a.jsx("h1",{children:Le}),a.jsx("p",{children:rc(n)||u("generation.home")})]}),O.length>0?a.jsx("span",{className:"skill-generation__ttl",children:eHt(V==null?void 0:V.task,K)}):null]}),E?a.jsxs("div",{className:"skill-generation__workspace",children:[a.jsx("div",{className:"skill-generation__candidate-tabs",role:"tablist","aria-label":u("generation.candidates"),children:O.map(ue=>a.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===ue.id,className:(V==null?void 0:V.id)===ue.id?"is-active":"",onClick:()=>C(ue.id),children:[a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.style")}),a.jsx("strong",{children:Ve(ue)})]}),a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.model")}),a.jsx("strong",{children:be(ue.config.model)})]}),a.jsxs("span",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.progress")}),a.jsxs("strong",{children:[ne(ue)?a.jsx(sse,{}):null,Re(ue)]})]})]},ue.id))}),V?a.jsxs("div",{className:"skill-generation__candidate",children:[a.jsxs("section",{className:"skill-generation__activity",children:[a.jsx("header",{children:a.jsxs("div",{className:"skill-generation__candidate-summary",children:[a.jsxs("div",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.style")}),a.jsx("strong",{children:Ve(V)})]}),a.jsxs("div",{className:"skill-generation__summary-row",children:[a.jsx("span",{children:u("generation.model")}),a.jsx("strong",{children:be(V.config.model)})]}),a.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[a.jsx("span",{children:u("generation.progress")}),a.jsxs("strong",{children:[ne(V)?a.jsx(sse,{}):null,ne(V)?a.jsx(yn,{children:Re(V)}):Re(V)]})]})]})}),V.task?a.jsx(kLt,{activities:V.task.activities}):null,V.pollError?a.jsx("div",{className:"skill-inline-notice",children:a.jsx(ms,{error:V.pollError})}):null,V.repairError?a.jsx("div",{className:"skill-inline-notice",children:a.jsx(ms,{error:V.repairError})}):null,V.error?a.jsxs("div",{className:"skill-inline-error",children:[a.jsx(ms,{error:V.error}),a.jsx("button",{type:"button",onClick:()=>void ye(V),children:u("generation.retryCandidate")})]}):null,(Ce=V.task)!=null&&Ce.validation&&!V.task.validation.valid&&!V.repairing&&V.task.state==="failed"?a.jsxs("div",{className:"skill-validation-errors",children:[a.jsx("strong",{children:u("generation.formatValidationFailed")}),V.task.validation.errors.map(ue=>a.jsx("p",{children:ue},ue)),r4(V.task)?a.jsx("button",{type:"button",disabled:!!T,onClick:()=>void pe(),children:u("generation.repairAgain")}):null]}):null]}),a.jsxs("section",{className:"skill-generation__files",children:[a.jsxs("header",{children:[a.jsx("h2",{children:u("generation.files")}),((ke=V.task)==null?void 0:ke.state)==="ready"?a.jsx("button",{type:"button",onClick:()=>void se(),disabled:!!T,children:u("generation.downloadZip")}):null]}),V.artifact?a.jsx(jD,{files:V.artifact.files}):a.jsx("div",{className:"skill-generation__files-empty",children:((Ke=V.task)==null?void 0:Ke.state)==="ready"?u("generation.loadingFiles"):u("generation.filesPending")})]}),((it=V.task)==null?void 0:it.state)==="ready"?a.jsxs("div",{className:"skill-generation__ready-actions",children:[X?a.jsx("div",{className:"skill-generation__publish-target",children:a.jsx(Y_,{label:u("generation.uploadToSpace"),value:I,options:Z,onChange:H,disabled:r,placeholder:u(r?"generation.loadingSpaces":"generation.selectSpace")})}):null,a.jsxs("footer",{className:"skill-generation__followup",children:[a.jsx("textarea",{value:_,onChange:ue=>j(ue.target.value),placeholder:u("generation.continuePlaceholder")}),a.jsx("button",{type:"button",className:"skill-button",disabled:!_.trim()||!!T,onClick:()=>void Ne(),children:u("generation.continue")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!T||!!L||!Q,onClick:()=>void me(),children:T==="publish"?D||u("generation.uploading"):u(e==="optimize"?"generation.overwrite":X?"generation.uploadToSelectedSpace":"generation.uploadToCurrentSpace")})]})]}):null,A?a.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:a.jsx(ms,{error:A})}):null]}):null,!ge&&O.every(ue=>ue.error)?a.jsx("div",{className:"skill-inline-error",children:u("generation.allCandidatesFailed")}):null]}):a.jsxs("div",{className:"skill-generation__setup",children:[a.jsx("div",{className:"skill-generation__section-head is-basic",children:a.jsx("div",{children:a.jsx("strong",{children:u("generation.basicInfo")})})}),a.jsxs("label",{children:[a.jsxs("span",{children:[u("generation.goal"),a.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"})]}),a.jsx("textarea",{required:!0,value:g,onChange:ue=>b(ue.target.value),placeholder:u(e==="create"?"generation.createIntentPlaceholder":"generation.optimizeIntentPlaceholder")})]}),a.jsxs("label",{children:[a.jsx("span",{children:u("generation.skillName")}),a.jsx("input",{value:v,onChange:ue=>y(ue.target.value),placeholder:u("generation.autoNamePlaceholder"),"aria-invalid":!!ce,"aria-describedby":"skill-name-help"}),ce?a.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:ce}):a.jsx("span",{id:"skill-name-help",className:"skill-generation__field-help",children:u("generation.nameHelp")})]}),a.jsx("div",{className:"skill-generation__section-head",children:a.jsxs("div",{children:[a.jsx("strong",{children:u(e==="create"?"generation.createPlans":"generation.optimizePlans")}),a.jsx("span",{children:u(e==="create"?"generation.createPlansDescription":"generation.optimizePlansDescription")})]})}),a.jsxs("div",{className:"skill-generation__groups",children:[x.map((ue,xe)=>a.jsxs("article",{className:"skill-generation__group",children:[a.jsxs("header",{children:[a.jsx("strong",{children:u("generation.plan",{count:xe+1})}),x.length>1?a.jsx("button",{type:"button",onClick:()=>w(Te=>Te.filter(qe=>qe.id!==ue.id)),children:u("generation.remove")}):null]}),a.jsx(Y_,{label:u("generation.model"),required:!0,value:ue.model,options:(d==null?void 0:d.models.map(Te=>({value:Te.id,label:Te.label})))||[],onChange:Te=>Y(ue.id,{model:Te}),allowCustom:!0,placeholder:u("generation.modelPlaceholder"),error:ose(ue.model.trim())}),a.jsx(Y_,{label:u("generation.style"),required:!0,value:ue.style,options:ve,onChange:Te=>Y(ue.id,{style:Te})}),ue.style==="custom"?a.jsxs("label",{children:[a.jsx("span",{children:u("generation.customStyle")}),a.jsx("textarea",{value:ue.customStyle,onChange:Te=>Y(ue.id,{customStyle:Te.target.value}),placeholder:u("generation.customStylePlaceholder")})]}):null]},ue.id)),d&&x.lengthw(ue=>[...ue,ise(ue.length,d)]),children:u("generation.addConfiguration")}):null]}),h?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:h})}):null,d&&!d.enabled?a.jsx("div",{className:"skill-inline-notice",children:u("generation.notConfigured")}):null,a.jsx("div",{className:"skill-generation__setup-actions",children:a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!Ee,onClick:()=>void te(),children:u("generation.generate")})})]})]})}async function u6e(e,t,n,i){const r=new URLSearchParams({region:e.region}),s=await fetch(Zo(`/web/skill-management/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/versions?${r}`),{...t,headers:Pl(uu(t.headers)),signal:Ua(e.signal,i)});if(!s.ok)throw await qP(s,n);return s.json()}function rHt(e){return u6e(e,{},z("skills.listVersionsFailed"),Ba)}function sHt(e){return u6e(e,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},z("skills.uploadVersionFailed"),xr)}function d6e(e){const t=new Map;for(const n of e){const i=`${n.sourceSkillId}:${n.version}`,r=t.get(i);(!r||n.submittedAt>r.submittedAt)&&t.set(i,n)}return t}function oHt(e,t,n,i){const r=i.trim().toLocaleLowerCase();return e.filter(s=>s.kind===t&&(n==="all"||s.status===n)&&`${s.name} ${s.description} ${s.author} ${s.version}`.toLocaleLowerCase().includes(r))}const f6e=p.createContext(void 0);function o0(e){const t=p.useContext(f6e);if(!e&&t===void 0)throw new Error(du(27));return t}const ND=p.forwardRef(function(t,n){const{render:i,className:r,style:s,forceRender:o=!1,...l}=t,c=o0(),u=c.useState("open"),d=c.useState("nested"),f=c.useState("mounted"),h=c.useState("transitionStatus");return Do("div",t,{state:{open:u,transitionStatus:h},ref:[c.context.backdropRef,n],stateAttributesMapping:dAe,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:o||!d})}),MH=p.forwardRef(function(t,n){const{render:i,className:r,style:s,disabled:o=!1,nativeButton:l=!0,...c}=t,u=o0(),d=u.useState("open"),{getButtonProps:f,buttonRef:h}=QU({disabled:o,native:l}),m={disabled:o};function g(b){d&&u.setOpen(!1,Gs(wTe,b.nativeEvent))}return Do("button",t,{state:m,ref:[n,h],props:[{onClick:g},c,f]})}),RD=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,...l}=t,c=o0(),u=hg(o);return c.useSyncedValueWithCleanup("descriptionElementId",u),Do("p",t,{ref:n,props:[{id:u},l]})}),h6e=p.createContext(void 0);function aHt(){const e=p.useContext(h6e);if(e===void 0)throw new Error(du(26));return e}const lHt={...GU,...KI,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},ID=p.forwardRef(function(t,n){const{render:i,className:r,style:s,finalFocus:o,initialFocus:l,...c}=t,u=o0(),d=u.useState("descriptionElementId"),f=u.useState("disablePointerDismissal"),h=u.useState("floatingRootContext"),m=u.useState("popupProps"),g=u.useState("modal"),b=u.useState("mounted"),v=u.useState("nested"),y=u.useState("nestedOpenDialogCount"),x=u.useState("open"),w=u.useState("openMethod"),O=u.useState("titleElementId"),S=u.useState("transitionStatus"),k=u.useState("role"),C=h.useState("floatingId");aHt(),mC({open:x,ref:u.context.popupRef,onComplete(){var N,A;x&&((A=(N=u.context).onOpenChangeComplete)==null||A.call(N,!0))}});const E=l===void 0?XTe(u.context.popupRef):l,R=y>0,_=u.useStateSetter("popupElement"),T=Do("div",t,{state:{open:x,nested:v,transitionStatus:S,nestedDialogOpen:R},props:[m,{id:C,"aria-labelledby":O,"aria-describedby":d,role:k,...GTe,hidden:!b,onKeyDown(N){iMe.has(N.key)&&N.stopPropagation()},style:{"--nested-dialogs":y}},c],ref:[n,u.context.popupRef,_],stateAttributesMapping:lHt});return a.jsx(ITe,{context:h,openInteractionType:w,disabled:!b,closeOnFocusOut:!f,initialFocus:E,returnFocus:o,modal:g!==!1,restoreFocus:"popup",children:T})}),PD=p.forwardRef(function(t,n){const{keepMounted:i=!1,...r}=t,s=o0(),o=s.useState("mounted"),l=s.useState("modal"),c=s.useState("open");return o||i?a.jsx(h6e.Provider,{value:i,children:a.jsxs(TTe,{ref:n,...r,children:[o&&l===!0&&a.jsx(tMe,{ref:s.context.internalBackdropRef,inert:BU(!c)}),t.children]})}):null});function cHt({store:e,parentContext:t,isDrawer:n}){const i=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),o=e.useState("popupElement"),l=e.useState("floatingRootContext"),[c,u]=p.useState(0),[d,f]=p.useState(0),h=c===0,m=PTe(l,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const b=Yo(g);if(h&&!r){if(s){const v=e.context.internalBackdropRef.current,y=e.context.backdropRef.current;return v||y?v===b||y===b||zn(b,o)&&!(b!=null&&b.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:h});return nMe(i&&s===!0,o),e.useContextCallback("onNestedDialogOpen",(g,b)=>{u(g),f(b)}),Un(()=>(t!=null&&t.onNestedDialogOpen&&(i?t.onNestedDialogOpen(c+1,d+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&i&&t.onNestedDialogOpen(0,0)}),[n,i,c,d,t]),nAe(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:d}),null}const uHt={...aAe,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class dHt extends BI{constructor(n,i,r){const s=new qU,o=fHt(n,s,i,r);super(o,hHt(s),uHt);rn(this,"setOpen",(n,i)=>{var s,o;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(o=(s=this.context).onOpenChange)==null||o.call(s,n,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,i);const r={open:n};JTe(r,n,i.trigger),this.update(r)})}}function fHt(e,t,n,i=!1){const r={...rAe(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return r.floatingRootContext=sAe(t,n,i),r}function hHt(e){return{popupRef:p.createRef(),backdropRef:p.createRef(),internalBackdropRef:p.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function pHt(e,t){const{children:n,open:i,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:l=!1,modal:c=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:h=null}=t,m=e==="drawer",g=c,b=l,v="dialog",y=o0(!0),x=y!=null,w={modal:g,disablePointerDismissal:b,nested:x,role:v},O=YTe((_,j)=>new dHt({open:r,openProp:i,activeTriggerId:h,triggerIdProp:f,...w},_,j),!0);O.useControlledProp("openProp",i),O.useControlledProp("triggerIdProp",f),O.useSyncedValues(w),O.useContextCallback("onOpenChange",s),O.useContextCallback("onOpenChangeComplete",o);const S=O.useState("open"),k=O.useState("mounted"),C=O.useState("payload");iAe(O,S),eAe(O);const{forceUnmount:E}=tAe(S,O);p.useImperativeHandle(u,()=>({unmount:E,close:()=>O.setOpen(!1,Gs(kTe))}),[E,O]);const R=S||k;return a.jsxs(f6e.Provider,{value:O,children:[d&&a.jsx(ZTe,{handle:d,store:O}),R&&a.jsx(cHt,{store:O,parentContext:y==null?void 0:y.context,isDrawer:m}),typeof n=="function"?n({payload:C}):n]})}function DD(e){return pHt("dialog",e)}const MD=p.forwardRef(function(t,n){const{render:i,className:r,style:s,id:o,...l}=t,c=o0(),u=hg(o);return c.useSyncedValueWithCleanup("titleElementId",u),Do("h2",t,{ref:n,props:[{id:u},l]})});async function p6e(e,t){const n=new URLSearchParams({region:e.region}),i=t?"/retry":`?${n}`,r=await fetch(Zo(`/web/skill-management/reviews/${encodeURIComponent(e.id)}/score${i}`),{method:t?"POST":"GET",headers:Pl(uu(t?{"Content-Type":"application/json"}:void 0)),...t?{body:JSON.stringify({region:e.region})}:{},signal:Ua(e.signal,Ba)});if(!r.ok)throw await qP(r,mn.t(t?"score.retryFailed":"score.loadFailed",{ns:"reviews"}));return r.json()}const mHt=e=>p6e(e,!1),gHt=e=>p6e(e,!0),bHt=["safety","usability","completeness","reliability","maintainability"];function m6e(e){return(e==null?void 0:e.status)==="queued"||(e==null?void 0:e.status)==="running"}function yHt(e){if(e.status!=="not_requested")return{status:e.status,overallScore:e.overallScore,scoredAt:e.scoredAt,modelName:e.modelName,rubricVersion:e.rubricVersion,error:e.error}}function LH({score:e}){const{t}=Ae("reviews");return a.jsx("span",{className:`review-score-label is-${(e==null?void 0:e.status)||"unscored"}`,children:(e==null?void 0:e.status)==="completed"?typeof e.overallScore=="number"?t("score.points",{score:e.overallScore}):t("score.insufficient"):t(`score.status.${(e==null?void 0:e.status)||"unscored"}`)})}function g6e({application:e,canRetry:t=!1,onScoreChanged:n}){const{t:i,i18n:r}=Ae("reviews"),[s,o]=p.useState(e.aiReview),[l,c]=p.useState(!!e.aiReview),[u,d]=p.useState(null),[f,h]=p.useState({revision:0,retry:!1}),[m,g]=p.useState(""),b=p.useRef(-1),v=p.useRef(n);v.current=n;const{id:y,region:x}=e,w=!!e.aiReview;p.useEffect(()=>{if(!w&&f.revision===0)return;const k=new AbortController;let C,E=!1,R=!0;const _=async(N,A=!1)=>{var P;if(!(E||k.signal.aborted)&&!(!A&&document.visibilityState==="hidden")){E=!0,A&&c(!0),d(null);try{const D=await(N?gHt:mHt)({id:y,region:x,signal:k.signal});if(k.signal.aborted)return;o(D),(P=v.current)==null||P.call(v,D,N),R=m6e(D),R&&document.visibilityState!=="hidden"&&(C=setTimeout(()=>void _(!1),5e3))}catch(D){k.signal.aborted||(R=!1,d(vr(D,i(N?"score.retryFailed":"score.loadFailed"))))}finally{E=!1,k.signal.aborted||c(!1)}}},j=()=>{clearTimeout(C),R&&document.visibilityState!=="hidden"&&_(!1)},T=f.retry&&b.current!==f.revision;return T&&(b.current=f.revision),_(T,!0),document.addEventListener("visibilitychange",j),()=>{k.abort(),clearTimeout(C),document.removeEventListener("visibilitychange",j)}},[y,x,w,f,i]);const O=(s==null?void 0:s.status)==="completed"?s.result:void 0;p.useEffect(()=>{if(!O){g("");return}const k=URL.createObjectURL(new Blob([JSON.stringify(O,null,2)],{type:"application/json"}));return g(k),()=>URL.revokeObjectURL(k)},[O]);const S=k=>h(C=>({revision:C.revision+1,retry:k}));return a.jsxs("section",{className:"review-score","aria-label":i("score.title"),children:[a.jsxs("div",{className:"review-score__header",children:[a.jsx("div",{"aria-live":"polite",children:l?a.jsx(yn,{children:i(f.retry?"score.starting":"score.loading")}):a.jsx(LH,{score:s})}),a.jsxs("div",{className:"review-score__actions",children:[m?a.jsx("a",{className:"cw-btn cw-btn-ghost",href:m,download:`${y}-score.json`,children:i("score.download")}):null,t&&(!s||s.status==="failed"||s.status==="not_requested")?a.jsx("button",{type:"button",className:"cw-btn cw-btn-ghost",disabled:l,onClick:()=>S(!0),children:i((s==null?void 0:s.status)==="failed"?"score.retry":"score.start")}):null]})]}),a.jsx("p",{className:"review-score__hint",children:i("score.hint")}),u?a.jsxs("div",{className:"review-score__error",role:"alert",children:[a.jsx(ms,{error:u}),a.jsx("button",{type:"button",className:"cw-btn cw-btn-ghost",disabled:l,onClick:()=>S(!1),children:i("score.reload")})]}):null,s!=null&&s.error?a.jsx("div",{role:"alert",className:"review-score__error",children:a.jsxs("details",{className:"review-score__raw-error",open:!0,children:[a.jsx("summary",{children:i("score.originalError")}),a.jsx("pre",{children:s.error})]})}):(s==null?void 0:s.status)==="failed"?a.jsx("p",{role:"alert",className:"review-score__error",children:i("score.failed")}):null,O?a.jsxs(a.Fragment,{children:[O.riskFlags.length?a.jsxs("div",{className:"review-score__risks",children:[a.jsx("h3",{children:i("score.risks")}),a.jsx("ul",{children:O.riskFlags.map((k,C)=>a.jsxs("li",{children:[a.jsx("strong",{children:i(`score.severity.${k.severity}`)})," · ",k.reason]},`${C}:${k.reason}`))})]}):null,O.coverage&&!O.coverage.complete?a.jsxs("div",{className:"review-score__coverage",children:[a.jsx("h3",{children:i("score.coverage")}),a.jsx("p",{children:i("score.coverageIncomplete")}),a.jsx("p",{children:i("score.coverageCount",{included:O.coverage.includedFiles,total:O.coverage.totalFiles})}),a.jsxs("ul",{children:[O.coverage.omittedFiles.map(k=>a.jsx("li",{children:i("score.omittedFile",k)},`omitted:${k.path}`)),O.coverage.truncatedFiles.map(k=>a.jsx("li",{children:i("score.truncatedFile",k)},`truncated:${k.path}`))]})]}):null,a.jsx("dl",{className:"review-score__dimensions",children:bHt.map(k=>{const C=O.dimensions[k];return a.jsxs("div",{className:k==="safety"&&C.score!==null&&C.score<60?"is-risk":void 0,children:[a.jsxs("dt",{children:[a.jsx("span",{children:i(`score.dimensions.${k}`)}),a.jsx("strong",{children:C.score===null?i("score.insufficient"):i("score.points",{score:C.score})})]}),a.jsx("dd",{children:C.reason})]},k)})}),O.suggestions.length?a.jsxs("div",{className:"review-score__suggestions",children:[a.jsx("h3",{children:i("score.suggestions")}),a.jsx("ul",{children:O.suggestions.map((k,C)=>a.jsx("li",{children:k},`${C}:${k}`))})]}):null,a.jsxs("dl",{className:"review-score__metadata",children:[a.jsxs("div",{children:[a.jsx("dt",{children:i("score.model")}),a.jsx("dd",{children:O.modelName})]}),a.jsxs("div",{children:[a.jsx("dt",{children:i("score.rubric")}),a.jsx("dd",{children:O.rubricVersion})]}),a.jsxs("div",{children:[a.jsx("dt",{children:i("score.time")}),a.jsx("dd",{children:a.jsx("time",{dateTime:O.scoredAt,children:new Date(O.scoredAt).toLocaleString(r.language,{hour12:!1})})})]})]})]}):null]})}function vHt({application:e}){const{t}=Ae("reviews"),[n,i]=p.useState(!1),[r,s]=p.useState(e.aiReview),o=p.useId();return p.useEffect(()=>s(e.aiReview),[e.aiReview]),a.jsxs("div",{className:"review-score-history",children:[a.jsxs("button",{type:"button",className:"review-score-history__toggle","aria-expanded":n,"aria-controls":o,onClick:()=>i(l=>!l),children:[a.jsx("span",{children:t("score.title")}),a.jsx(LH,{score:r}),a.jsx("span",{children:t(n?"score.collapse":"score.expand")})]}),n?a.jsx("div",{id:o,children:a.jsx(g6e,{application:e,onScoreChanged:s},`${e.region}:${e.id}`)}):null]})}function fT({status:e}){const{t}=Ae("reviews");return a.jsxs("span",{className:`review-status is-${e}`,children:[a.jsx("span",{"aria-hidden":"true"}),t(`status.${e}`)]})}function $H({person:e,fallback:t,compact:n=!1}){const{t:i}=Ae("reviews"),[r,s]=p.useState(""),o=(e==null?void 0:e.name)||t||i("detail.unknownReviewer"),l=e==null?void 0:e.avatarUrl;return a.jsxs("span",{className:`review-person${n?" is-compact":""}`,children:[l&&l!==r?a.jsx("img",{className:"review-person__avatar",src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>s(l)}):a.jsx("span",{className:"review-person__avatar is-fallback","aria-hidden":"true",children:Array.from(o)[0]}),a.jsxs("span",{className:"review-person__text",children:[a.jsx("span",{children:o}),!n&&(e!=null&&e.email)?a.jsx("span",{className:"review-person__email",children:e.email}):null]})]})}function FH({application:e}){const{t,i18n:n}=Ae("reviews");return a.jsxs("div",{className:"review-outcome",children:[a.jsx(fT,{status:e.status}),e.reviewer||e.reviewedBy||e.reviewedAt?a.jsxs("dl",{className:"review-outcome__facts",children:[e.reviewer||e.reviewedBy?a.jsxs("div",{children:[a.jsx("dt",{children:t(`detail.${e.status==="returned"?"returnedBy":e.status==="approved"?"approvedBy":"reviewer"}`)}),a.jsx("dd",{children:a.jsx($H,{person:e.reviewer,fallback:e.reviewedBy})})]}):null,e.reviewedAt?a.jsxs("div",{children:[a.jsx("dt",{children:t("detail.reviewedAt")}),a.jsx("dd",{children:a.jsx("time",{dateTime:e.reviewedAt,children:new Date(e.reviewedAt).toLocaleString(n.language,{hour12:!1})})})]}):null]}):null,e.reason?a.jsxs("div",{className:"review-outcome__message is-returned",children:[a.jsx("strong",{children:t("decision.reason")}),a.jsx("p",{children:e.reason})]}):null,e.comment?a.jsxs("div",{className:"review-outcome__message",children:[a.jsx("strong",{children:t("detail.comment")}),a.jsx("p",{children:e.comment})]}):null,e.status==="pending"?a.jsx("p",{className:"review-outcome__hint",children:t("detail.pendingHint")}):null,e.status==="approving"?a.jsx("p",{className:"review-outcome__hint",children:t("detail.approvingHint")}):null]})}function BH({applications:e}){const{t,i18n:n}=Ae("reviews");return e.length?a.jsx("ol",{className:"review-source-history",children:[...e].sort((i,r)=>r.submittedAt.localeCompare(i.submittedAt)).map(i=>a.jsxs("li",{children:[a.jsxs("div",{className:"review-source-history__submission",children:[a.jsx("strong",{children:i.version}),a.jsx("span",{children:t("detail.submitted",{name:i.author})}),a.jsx("time",{dateTime:i.submittedAt,children:new Date(i.submittedAt).toLocaleString(n.language,{hour12:!1})})]}),a.jsx(FH,{application:i}),a.jsx(vHt,{application:i})]},i.id))}):a.jsx("p",{className:"review-outcome__hint",children:t("detail.noHistory")})}function xHt({name:e,applications:t,onClose:n}){const{t:i}=Ae("reviews"),r=p.useRef(document.activeElement instanceof HTMLElement?document.activeElement:null);return a.jsx(DD,{open:!0,onOpenChange:s=>{s||n()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"review-backdrop"}),a.jsxs(ID,{className:"review-drawer",finalFocus:()=>{var s;return(s=r.current)!=null&&s.isConnected?r.current:null},children:[a.jsxs("header",{className:"review-drawer__header",children:[a.jsxs("div",{children:[a.jsx(MD,{children:i("detail.history")}),a.jsx(RD,{children:e})]}),a.jsx(MH,{className:"review-icon-button","aria-label":i("actions.close"),children:a.jsx(tD,{})})]}),a.jsx("div",{className:"review-drawer__body",children:a.jsx(BH,{applications:t})})]})]})})}function wHt({skill:e,space:t,region:n,reviews:i,onClose:r,onChanged:s,onSubmitReview:o}){const{t:l,i18n:c}=Ae("ui"),[u,d]=p.useState(null),[f,h]=p.useState(e.version),[m,g]=p.useState(!0),[b,v]=p.useState(null),[y,x]=p.useState(null),[w,O]=p.useState([]),[S,k]=p.useState(!1),[C,E]=p.useState(null),[R,_]=p.useState(0),[j,T]=p.useState(0),[N,A]=p.useState(null),P=p.useRef(null),D=p.useRef(null),M=p.useRef(null),L=p.useRef(!1),U=p.useRef(!0),I=p.useRef({onClose:r,busy:N});I.current={onClose:r,busy:N};const H=u==null?void 0:u.items.find(Z=>Z.version===f),K=p.useMemo(()=>d6e(i),[i]),F=K.get(`${e.skillId}:${f}`),W=i.filter(Z=>Z.sourceSkillId===e.skillId&&Z.version===f&&Z.id!==(F==null?void 0:F.id)),V=!!(o&&(u!=null&&u.canUpdate)&&H&&["running","ready"].includes(H.status.toLowerCase())&&(!F||F.status==="returned"));p.useEffect(()=>{var Ee;U.current=!0;const Z=document.activeElement instanceof HTMLElement?document.activeElement:null;(Ee=M.current)==null||Ee.focus();const ce=Y=>{var Ne;if(Y.key==="Escape"&&(Y.preventDefault(),I.current.busy||I.current.onClose()),Y.key!=="Tab")return;const G=Array.from(((Ne=P.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]):not([type="file"]), a[href], summary, [tabindex="0"]'))||[]),te=G[0],ye=G[G.length-1];Y.shiftKey&&document.activeElement===te&&(Y.preventDefault(),ye==null||ye.focus()),!Y.shiftKey&&document.activeElement===ye&&(Y.preventDefault(),te==null||te.focus())};return document.addEventListener("keydown",ce),()=>{U.current=!1,document.removeEventListener("keydown",ce),Z!=null&&Z.isConnected&&Z.focus()}},[]),p.useEffect(()=>{const Z=new AbortController;return g(!0),v(null),rHt({spaceId:t.id,skillId:e.skillId,region:n,signal:Z.signal}).then(ce=>{Z.signal.aborted||(d(ce),h(Ee=>{var Y;return ce.items.some(G=>G.version===Ee)?Ee:((Y=ce.items[0])==null?void 0:Y.version)||""}))}).catch(ce=>{Z.signal.aborted||v(vr(ce,l("skillCenter.versions.loadFailed")))}).finally(()=>{Z.signal.aborted||g(!1)}),()=>Z.abort()},[t.id,e.skillId,n,R,l]),p.useEffect(()=>{if(!f||!H)return;let Z=!0;return k(!0),E(null),O([]),GDe({spaceId:t.id,skillId:e.skillId,region:n,version:f}).then(ce=>{Z&&O(ce)}).catch(ce=>{Z&&E(vr(ce,l("skillCenter.versions.filesFailed")))}).finally(()=>{Z&&k(!1)}),()=>{Z=!1}},[t.id,e.skillId,n,f,!!H,j,l]);async function X(Z){if(!L.current){L.current=!0,A("upload"),x(null);try{const ce=await sHt({spaceId:t.id,skillId:e.skillId,region:n,file:Z});if(!U.current)return;h(ce.version),_(Ee=>Ee+1),s()}catch(ce){U.current&&x(vr(ce,l("skillCenter.versions.uploadFailed")))}finally{L.current=!1,U.current&&A(null)}}}async function ie(){if(!(!V||!o||L.current)){L.current=!0,A("submit"),x(null);try{await o(f)}catch(Z){U.current&&x(vr(Z,l("skillCenter.versions.submitFailed")))}finally{L.current=!1,U.current&&A(null)}}}function Q(Z){if(!Z)return"—";const ce=new Date(Z);return Number.isNaN(ce.getTime())?Z:ce.toLocaleString(c.resolvedLanguage||c.language)}return a.jsx("div",{className:"skill-detail-backdrop",onMouseDown:Z=>{Z.target===Z.currentTarget&&!N&&r()},children:a.jsxs("section",{className:"skill-detail-dialog skill-versions",role:"dialog","aria-modal":"true","aria-labelledby":"skill-versions-title",ref:P,children:[a.jsxs("header",{className:"skill-detail-head",children:[a.jsx("div",{className:"skill-detail-heading",children:a.jsxs("div",{children:[a.jsx("h2",{id:"skill-versions-title",children:l("skillCenter.versions.title")}),a.jsx("p",{title:e.skillName,children:e.skillName})]})}),a.jsxs("div",{className:"skill-detail-actions",children:[a.jsx("button",{type:"button",disabled:m||!!N,onClick:()=>_(Z=>Z+1),children:l("skillCenter.versions.refresh")}),u!=null&&u.canUpdate?a.jsx("button",{type:"button",disabled:!!N,onClick:()=>{var Z;return(Z=D.current)==null?void 0:Z.click()},children:l(N==="upload"?"skillCenter.versions.uploading":"skillCenter.versions.upload")}):null,a.jsx("button",{type:"button",ref:M,disabled:!!N,onClick:r,children:l("skillCenter.versions.close")})]}),a.jsx("input",{className:"skill-versions__file-input",ref:D,type:"file",accept:".zip,application/zip","aria-label":l("skillCenter.versions.upload"),onChange:Z=>{var Ee;const ce=(Ee=Z.target.files)==null?void 0:Ee[0];Z.target.value="",ce&&X(ce)}})]}),y?a.jsx("div",{className:"skill-versions__notice",role:"alert",children:a.jsx(ms,{error:y})}):null,u!=null&&u.canUpdate?a.jsx("p",{className:"skill-versions__hint",children:l("skillCenter.versions.hint")}):null,a.jsxs("div",{className:"skill-versions__body",children:[a.jsxs("div",{className:"skill-versions__history","aria-busy":m,children:[m&&!u?a.jsx("p",{role:"status",children:l("skillCenter.versions.loading")}):null,b?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:b}),a.jsx("button",{className:"cw-btn cw-btn-ghost",type:"button",onClick:()=>_(Z=>Z+1),children:l("skillCenter.versions.retry")})]}):null,!m&&!b&&!(u!=null&&u.items.length)?a.jsx("p",{children:l("skillCenter.versions.empty")}):null,a.jsx("div",{className:"skill-versions__list",role:"list","aria-label":l("skillCenter.versions.title"),children:u==null?void 0:u.items.map(Z=>a.jsx("div",{role:"listitem",children:a.jsxs("button",{type:"button",className:`skill-versions__version${f===Z.version?" is-active":""}`,"aria-pressed":f===Z.version,onClick:()=>h(Z.version),children:[a.jsxs("span",{className:"skill-versions__version-title",children:[a.jsx("strong",{children:Z.sourceVersion||Z.version}),Z.isCurrent?a.jsx("span",{children:l("skillCenter.versions.current")}):null]}),a.jsx("time",{dateTime:Z.createdAt,children:Q(Z.createdAt)}),K.get(`${e.skillId}:${Z.version}`)?a.jsx(fT,{status:K.get(`${e.skillId}:${Z.version}`).status}):a.jsx("span",{children:l(t.isShared?"skillCenter.versions.shared":"skillCenter.versions.notSubmitted")})]})},Z.version))})]}),a.jsx("div",{className:"skill-versions__detail",children:H?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"skill-versions__summary",children:[a.jsxs("div",{children:[a.jsx("h3",{children:H.sourceVersion||H.version}),a.jsx("p",{title:H.description,children:H.description}),H.author||e.author?a.jsx("p",{className:"skill-versions__author",children:l("skillCenter.authorName",{name:H.author||e.author})}):null]}),o&&(u!=null&&u.canUpdate)?a.jsx("button",{type:"button",className:"cw-btn cw-btn-primary",disabled:!V||!!N,onClick:()=>void ie(),children:l(N==="submit"?"skillCenter.versions.submitting":"skillCenter.versions.submit")}):null]}),H.error?a.jsx("p",{className:"skill-versions__notice",role:"alert",children:H.error}):null,["running","ready"].includes(H.status.toLowerCase())?null:a.jsx("p",{role:"status",children:l("skillCenter.versions.processing",{status:H.status})}),F?a.jsx(FH,{application:F}):null,W.length?a.jsxs("details",{className:"skill-versions__review-history",children:[a.jsx("summary",{children:l("skillCenter.versions.history")}),a.jsx(BH,{applications:W})]}):null,a.jsx("div",{className:"skill-versions__files",children:S?a.jsx("p",{role:"status",children:l("skillCenter.versions.filesLoading")}):C?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:C}),a.jsx("button",{className:"cw-btn cw-btn-ghost",type:"button",onClick:()=>T(Z=>Z+1),children:l("skillCenter.versions.retry")})]}):w.length?a.jsx(jD,{files:w},f):a.jsx("p",{children:l("skillCenter.versions.filesEmpty")})})]}):null})]})]})})}function OHt({region:e,active:t,revision:n,onOpen:i}){const{t:r}=Ae("ui"),[s,o]=p.useState(null),[l,c]=p.useState(null),[u,d]=p.useState(0);return p.useEffect(()=>{if(!t)return;const f=new AbortController;return c(null),yPt({region:e,signal:f.signal}).then(h=>{f.signal.aborted||o(h)}).catch(h=>{f.signal.aborted||c(vr(h,r("skillCenter.sharedLoadFailed")))}),()=>f.abort()},[t,e,u,n,r]),a.jsxs("div",{className:"skillcenter-shared-space",children:[a.jsx(Jy,{className:"skillcenter-space-card",title:r("skillCenter.sharedSpace"),description:r("skillCenter.sharedDescription"),status:a.jsx("span",{className:"skillcenter-shared-badge",children:r("skillCenter.sharedVisibility")}),metadata:[{label:r("skillCenter.skillCount"),value:s?r("skillCenter.skillCountValue",{count:s.skillCount??0}):r(l?"skillCenter.sharedLoadFailed":"skillCenter.sharedPreparing")}],detailAction:{label:r("common.viewDetails"),disabled:!s||!!l,onClick:()=>{s&&i(s)}},action:l?{label:r("common.reload"),onClick:()=>d(f=>f+1)}:void 0}),l?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:l})}):null]})}function UH({title:e,children:t,onClose:n,className:i=""}){const{t:r}=Ae("skills"),s=p.useRef(null);return p.useEffect(()=>{var l;(l=s.current)==null||l.focus();const o=c=>c.key==="Escape"&&n();return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),a.jsx("div",{className:"skill-dialog-backdrop",onMouseDown:n,children:a.jsxs("section",{className:`skill-dialog${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-label":e,onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("header",{children:[a.jsx("h2",{children:e}),a.jsx("button",{ref:s,type:"button",onClick:n,"aria-label":r("management.close"),children:r("management.close")})]}),t]})})}function kHt({region:e,regionOptions:t,onClose:n,onCreated:i}){const{t:r}=Ae("skills"),[s,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(e),[f,h]=p.useState(!1),[m,g]=p.useState(null),b=async()=>{if(s.trim()){h(!0),g(null);try{const v=await bPt({name:s.trim(),description:l.trim()||void 0,region:u});i({...v,region:v.region||u})}catch(v){g(vr(v,r("management.createSpaceFailed")))}finally{h(!1)}}};return a.jsxs(UH,{title:r("management.createSpaceTitle"),onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("management.name")}),a.jsx("input",{autoFocus:!0,value:s,maxLength:128,onChange:v=>o(v.target.value)})]}),a.jsx(Y_,{label:r("management.region"),value:u,options:t,onChange:d,required:!0}),a.jsxs("label",{children:[a.jsx("span",{children:r("management.optionalDescription")}),a.jsx("textarea",{value:l,maxLength:1024,onChange:v=>c(v.target.value)})]}),m?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:m})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!s.trim()||f,onClick:()=>void b(),children:r(f?"management.creating":"management.create")})]})]})}function SHt({space:e,region:t,onClose:n,onUpdated:i}){const{t:r}=Ae("skills"),[s,o]=p.useState(e.name),[l,c]=p.useState(e.description||""),[u,d]=p.useState(!1),[f,h]=p.useState(null),m=async()=>{if(s.trim()){d(!0),h(null);try{const g=await SPt({spaceId:e.id,name:s.trim(),description:l.trim()||void 0,region:t});i({...e,...g,skillCount:e.skillCount})}catch(g){h(vr(g,r("management.updateSpaceFailed")))}finally{d(!1)}}};return a.jsxs(UH,{title:r("management.editSpaceTitle"),onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsxs("label",{children:[a.jsx("span",{children:r("management.name")}),a.jsx("input",{autoFocus:!0,value:s,maxLength:128,onChange:g=>o(g.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:r("management.optionalDescription")}),a.jsx("textarea",{value:l,maxLength:1024,onChange:g=>c(g.target.value)})]}),f?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:f})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!s.trim()||u,onClick:()=>void m(),children:r(u?"management.saving":"management.save")})]})]})}function EHt({space:e,region:t,onClose:n,onUploaded:i}){const{t:r,i18n:s}=Ae("skills"),[o,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,b]=p.useState(null),[v,y]=p.useState(!1),x=p.useRef(0),w=p.useRef(null),O=async k=>{const C=x.current+1;if(x.current=C,l(k),u(null),b(null),f(!!k),!!k)try{const E=await TPt(k);x.current===C&&u({name:E.name,fileCount:E.files.length})}catch(E){x.current===C&&b(vr(E,r("management.archiveValidationFailed")))}finally{x.current===C&&f(!1)}},S=async()=>{if(!(!o||!c)){m(!0),b(null);try{await CPt({spaceId:e.id,region:t,project:e.projectName,file:o}),i()}catch(k){b(vr(k,r("management.uploadFailed")))}finally{m(!1)}}};return a.jsxs(UH,{title:r("management.uploadTitle",{name:rc(e)}),className:"skill-upload-dialog",onClose:n,children:[a.jsxs("div",{className:"skill-dialog__body",children:[a.jsx("input",{ref:w,className:"skill-upload-dialog__input",type:"file",accept:".zip,application/zip",onChange:k=>{var C;return void O(((C=k.target.files)==null?void 0:C[0])||null)}}),a.jsxs("button",{type:"button",className:`skill-upload-dropzone${v?" is-dragging":""}`,onClick:()=>{var k;return(k=w.current)==null?void 0:k.click()},onDragEnter:k=>{k.preventDefault(),y(!0)},onDragOver:k=>{k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0)},onDragLeave:k=>{k.currentTarget.contains(k.relatedTarget)||y(!1)},onDrop:k=>{var C;k.preventDefault(),y(!1),O(((C=k.dataTransfer.files)==null?void 0:C[0])||null)},children:[a.jsx("strong",{children:o?o.name:r("management.dropzone")}),a.jsx("span",{children:o?r("fileTree.bytes",{value:new Intl.NumberFormat(s.resolvedLanguage).format(o.size)}):r("management.chooseLocalFile")})]}),a.jsx("p",{children:r("management.archiveHelp")}),d?a.jsx("div",{className:"skill-inline-notice",children:r("management.validating")}):null,c?a.jsx("div",{className:"skill-inline-notice",children:r("management.validationPassed",{name:c.name,count:c.fileCount})}):null,g?a.jsx("div",{className:"skill-inline-error",children:a.jsx(ms,{error:g})}):null]}),a.jsxs("footer",{children:[a.jsx("button",{type:"button",className:"skill-button",onClick:n,children:r("management.cancel")}),a.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!o||!c||d||h,onClick:()=>void S(),children:r(h?"management.uploading":"management.upload")})]})]})}function CHt(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=e.trim(),n=Number(t);return/^\d+(?:\.\d+)?$/.test(t)?n<1e12?n*1e3:n:Date.parse(t)}function LD(e,t=Date.now(),n="zh-CN"){if(e===void 0||e==="")return"—";const i=CHt(e);if(!Number.isFinite(i))return"—";const r=Math.floor(Math.max(0,t-i)/1e3),s=new Intl.RelativeTimeFormat(n,{numeric:"always"}),o=(f,h,m)=>n.toLowerCase().startsWith("zh")?`${f} ${m}前`:s.format(-f,h);if(r<60)return o(r,"second","秒");const l=Math.floor(r/60);if(l<60)return o(l,"minute","分钟");const c=Math.floor(l/60);if(c<24)return o(c,"hour","小时");const u=Math.floor(c/24);if(u<30)return o(u,"day","天");const d=Math.floor(u/30);return d<12?o(d,"month","个月"):o(Math.floor(d/12),"year","年")}const THt=12,ase=12;function DR({disabled:e,placement:t="top",children:n}){const{t:i}=Ae("ui"),r=p.useId();return a.jsxs("span",{className:`skillcenter-disabled-action${e?" is-disabled":""} is-${t}`,tabIndex:e?0:void 0,"aria-describedby":e?r:void 0,children:[n,e?a.jsx("span",{id:r,className:"skillcenter-disabled-tooltip",role:"tooltip",children:i("skillCenter.sandboxNotConfigured")}):null]})}const AHt=new Set(["active","available","creating","disabled","enabled","failed","inactive","pending","published","ready","released","running","success","unavailable","unreleased","updating"]);function b6e(e,t){const n=(e||"").trim().toLowerCase();return AHt.has(n)?t(`skillCenter.status.${n}`):t("skillCenter.status.unknown")}function _Ht(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)||t==="running"?"is-positive":["creating","pending","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function jHt(e,t){if(!e)return"";const n=e.trim(),i=Number(n),r=/^\d+(?:\.\d+)?$/.test(n)?new Date(i<1e12?i*1e3:i):new Date(n);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat(t,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function lse(e){if(!e)return 0;const t=e.trim(),n=Number(t),i=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(i.getTime())?0:i.getTime()}function Pc(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function NHt(e,t){const n=new Map(e.map(i=>[Pc(i),i]));for(const i of t)n.set(Pc(i),i);return[...n.values()].sort((i,r)=>lse(r.updatedAt)-lse(i.updatedAt))}function RHt(e){const t=e.replace(/\r\n/g,` `);if(!t.startsWith(`--- `))return e;const n=t.indexOf(` --- -`,4);return n>=0?t.slice(n+5).trimStart():e}function y6e(e,t){const n=(e||"").trim();return!n||[">",">-","|","|-"].includes(n)?t("common.noDescription"):n}function NHt(){return a.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:a.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function RHt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function cse({direction:e}){return a.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:a.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function IHt(){return a.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function PHt({page:e,total:t,pageSize:n,onPage:i}){const{t:r}=Ae("ui"),s=Math.max(1,Math.ceil(t/n));return a.jsxs("footer",{className:"skillcenter-pager",children:[a.jsx("span",{children:r("skillCenter.totalItems",{count:t})}),a.jsxs("div",{className:"skillcenter-pager-actions",children:[a.jsx("button",{type:"button",onClick:()=>i(e-1),disabled:e<=1,"aria-label":r("common.previousPage"),children:a.jsx(cse,{direction:"left"})}),a.jsxs("span",{children:[e," / ",s]}),a.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":r("common.nextPage"),children:a.jsx(cse,{direction:"right"})})]})]})}function DHt({children:e}){return a.jsx("div",{className:"skillcenter-empty",children:e})}function o4({kind:e,title:t,description:n,error:i,action:r}){return a.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Title,{children:t}),n?a.jsx(Pn.Description,{children:n}):null,i?a.jsx(ms,{error:i}):null,r?a.jsx(Pn.ActionRow,{children:a.jsx(Dt,{color:"secondary",size:"lg",onClick:r.onClick,children:r.label})}):null]})})}function use({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:i}){const{t:r}=Ae("ui");return a.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[a.jsxs("div",{className:"skillcenter-space-errors__content",children:[a.jsx("strong",{children:r(n?"skillCenter.cannotLoadSpaces":"skillCenter.someSpacesFailed")}),e.map(({region:s,error:o})=>a.jsxs("section",{children:[a.jsx("span",{children:If(s,t)}),a.jsx(ms,{error:o})]},s))]}),a.jsx("button",{type:"button",onClick:i,children:r("common.reload")})]})}function MHt({skill:e,space:t,region:n,cloudProvider:i,detail:r,files:s,loading:o,error:l,canOptimize:c,reviews:u,reviewsLoading:d,reviewsError:f,onOptimize:h,onDownload:m,onClose:g}){const{t:b}=Ae("ui"),[v,y]=p.useState("files");return p.useEffect(()=>{const x=w=>{w.key==="Escape"&&g()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[g]),a.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:g,children:a.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:x=>x.stopPropagation(),children:[a.jsxs("header",{className:"skill-detail-head",children:[a.jsx("div",{className:"skill-detail-heading",children:a.jsxs("div",{children:[a.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),a.jsx("p",{children:y6e((r==null?void 0:r.description)||e.skillDescription,b)})]})}),a.jsxs("div",{className:"skill-detail-actions",children:[a.jsx("button",{type:"button",onClick:m,disabled:s.length===0,children:b("skillCenter.downloadZip")}),t.isShared?null:a.jsx(DR,{disabled:!c,placement:"bottom",children:a.jsx("button",{type:"button",onClick:h,disabled:!c,children:b("skillCenter.optimize")})}),a.jsx("button",{type:"button",className:"skill-detail-close",onClick:g,"aria-label":b("skillCenter.closeSkillDetails"),children:a.jsx(NHt,{})})]})]}),a.jsxs("dl",{className:"skill-detail-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.skillId")}),a.jsx("dd",{title:e.skillId,children:e.skillId})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("agentSelector.version")}),a.jsx("dd",{children:e.sourceVersion||(r==null?void 0:r.version)||e.version||"—"})]}),e.author?a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.author")}),a.jsx("dd",{children:e.author})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:b("agentSelector.status")}),a.jsx("dd",{children:b6e(e.skillStatus,b)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.skillSpace")}),a.jsx("dd",{title:rc(t),children:t.isShared?b("skillCenter.sharedSpace"):rc(t)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("myAgents.region")}),a.jsx("dd",{children:If(n,i)})]})]}),a.jsx(Xy,{className:"skill-detail-tabs",idPrefix:"skill-detail",ariaLabel:b("skillCenter.skillDetailSections"),value:v,items:[{id:"files",label:b("skillCenter.allFiles"),panelId:"skill-detail-panel"},{id:"reviews",label:b("skillCenter.reviewHistory"),panelId:"skill-detail-panel"}],onChange:y}),a.jsx("div",{className:`skill-detail-content${v==="files"?" skill-detail-content--files":" skill-detail-content--reviews"}`,id:"skill-detail-panel",role:"tabpanel","aria-labelledby":`skill-detail-${v}-tab`,children:v==="reviews"?d?a.jsx(Fa,{}):f?a.jsx("div",{role:"alert",children:a.jsx(ms,{error:f})}):a.jsx(BH,{applications:u}):o?a.jsxs("div",{className:"skillcenter-loading",children:[a.jsx(IHt,{}),b("skillCenter.loadingSkillContent")]}):l?a.jsx("div",{className:"skillcenter-error",children:a.jsx(ms,{error:l})}):s.length>0?a.jsx(jD,{files:s.map(x=>x.path.endsWith("SKILL.md")&&x.content?{...x,content:jHt(x.content)}:x)}):a.jsx(DHt,{children:b("skillCenter.noSkillContent")})})]})})}function LHt({space:e,canUseSandbox:t,onUpload:n,onSandbox:i,onClose:r}){const{t:s}=Ae("ui");return p.useEffect(()=>{const o=l=>{l.key==="Escape"&&r()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]),a.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:r,children:a.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("h2",{id:"skill-add-dialog-title",children:s("skillCenter.addSkill")}),a.jsx("p",{title:rc(e),children:rc(e)})]}),a.jsx("button",{type:"button",onClick:r,children:s("common.cancel")})]}),a.jsxs("div",{className:"skill-add-dialog__options",children:[a.jsxs("button",{type:"button",onClick:n,children:[a.jsx("strong",{children:s("skillCenter.localUpload")}),a.jsx("span",{children:s("skillCenter.localUploadDescription")})]}),a.jsx(DR,{disabled:!t,placement:"inside",children:a.jsxs("button",{type:"button",disabled:!t,onClick:i,children:[a.jsx("strong",{children:s("skillCenter.autoCreate")}),a.jsx("span",{children:s("skillCenter.autoCreateDescription")})]})})]})]})})}function $Ht({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:i=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:s,onPageTitleChange:o,toolbarLeading:l,toolbarFilters:c}){var ir;const{t:u,i18n:d}=Ae("ui"),f=p.useMemo(()=>[t],[t]),[h,m]=p.useState([]),[g,b]=p.useState(null),[v,y]=p.useState([]),x=p.useMemo(()=>d6e(v),[v]),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(!1),R=p.useRef(""),_=p.useRef(!1),[j,T]=p.useState({}),[N,A]=p.useState(!1),[P,D]=p.useState(""),[M,L]=p.useState((r==null?void 0:r.space)??null),U=p.useRef(M);U.current=M;const[I,H]=p.useState([]),[K,F]=p.useState(1),[W,V]=p.useState(0),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ce,Ee]=p.useState(!1),[Y,G]=p.useState(""),[te,ye]=p.useState("overview"),[Ne,pe]=p.useState(null),[me,se]=p.useState(null),[Se,Le]=p.useState(null),[be,Ve]=p.useState([]),[ve,Re]=p.useState(!1),[ne,ge]=p.useState(null),[Ce,ke]=p.useState(null),[Ke,it]=p.useState(!1),[ue,xe]=p.useState(null),[Te,qe]=p.useState(null),[De,At]=p.useState(null),[It,lt]=p.useState(0),[Ot,Ct]=p.useState(0),[dt,yt]=p.useState(""),[Ie,vt]=p.useState(""),[jt,Nt]=p.useState(null),[ln,He]=p.useState(r),Me=p.useRef(0),We=p.useRef(0),gt=p.useRef(!1),st=p.useRef(null),xt=p.useRef(null),ft=p.useRef(null),Ht=p.useDeferredValue(P),cn=p.useDeferredValue(Y),hn=ln&&(M||ln.selectPublishSpace)?ln.operation==="create"?u("skillCenter.createSkill"):u("skillCenter.optimizeNamed",{name:((ir=ln.source)==null?void 0:ir.name)||u("skillCenter.skill")}):"",Ge=M!=null&&M.isShared?u("skillCenter.sharedSpace"):rc(M),bt=!(M!=null&&M.isShared)||M.canWrite===!0,St=hn||Ge||u("skillCenter.library");p.useEffect(()=>{n&&(o==null||o(St))},[n,o,St]),p.useEffect(()=>{r&&(s==null||s())},[r,s]);const dn=p.useMemo(()=>{const ze=Ht.trim().toLocaleLowerCase(),kt=h.filter(nn=>!nn.isShared);return ze?kt.filter(nn=>`${rc(nn)} ${nn.name} ${nn.description||""} ${nn.projectName||""}`.toLocaleLowerCase().includes(ze)):kt},[Ht,h]),Rt=p.useMemo(()=>{const ze=cn.trim().toLocaleLowerCase();return ze?I.filter(kt=>`${kt.skillName} ${kt.skillDescription||""}`.toLocaleLowerCase().includes(ze)):I},[cn,I]),$e=(M==null?void 0:M.region)||Ki(e);p.useEffect(()=>{if(!n||!M)return;const ze=()=>Ct(nn=>nn+1),kt=()=>{document.visibilityState==="visible"&&ze()};return window.addEventListener("focus",ze),document.addEventListener("visibilitychange",kt),()=>{window.removeEventListener("focus",ze),document.removeEventListener("visibilitychange",kt)}},[n,M==null?void 0:M.id]),p.useEffect(()=>{const ze=M?`${$e}:${M.id}`:"";if(R.current!==ze&&(R.current=ze,y([]),O(null),se(null)),k(null),E(!1),!n||!M||M.isShared)return;const kt=new AbortController;return E(!0),wPt({spaceId:M.id,region:$e,signal:kt.signal}).then(nn=>{kt.signal.aborted||y(nn.items)}).catch(nn=>{kt.signal.aborted||k(vr(nn,u("skillCenter.reviewStatusFailed")))}).finally(()=>{kt.signal.aborted||E(!1)}),()=>kt.abort()},[M==null?void 0:M.id,M==null?void 0:M.isShared,$e,Ot,n,i,u]);const ot=p.useMemo(()=>f.flatMap(ze=>{var nn;const kt=(nn=j[ze])==null?void 0:nn.error;return kt?[{region:ze,error:kt}]:[]}),[j,f]),vn=f.some(ze=>{const kt=j[ze];return!!(kt&&!kt.done&&!kt.error)}),Ye=ot.length===f.length;p.useEffect(()=>{const ze=new AbortController;return KP(ze.signal).then(ke).catch(()=>ke({enabled:!1,reason:u("skillCenter.adminNotConfigured"),operations:["create","optimize"],models:[],styles:{}})),()=>ze.abort()},[u]);const mt=p.useCallback(async(ze,kt)=>{var $r;if(gt.current||ze.length===0)return;gt.current=!0,A(!0),kt&&(($r=st.current)==null||$r.abort(),m([]),T(Object.fromEntries(ze.map(({region:qn})=>[qn,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const nn=new AbortController;st.current=nn;const Nn=++We.current,re=await Promise.allSettled(ze.map(async({region:qn,page:oi})=>({region:qn,page:oi,result:await pPt({region:qn,page:oi,pageSize:EHt,signal:nn.signal})})));if(We.current!==Nn)return;const xi=re.map((qn,oi)=>{const Vi=ze[oi];return qn.status==="rejected"?{request:Vi,error:vr(qn.reason,u("skillCenter.errors.loadSpaces")),items:[],totalCount:0,scannedCount:0}:{request:Vi,error:null,items:(qn.value.result.items||[]).map(Fr=>({...Fr,region:Fr.region||qn.value.region})),totalCount:qn.value.result.totalCount||0,scannedCount:qn.value.result.scannedCount??qn.value.result.items.length}}),is=xi.flatMap(qn=>qn.items);T(qn=>{const oi={...qn};return xi.forEach(({request:Vi,error:Fr,scannedCount:ea,totalCount:za})=>{const Hr=oi[Vi.region]||{nextPage:Vi.page,loadedCount:0,done:!1,error:null};if(Fr){oi[Vi.region]={...Hr,error:Fr};return}const vo=Hr.loadedCount+ea;oi[Vi.region]={nextPage:Vi.page+1,loadedCount:vo,done:ea===0||vo>=za,error:null}}),oi}),m(qn=>_Ht(kt?[]:qn,is)),L(qn=>qn&&(is.find(oi=>Pc(oi)===Pc(qn))||qn)),gt.current=!1,A(!1)},[]),_n=p.useCallback(()=>{if(gt.current)return;const ze=f.flatMap(kt=>{const nn=j[kt];return nn&&!nn.done&&!nn.error?[{region:kt,page:nn.nextPage}]:[]});mt(ze,!1)},[mt,j,f]);p.useEffect(()=>{Hn(),L(null),H([]),F(1)},[e]),p.useEffect(()=>{if(n)return mt(f.map(ze=>({region:ze,page:1})),!0),()=>{var ze;We.current+=1,(ze=st.current)==null||ze.abort(),gt.current=!1}},[n,i,mt,f,It]),p.useEffect(()=>{const ze=ft.current,kt=xt.current;if(!ze||!kt||!vn||N)return;const nn=new IntersectionObserver(([Nn])=>{Nn.isIntersecting&&_n()},{root:kt,rootMargin:"240px 0px",threshold:.01});return nn.observe(ze),()=>nn.disconnect()},[vn,_n,N]);const Vt=()=>{const ze=xt.current;!ze||!vn||N||ze.scrollHeight-ze.scrollTop-ze.clientHeight<=240&&_n()};p.useEffect(()=>{if(!M){H([]),V(0),Ee(!1);return}let ze=!0;return ie(!0),Z(null),APt(M.id,{region:$e,page:K,pageSize:ase,project:M.projectName}).then(kt=>{ze&&(H(kt.items||[]),V(kt.totalCount||0),Ee(kt.degraded===!0))}).catch(kt=>{ze&&(H([]),V(0),Ee(!1),Z(vr(kt,u("skillCenter.errors.loadSkills"))))}).finally(()=>{ze&&ie(!1)}),()=>{ze=!1}},[$e,M,K,Ot,u]);const Ai=ze=>{Hn(),L(ze),ye("overview"),F(1),G("")},jn=()=>{Hn(),L(null),H([]),V(0),Ee(!1),ye("overview"),F(1),G(""),Nt(null)},Hn=()=>{Me.current+=1,pe(null),Le(null),Ve([]),ge(null),Re(!1)},En=async ze=>{if(!M)return;const kt=Db(ze),nn=Me.current+1;Me.current=nn,pe(ze),Le(null),ge(null),Re(!0);try{const[Nn,re]=await Promise.all([_Pt(M.id,kt,ze.version,$e,M.projectName,ze.skillName,M.name),GDe({spaceId:M.id,skillId:kt,version:ze.version,region:$e,skillSpaceName:M.name,skillName:ze.skillName})]);Me.current===nn&&(Le(Nn),Ve(re))}catch(Nn){Me.current===nn&&ge(vr(Nn,u("skillCenter.errors.loadSkillDetails")))}finally{Me.current===nn&&Re(!1)}},vi=ze=>{if(M)return{kind:"skill-center",skillId:Db(ze),version:ze.version,region:$e,projectName:M.projectName,skillSpaceId:M.id,skillSpaceName:M.name,name:ze.skillName,description:ze.skillDescription}},Fn=ze=>{const kt=vi(ze);!kt||!(Ce!=null&&Ce.enabled)||(Hn(),He({operation:"optimize",source:kt}))},di=async ze=>{if(!(!M||!window.confirm(u("skillCenter.deleteSkillConfirm",{name:ze.skillName})))){yt(ze.skillId),Nt(null);try{await CPt({spaceId:M.id,skillId:ze.skillId,region:$e}),Ct(kt=>kt+1),lt(kt=>kt+1)}catch(kt){Nt(vr(kt,u("skillCenter.errors.deleteSkill")))}finally{yt("")}}},wr=async ze=>{if(!window.confirm(u("skillCenter.deleteSpaceConfirm",{name:rc(ze)})))return;const kt=Pc(ze);vt(kt),Nt(null);try{await kPt({spaceId:ze.id,region:ze.region||Ki(e)}),M&&Pc(M)===kt&&jn(),lt(nn=>nn+1)}catch(nn){Nt(vr(nn,u("skillCenter.errors.deleteSpace")))}finally{vt("")}},mr=async(ze,kt=ze.version,nn=!1)=>{var xi,is,$r,qn;if(!M||_.current)return;const Nn=M,re=`${Nn.region}:${Nn.id}:${ze.skillId}:${kt}`;_.current=!0,b(re),Nt(null);try{const oi=await bPt({spaceId:Nn.id,skillId:ze.skillId,version:kt,region:Nn.region||$e});((xi=U.current)==null?void 0:xi.id)===Nn.id&&((is=U.current)==null?void 0:is.region)===Nn.region&&y(Vi=>[...Vi.filter(Fr=>Fr.id!==oi.id),oi])}catch(oi){if(nn)throw vr(oi,u("skillCenter.reviewFailed"));(($r=U.current)==null?void 0:$r.id)===Nn.id&&((qn=U.current)==null?void 0:qn.region)===Nn.region&&Nt(vr(oi,u("skillCenter.reviewFailed")))}finally{_.current=!1,b(null)}};return ln&&(M||ln.selectPublishSpace)?a.jsx(tHt,{operation:ln.operation,cloudProvider:e,space:M??void 0,availableSpaces:h.filter(ze=>!ze.isShared),spacesLoading:N,initialIntent:ln.initialIntent,source:ln.source,onBack:()=>He(null),onPublished:()=>{Ct(ze=>ze+1),lt(ze=>ze+1)}}):a.jsxs("section",{className:`skillcenter${M?" is-space":" resource-collection"}`,children:[M?a.jsx(LC,{className:"skillcenter-detail",title:Ge||M.name,description:M.isShared?u("skillCenter.sharedDescription"):M.description||u("skillCenter.manageSpaceDescription"),identitySeed:M.name,backLabel:u("skillCenter.backToSpaces"),onBack:jn,sections:[{key:"overview",label:u("skillCenter.overview"),content:a.jsxs(a.Fragment,{children:[jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,S?a.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[a.jsx(ms,{error:S}),a.jsx("button",{type:"button",onClick:()=>Ct(ze=>ze+1),children:u("common.reload")})]}):null,a.jsx("section",{className:"skillcenter-overview",children:a.jsxs(Oz,{className:"skillcenter-detail-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:u("skillCenter.skillCount")}),a.jsx("dd",{children:W})]}),a.jsxs("div",{children:[a.jsx("dt",{children:u("skillCenter.updatedAt")}),a.jsx("dd",{children:M.updatedAt?AHt(M.updatedAt,d.resolvedLanguage??d.language):"—"})]})]})})]})},{key:"skills",label:u("skillCenter.skills"),content:a.jsxs(a.Fragment,{children:[jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,S?a.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[a.jsx(ms,{error:S}),a.jsx("button",{type:"button",onClick:()=>Ct(ze=>ze+1),children:u("common.reload")})]}):null,a.jsxs("section",{className:"skillcenter-results","aria-label":u("skillCenter.skillsInSpace",{name:Ge||M.name}),children:[a.jsx(HRe,{title:u("skillCenter.skills"),description:u("skillCenter.totalItems",{count:W}),actions:a.jsxs(a.Fragment,{children:[a.jsx(hp,{"aria-label":u("skillCenter.searchSkills"),value:Y,onChange:ze=>G(ze.target.value),placeholder:u("skillCenter.searchSkills")}),a.jsx(Dt,{color:"secondary",variant:"outline",size:"sm",pill:!1,disabled:X||C,onClick:()=>Ct(ze=>ze+1),children:u("common.refresh")})]})}),ce?a.jsx("div",{className:"skillcenter-inline-warning",role:"status",children:u("skillCenter.degradedRelationWarning")}):null,X&&I.length===0?a.jsx(Fa,{}):Q&&I.length===0?a.jsx(o4,{kind:"error",title:u("skillCenter.cannotLoadSkills"),error:Q,action:{label:u("common.reload"),onClick:()=>Ct(ze=>ze+1)}}):Rt.length===0?a.jsx(o4,{kind:"empty",title:Y.trim()?u("skillCenter.noMatchingSkills"):u("skillCenter.noSkills"),description:Y.trim()?u("skillCenter.tryAnotherName"):u(M.isShared?"skillCenter.sharedEmpty":"skillCenter.emptySkillsDescription"),action:!Y.trim()&&bt?{label:u("skillCenter.localUpload"),onClick:()=>At(M)}:void 0}):a.jsx("div",{className:"skillcenter-table-wrap",children:a.jsxs("table",{className:"skillcenter-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:u("skillCenter.skills")}),a.jsx("th",{scope:"col",children:u("agentSelector.status")}),a.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:u("skillCenter.actions")})]})}),a.jsx("tbody",{children:Rt.map(ze=>{const kt=x.get(`${ze.skillId}:${ze.version}`);return a.jsxs("tr",{children:[a.jsx("td",{className:"skillcenter-table__skill",children:a.jsxs("button",{type:"button",onClick:()=>void En(ze),children:[a.jsxs("span",{className:"skillcenter-table__title-row",children:[a.jsx("strong",{title:ze.skillName,children:ze.skillName}),ze.version?a.jsx("span",{className:"skillcenter-table__version-badge",children:ze.sourceVersion||ze.version}):null]}),a.jsx("span",{className:"skillcenter-table__description",children:y6e(ze.skillDescription,u)}),M.isShared&&ze.author?a.jsx("span",{className:"skillcenter-table__author",children:u("skillCenter.authorName",{name:ze.author})}):null]})}),a.jsx("td",{children:a.jsxs("div",{className:"skillcenter-review-status",children:[a.jsx("span",{className:`skillcenter-status ${THt(ze.skillStatus)}`,children:b6e(ze.skillStatus,u)}),kt?a.jsx(fT,{status:kt.status}):null,kt!=null&&kt.reviewer||kt!=null&&kt.reviewedBy?a.jsx($H,{compact:!0,person:kt.reviewer,fallback:kt.reviewedBy}):null]})}),a.jsx("td",{children:a.jsxs("div",{className:"skillcenter-table__actions",children:[a.jsx("button",{type:"button",onClick:()=>void En(ze),children:u("common.view")}),!ze.lookupByName&&ze.skillId?a.jsx("button",{type:"button",onClick:()=>se(ze),children:u("skillCenter.versions.title")}):null,!M.isShared&&!ze.lookupByName&&ze.skillId?a.jsx("button",{type:"button",disabled:C||S!==null||g!==null||kt!==void 0&&kt.status!=="returned",onClick:()=>void mr(ze),children:g===`${M.region}:${M.id}:${ze.skillId}:${ze.version}`?u("skillCenter.reviewSubmitting"):u(kt?{pending:"skillCenter.reviewPending",approving:"skillCenter.reviewApproving",approved:"skillCenter.reviewApproved",returned:"skillCenter.reviewRetry"}[kt.status]:"skillCenter.requestPublication")}):null,v.some(nn=>nn.sourceSkillId===ze.skillId)?a.jsx("button",{type:"button",onClick:()=>O(ze),children:u("skillCenter.reviewHistory")}):null,M.isShared?null:a.jsx(DR,{disabled:!(Ce!=null&&Ce.enabled),children:a.jsx("button",{type:"button",disabled:!(Ce!=null&&Ce.enabled),onClick:()=>Fn(ze),children:u("skillCenter.optimize")})}),!ze.lookupByName&&bt?a.jsx("button",{type:"button",className:"is-danger",disabled:dt===ze.skillId,onClick:()=>void di(ze),children:dt===ze.skillId?u("common.deleting"):u("common.delete")}):null]})})]},`${Db(ze)}:${ze.version}`)})})]})}),!Y.trim()&&!X&&!Q&&W>0?a.jsx(PHt,{page:K,total:W,pageSize:ase,onPage:F}):null]})]})}],activeSectionKey:te,navigationLabel:u("skillCenter.spaceDetails"),onSectionChange:ze=>ye(ze),actionsClassName:"skillcenter-toolbar-actions",actions:a.jsxs(a.Fragment,{children:[M.isShared?null:a.jsxs(a.Fragment,{children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>xe(M),children:u("skillCenter.editSpace")}),a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:Ie===Pc(M),onClick:()=>void wr(M),children:Ie===Pc(M)?u("common.deleting"):u("skillCenter.deleteSpace")})]}),bt?a.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>At(M),children:u("skillCenter.localUpload")}):null,M.isShared?null:a.jsx(DR,{disabled:!(Ce!=null&&Ce.enabled),children:a.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(Ce!=null&&Ce.enabled),onClick:()=>He({operation:"create"}),children:[a.jsx(xAe,{"aria-hidden":"true"}),a.jsx("span",{children:u("skillCenter.createSkill")})]})})]})}):a.jsxs(a.Fragment,{children:[a.jsxs(Gy,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,a.jsxs("div",{className:"resource-toolbar__actions",children:[c,a.jsx(hp,{"aria-label":u("skillCenter.searchSpaces"),value:P,onChange:ze=>D(ze.target.value),placeholder:u("skillCenter.searchSpaces")})]})]}),jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,a.jsxs(Rg,{className:"skillcenter-list-results",ref:xt,"aria-label":u("skillCenter.spaceList"),onScroll:Vt,children:[ot.length>0&&!Ye?a.jsx(use,{errors:ot,cloudProvider:e,onRetry:()=>lt(ze=>ze+1)}):null,a.jsxs(Yy,{children:[a.jsx(xHt,{region:t,active:n,revision:It+i,onOpen:Ai},`${e}:${t}`),P.trim()?null:a.jsx(ug,{"aria-label":u("skillCenter.createSpace"),icon:a.jsx(RHt,{}),onClick:()=>it(!0),children:u("skillCenter.newSpace")}),dn.map(ze=>{const kt=Pc(ze);return a.jsx(Jy,{className:"skillcenter-space-card",title:rc(ze),description:ze.description||u("common.noDescription"),metadata:[{label:u("skillCenter.skillCount"),value:u("skillCenter.skillCountValue",{count:ze.skillCount??0})},{label:u("skillCenter.updatedAt"),value:LD(ze.updatedAt,Date.now(),d.resolvedLanguage??d.language)}],action:{label:u("skillCenter.addSkill"),icon:"plus",onClick:()=>qe(ze)},detailAction:{label:u("common.viewDetails"),onClick:()=>Ai(ze)}},kt)})]}),N&&h.length===0?a.jsx(Fa,{}):Ye&&h.length===0?a.jsx(use,{errors:ot,cloudProvider:e,fullPage:!0,onRetry:()=>lt(ze=>ze+1)}):dn.length===0&&P.trim()?a.jsx(o4,{kind:"empty",title:u("skillCenter.noMatchingSpaces"),description:u("skillCenter.tryAnotherName")}):null,!Ye&&h.length>0?a.jsx("div",{className:"my-agent-load-more",ref:ft,"aria-live":"polite",children:N?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:u("skillCenter.loadingMoreSpaces")})]}):vn?a.jsx("span",{children:u("skillCenter.scrollForMore")}):ot.length>0?a.jsx("span",{children:u("skillCenter.someSpacesFailed")}):a.jsx("span",{children:u("skillCenter.allSpacesLoaded")})}):null]})]}),me&&M?a.jsx(vHt,{skill:me,space:M,region:$e,reviews:v.filter(ze=>ze.sourceSkillId===me.skillId),onClose:()=>se(null),onChanged:()=>Ct(ze=>ze+1),onSubmitReview:!M.isShared&&!C&&!S?ze=>mr(me,ze,!0):void 0},`${$e}:${M.id}:${me.skillId}`):null,w?a.jsx(yHt,{name:w.skillName,applications:v.filter(ze=>ze.sourceSkillId===w.skillId),onClose:()=>O(null)}):null,Ne&&M&&a.jsx(MHt,{skill:Ne,space:M,region:$e,cloudProvider:e,detail:Se,files:be,loading:ve,error:ne,reviews:v.filter(ze=>ze.sourceSkillId===Ne.skillId),reviewsLoading:C,reviewsError:S,canOptimize:!M.isShared&&(Ce==null?void 0:Ce.enabled)===!0,onOptimize:()=>Fn(Ne),onDownload:()=>void TPt({spaceId:M.id,skillId:Db(Ne),version:Ne.version,region:$e,fallbackName:Ne.skillName,skillSpaceName:M.name,skillName:Ne.skillName}).catch(ze=>ge(vr(ze,u("skillCenter.errors.downloadSkill")))),onClose:Hn}),Ke?a.jsx(wHt,{region:t,regionOptions:Jc(e),onClose:()=>it(!1),onCreated:ze=>{it(!1),lt(kt=>kt+1),L({...ze,region:ze.region||t})}}):null,ue?a.jsx(OHt,{space:ue,region:ue.region||Ki(e),onClose:()=>xe(null),onUpdated:ze=>{const kt={...ze,region:ze.region||ue.region||Ki(e)};xe(null),L(nn=>nn&&Pc(nn)===Pc(kt)?kt:nn),m(nn=>nn.map(Nn=>Pc(Nn)===Pc(kt)?kt:Nn)),lt(nn=>nn+1)}}):null,Te?a.jsx(LHt,{space:Te,canUseSandbox:(Ce==null?void 0:Ce.enabled)===!0,onClose:()=>qe(null),onUpload:()=>{At(Te),qe(null)},onSandbox:()=>{const ze=Te;qe(null),Ai(ze),He({operation:"create"})}}):null,De?a.jsx(kHt,{space:De,region:De.region||Ki(e),onClose:()=>At(null),onUploaded:()=>{At(null),Ct(ze=>ze+1),lt(ze=>ze+1)}}):null]})}function FHt(e){return[{id:"skills",label:e("library.tabs.skills"),panelId:"library-skills-panel"},{id:"knowledge",label:e("library.tabs.knowledge"),panelId:"library-knowledge-panel"},{id:"artifacts",label:e("library.tabs.artifacts"),panelId:"library-artifacts-panel"}]}function BHt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:i,onPageTitleChange:r,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:o,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const{t:f,i18n:h}=Ae("workspaceTools"),m=p.useMemo(()=>FHt(f),[f]),g=f("library.tabs.skills"),b=_I(t)?t:Ki(e),[v,y]=p.useState(b),[x,w]=p.useState(g),O=p.useRef(g),[S,k]=p.useState(!1),[C,E]=p.useState(()=>new Set(["skills",n])),[R,_]=p.useState({skills:0,knowledge:0,artifacts:0}),j=p.useRef(u),[T,N]=p.useState([]),[A,P]=p.useState(!1),[D,M]=p.useState(""),L=p.useMemo(()=>{const ie=Mwt(l,f("library.untitledSession"));return{key:JSON.stringify(ie),candidates:ie}},[l,f]),U=p.useRef(L);U.current.key!==L.key&&(U.current=L);const I=U.current.candidates,H=p.useMemo(()=>Jc(e),[e]);p.useEffect(()=>{y(b)},[b]),p.useEffect(()=>{const ie=O.current;w(Q=>Q===ie?g:Q),O.current=g},[g]),p.useEffect(()=>{j.current=u},[u]),p.useEffect(()=>{E(ie=>{if(ie.has(n))return ie;const Q=new Set(ie);return Q.add(n),Q})},[n]),p.useEffect(()=>{var Q;const ie=n==="skills"?x:((Q=m.find(Z=>Z.id===n))==null?void 0:Q.label)||f("library.title");r==null||r(ie)},[n,r,x,f,m]),p.useEffect(()=>{var ie;n==="artifacts"&&((ie=j.current)==null||ie.call(j))},[n,R.artifacts]);const K=p.useCallback(async()=>{P(!0),M("");try{N(await Hwt(I))}catch(ie){M(ie instanceof Error?ie.message:String(ie))}finally{P(!1)}},[I]);p.useEffect(()=>{n==="artifacts"&&K()},[n,R.artifacts,K]);const F=ie=>{E(Q=>{if(Q.has(ie))return Q;const Z=new Set(Q);return Z.add(ie),Z}),_(Q=>({...Q,[ie]:Q[ie]+1})),i(ie)},W=a.jsx(Xy,{idPrefix:"library",ariaLabel:f("library.categoryAria"),value:n,items:m,onChange:F}),V=ie=>a.jsx(cg,{id:ie,ariaLabel:f("library.regionAria"),value:v,options:H,onChange:y}),X=n==="skills"?x!==g:n==="knowledge"&&S;return a.jsxs(Df,{className:`library-view${X?" is-detail":""}`,"aria-label":f("library.title"),children:[X?null:a.jsx(Ky,{className:"library-view__header",title:f("library.title")}),a.jsxs("div",{className:"library-panels",children:[C.has("skills")?a.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:a.jsx($Ht,{cloudProvider:e,region:v,active:n==="skills",activationRevision:R.skills,onPageTitleChange:w,initialWorkspace:s,onInitialWorkspaceConsumed:o,toolbarLeading:W,toolbarFilters:V("library-skills-region-filter")})}):null,C.has("knowledge")?a.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:a.jsx(ZIt,{cloudProvider:e,region:v,active:n==="knowledge",activationRevision:R.knowledge,onDetailChange:k,toolbarLeading:W,toolbarFilters:V("library-knowledge-region-filter")})}):null,C.has("artifacts")?a.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:a.jsx(Qwt,{items:T,region:v,userId:c,active:n==="artifacts",activationRevision:R.artifacts,loading:A,error:D?Fu(D,h.resolvedLanguage||h.language)||f("artifactLibrary.loadDetailFallback"):"",onRetry:()=>void K(),onEdit:qwt,onDelete:Wwt,onDownload:Kwt,onOpenSource:d?ie=>d(ie.appName,ie.sessionId):void 0,toolbarLeading:W,toolbarFilters:V("library-artifacts-region-filter")})}):null]})]})}const v6e="veadk_agentkit_connections",UHt=3e3,dse=6e4;function yd(){try{const e=localStorage.getItem(v6e);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function $D(e){try{localStorage.setItem(v6e,JSON.stringify(e))}catch{}}function _d(e,t){return`agentkit:${e}:${t}`}function x6e(e){try{return new URL(e).host}catch{return e}}function g1(e){YSe();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)XSe(_d(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function w6e(e,t,n,i,r,s){const o={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:r,currentVersion:s},l=yd(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(o):l[c]=o,$D(l),g1(l),o}async function QHt(e,t,n,i,r){let s=null,o=n||"cn-beijing",l=null;for(const f of uC(n))try{const h=await Vx(e,f,{retryProbe:!0,preferCached:!0,currentVersion:i});if(h&&h.length>0){await pCe(e,f),s=h,o=f;break}}catch(h){if(h instanceof Lw)throw MR(e),h;if(h instanceof co&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw MR(e),l||new co(z("connections.runtimeUnsupported"),!0,!0);const c=(r==null?void 0:r.trim())||s[0],u=Object.fromEntries(s.map(f=>[f,f===s[0]?c:f])),d=w6e(e,t,o,s,u,i);return _d(d.id,s[0])}function zHt(e){return new Promise(t=>window.setTimeout(t,e))}async function mj(e,t,n,i,r={}){const s=Date.now();for(;;)try{return await QHt(e,t,n,i,r.agentName)}catch(o){const l=Date.now()-s;if(!r.waitForReady||!(o instanceof co)||!o.retryable||l>=dse)throw o;const c=Math.min(UHt,dse-l);await zHt(c)}}async function O6e(e,t,n,i){const r=t.trim().replace(/\/+$/,""),s=await dC(r,n.trim()),o={id:Date.now().toString(36),name:e.trim()||x6e(r),base:r,apiKey:n.trim(),apps:s,appLabels:i&&s.length>0?{[s[0]]:i}:void 0},l=[...yd().filter(c=>c.base!==r),o];return $D(l),g1(l),o}function VHt(e){const t=yd().filter(n=>n.id!==e);return $D(t),g1(t),t}function MR(e){const t=yd().filter(n=>n.runtimeId!==e);return $D(t),g1(t),t}function k6e(e,t){const n=e.map(r=>({id:r,label:r,app:r,remote:!1})),i=t.flatMap(r=>r.apps.map(s=>{var l;const o=((l=r.appLabels)==null?void 0:l[s])??s;return{id:_d(r.id,s),label:o,app:s,remote:!0,host:r.runtimeId?r.name:x6e(r.base??""),runtimeId:r.runtimeId,region:r.region,currentVersion:r.currentVersion}}));return[...n,...i]}const fse=Object.freeze(Object.defineProperty({__proto__:null,addConnection:O6e,addRuntimeConnection:w6e,buildAgentEntries:k6e,connectRuntime:mj,loadConnections:yd,registerConnections:g1,remoteAppId:_d,removeConnection:VHt,removeRuntimeConnection:MR},Symbol.toStringTag,{value:"Module"}));function HHt({onAdded:e,onCancel:t}){const{t:n}=Ae("conversation"),[i,r]=p.useState(""),[s,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(!1),[f,h]=p.useState(""),m=i.trim().length>0&&s.trim().length>0&&!u;async function g(){if(m){d(!0),h("");try{const b=await O6e(l,i,s,l);if(b.apps.length===0){h(n("addAgentKit.noAgents")),d(!1);return}e(_d(b.id,b.apps[0]))}catch(b){h(n("addAgentKit.connectionFailed",{error:String(b)})),d(!1)}}}return a.jsx("div",{className:"addagent",children:a.jsxs("div",{className:"addagent-card",children:[a.jsx("h2",{className:"addagent-title",children:n("addAgentKit.title")}),a.jsx("p",{className:"addagent-sub",children:n("addAgentKit.description")}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:n("addAgentKit.url")}),a.jsx("input",{className:"addagent-input",value:i,onChange:b=>r(b.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:"API Key"}),a.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:b=>o(b.target.value),placeholder:n("addAgentKit.apiKeyHint")})]}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:n("addAgentKit.displayName")}),a.jsx("input",{className:"addagent-input",value:l,onChange:b=>c(b.target.value),placeholder:n("addAgentKit.displayNameHint")})]}),f&&a.jsx("div",{className:"addagent-error",children:f}),a.jsxs("div",{className:"addagent-actions",children:[a.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:u,children:n("addAgentKit.cancel")}),a.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:g,disabled:!m,children:[u?a.jsx(Ei,{className:"icon spin"}):null,n(u?"addAgentKit.connecting":"addAgentKit.connect")]})]})]})})}const qHt=/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u,WHt={"deploy.build.logs_syncing":"client.deploymentProgress.buildLogsSyncing","deploy.build.logs_complete":"client.deploymentProgress.buildLogsComplete","deploy.build.failed_logs_synced":"client.deploymentProgress.buildFailedLogsSynced","deploy.build.logs_unavailable":"client.deploymentProgress.buildLogsUnavailable","deploy.build.final_logs_unavailable":"client.deploymentProgress.finalBuildLogsUnavailable"},KHt={prepare:"client.deploymentProgress.preparing",upload:"client.deploymentProgress.uploading",build:"client.deploymentProgress.building",deploy:"client.deploymentProgress.deploying",publish:"client.deploymentProgress.publishing",evaluation:"client.deploymentProgress.evaluating",update:"client.deploymentProgress.updating",complete:"client.deploymentProgress.completing",github:"client.deploymentProgress.github"};function FD(e){var r,s;const t=((r=e.message)==null?void 0:r.trim())??"",n=e.messageCode?WHt[e.messageCode]:void 0;if(n)return z(n);if(t&&(k6().toLowerCase()==="zh-cn"||!qHt.test(t)))return t;if(e.phase==="build"&&((s=e.buildLog)!=null&&s.status)){const o={running:"client.deploymentProgress.buildLogsSyncing",complete:"client.deploymentProgress.buildLogsComplete",error:"client.deploymentProgress.buildLogsUnavailable"}[e.buildLog.status];if(o)return z(o)}const i=e.phase?KHt[e.phase]:void 0;return i?z(i):t||z("client.deploymentProgress.inProgress")}function GHt(e){return[{id:"case-1",itemKey:"case-1",kind:"good",input:e("agentWorkspace.defaultCases.weeklyFeedback.input"),output:e("agentWorkspace.defaultCases.weeklyFeedback.output"),referenceOutput:e("agentWorkspace.defaultCases.weeklyFeedback.output"),comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.goodSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.weeklyFeedback.tag"),source:"auto",score:.92,reason:e("agentWorkspace.defaultCases.weeklyFeedback.reason")},{id:"case-2",itemKey:"case-2",kind:"good",input:e("agentWorkspace.defaultCases.research.input"),output:e("agentWorkspace.defaultCases.research.output"),referenceOutput:e("agentWorkspace.defaultCases.research.output"),comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.goodSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.research.tag"),source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:e("agentWorkspace.defaultCases.uncertainConclusion.input"),output:e("agentWorkspace.defaultCases.uncertainConclusion.output"),referenceOutput:"",comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.badSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.uncertainConclusion.tag"),source:"auto",score:.28,reason:e("agentWorkspace.defaultCases.uncertainConclusion.reason")},{id:"case-4",itemKey:"case-4",kind:"bad",input:e("agentWorkspace.defaultCases.repeatedTool.input"),output:e("agentWorkspace.defaultCases.repeatedTool.output"),referenceOutput:"",comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.badSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.repeatedTool.tag"),source:"user"}]}const XHt=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],YHt={核心能力回归:"agentWorkspace.evaluationDefaults.coreRegression",安全与幻觉检查:"agentWorkspace.evaluationDefaults.safetyCheck",核心回归集:"agentWorkspace.evaluationDefaults.coreSet",安全边界集:"agentWorkspace.evaluationDefaults.safetySet",工具调用集:"agentWorkspace.evaluationDefaults.toolSet",综合质量评估器:"agentWorkspace.evaluationDefaults.qualityEvaluator",事实一致性评估器:"agentWorkspace.evaluationDefaults.factualEvaluator",工具调用评估器:"agentWorkspace.evaluationDefaults.toolEvaluator",回答质量:"agentWorkspace.evaluationDefaults.responseQuality",事实准确性:"agentWorkspace.evaluationDefaults.factualAccuracy",工具调用:"agentWorkspace.evaluationDefaults.toolUse",响应效率:"agentWorkspace.evaluationDefaults.responseEfficiency","今天 10:32":"agentWorkspace.evaluationDefaults.todayTime","昨天 16:08":"agentWorkspace.evaluationDefaults.yesterdayTime","7 月 25 日 14:20":"agentWorkspace.evaluationDefaults.julyTime",刚刚:"agentWorkspace.evaluationDefaults.justNow"};function ok(e,t){const n=YHt[e];return n?t(n):e}const hse=["basic","usage","evaluations","optimizations","integrations","versions"],ZHt=20;function JHt(e,t,n){const i=Date.parse(e);return Number.isNaN(i)?n("agentWorkspace.notProvided"):new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}const wO=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function a4(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function eqt(e,t){const n=e.trim();if(!n||!t)return n;try{const i=new URL(n),r=i.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(r))return n;const s=new URL(t);return i.protocol=s.protocol,i.hostname=s.hostname,i.port=s.port,i.toString()}catch{return n}}function pse(e,t){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":t(e==="none"?"agentWorkspace.noAuthentication":"agentWorkspace.notAvailable")}function mse(e,t){return t(e==="published"?"agentWorkspace.githubStatus.published":e==="publishing"?"agentWorkspace.githubStatus.publishing":e==="failed"?"agentWorkspace.githubStatus.failed":e==="pending"?"agentWorkspace.githubStatus.pending":"agentWorkspace.githubStatus.unknown")}function tqt(e,t){return e.changeType==="rollback"?t("agentWorkspace.rollbackEvent"):e.version}function $B(e){return JSON.stringify(e)}function S6e(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function y6e(e,t){const n=(e||"").trim();return!n||[">",">-","|","|-"].includes(n)?t("common.noDescription"):n}function IHt(){return a.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:a.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function PHt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function cse({direction:e}){return a.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:a.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function DHt(){return a.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function MHt({page:e,total:t,pageSize:n,onPage:i}){const{t:r}=Ae("ui"),s=Math.max(1,Math.ceil(t/n));return a.jsxs("footer",{className:"skillcenter-pager",children:[a.jsx("span",{children:r("skillCenter.totalItems",{count:t})}),a.jsxs("div",{className:"skillcenter-pager-actions",children:[a.jsx("button",{type:"button",onClick:()=>i(e-1),disabled:e<=1,"aria-label":r("common.previousPage"),children:a.jsx(cse,{direction:"left"})}),a.jsxs("span",{children:[e," / ",s]}),a.jsx("button",{type:"button",onClick:()=>i(e+1),disabled:e>=s,"aria-label":r("common.nextPage"),children:a.jsx(cse,{direction:"right"})})]})]})}function LHt({children:e}){return a.jsx("div",{className:"skillcenter-empty",children:e})}function o4({kind:e,title:t,description:n,error:i,action:r}){return a.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Title,{children:t}),n?a.jsx(Pn.Description,{children:n}):null,i?a.jsx(ms,{error:i}):null,r?a.jsx(Pn.ActionRow,{children:a.jsx(Dt,{color:"secondary",size:"lg",onClick:r.onClick,children:r.label})}):null]})})}function use({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:i}){const{t:r}=Ae("ui");return a.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[a.jsxs("div",{className:"skillcenter-space-errors__content",children:[a.jsx("strong",{children:r(n?"skillCenter.cannotLoadSpaces":"skillCenter.someSpacesFailed")}),e.map(({region:s,error:o})=>a.jsxs("section",{children:[a.jsx("span",{children:If(s,t)}),a.jsx(ms,{error:o})]},s))]}),a.jsx("button",{type:"button",onClick:i,children:r("common.reload")})]})}function $Ht({skill:e,space:t,region:n,cloudProvider:i,detail:r,files:s,loading:o,error:l,canOptimize:c,reviews:u,reviewsLoading:d,reviewsError:f,onOptimize:h,onDownload:m,onClose:g}){const{t:b}=Ae("ui"),[v,y]=p.useState("files");return p.useEffect(()=>{const x=w=>{w.key==="Escape"&&g()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[g]),a.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:g,children:a.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:x=>x.stopPropagation(),children:[a.jsxs("header",{className:"skill-detail-head",children:[a.jsx("div",{className:"skill-detail-heading",children:a.jsxs("div",{children:[a.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),a.jsx("p",{children:y6e((r==null?void 0:r.description)||e.skillDescription,b)})]})}),a.jsxs("div",{className:"skill-detail-actions",children:[a.jsx("button",{type:"button",onClick:m,disabled:s.length===0,children:b("skillCenter.downloadZip")}),t.isShared?null:a.jsx(DR,{disabled:!c,placement:"bottom",children:a.jsx("button",{type:"button",onClick:h,disabled:!c,children:b("skillCenter.optimize")})}),a.jsx("button",{type:"button",className:"skill-detail-close",onClick:g,"aria-label":b("skillCenter.closeSkillDetails"),children:a.jsx(IHt,{})})]})]}),a.jsxs("dl",{className:"skill-detail-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.skillId")}),a.jsx("dd",{title:e.skillId,children:e.skillId})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("agentSelector.version")}),a.jsx("dd",{children:e.sourceVersion||(r==null?void 0:r.version)||e.version||"—"})]}),e.author?a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.author")}),a.jsx("dd",{children:e.author})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:b("agentSelector.status")}),a.jsx("dd",{children:b6e(e.skillStatus,b)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("skillCenter.skillSpace")}),a.jsx("dd",{title:rc(t),children:t.isShared?b("skillCenter.sharedSpace"):rc(t)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:b("myAgents.region")}),a.jsx("dd",{children:If(n,i)})]})]}),a.jsx(Xy,{className:"skill-detail-tabs",idPrefix:"skill-detail",ariaLabel:b("skillCenter.skillDetailSections"),value:v,items:[{id:"files",label:b("skillCenter.allFiles"),panelId:"skill-detail-panel"},{id:"reviews",label:b("skillCenter.reviewHistory"),panelId:"skill-detail-panel"}],onChange:y}),a.jsx("div",{className:`skill-detail-content${v==="files"?" skill-detail-content--files":" skill-detail-content--reviews"}`,id:"skill-detail-panel",role:"tabpanel","aria-labelledby":`skill-detail-${v}-tab`,children:v==="reviews"?d?a.jsx(Fa,{}):f?a.jsx("div",{role:"alert",children:a.jsx(ms,{error:f})}):a.jsx(BH,{applications:u}):o?a.jsxs("div",{className:"skillcenter-loading",children:[a.jsx(DHt,{}),b("skillCenter.loadingSkillContent")]}):l?a.jsx("div",{className:"skillcenter-error",children:a.jsx(ms,{error:l})}):s.length>0?a.jsx(jD,{files:s.map(x=>x.path.endsWith("SKILL.md")&&x.content?{...x,content:RHt(x.content)}:x)}):a.jsx(LHt,{children:b("skillCenter.noSkillContent")})})]})})}function FHt({space:e,canUseSandbox:t,onUpload:n,onSandbox:i,onClose:r}){const{t:s}=Ae("ui");return p.useEffect(()=>{const o=l=>{l.key==="Escape"&&r()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]),a.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:r,children:a.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("h2",{id:"skill-add-dialog-title",children:s("skillCenter.addSkill")}),a.jsx("p",{title:rc(e),children:rc(e)})]}),a.jsx("button",{type:"button",onClick:r,children:s("common.cancel")})]}),a.jsxs("div",{className:"skill-add-dialog__options",children:[a.jsxs("button",{type:"button",onClick:n,children:[a.jsx("strong",{children:s("skillCenter.localUpload")}),a.jsx("span",{children:s("skillCenter.localUploadDescription")})]}),a.jsx(DR,{disabled:!t,placement:"inside",children:a.jsxs("button",{type:"button",disabled:!t,onClick:i,children:[a.jsx("strong",{children:s("skillCenter.autoCreate")}),a.jsx("span",{children:s("skillCenter.autoCreateDescription")})]})})]})]})})}function BHt({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:i=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:s,onPageTitleChange:o,toolbarLeading:l,toolbarFilters:c}){var ir;const{t:u,i18n:d}=Ae("ui"),f=p.useMemo(()=>[t],[t]),[h,m]=p.useState([]),[g,b]=p.useState(null),[v,y]=p.useState([]),x=p.useMemo(()=>d6e(v),[v]),[w,O]=p.useState(null),[S,k]=p.useState(null),[C,E]=p.useState(!1),R=p.useRef(""),_=p.useRef(!1),[j,T]=p.useState({}),[N,A]=p.useState(!1),[P,D]=p.useState(""),[M,L]=p.useState((r==null?void 0:r.space)??null),U=p.useRef(M);U.current=M;const[I,H]=p.useState([]),[K,F]=p.useState(1),[W,V]=p.useState(0),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ce,Ee]=p.useState(!1),[Y,G]=p.useState(""),[te,ye]=p.useState("overview"),[Ne,pe]=p.useState(null),[me,se]=p.useState(null),[Se,Le]=p.useState(null),[be,Ve]=p.useState([]),[ve,Re]=p.useState(!1),[ne,ge]=p.useState(null),[Ce,ke]=p.useState(null),[Ke,it]=p.useState(!1),[ue,xe]=p.useState(null),[Te,qe]=p.useState(null),[De,At]=p.useState(null),[It,lt]=p.useState(0),[Ot,Ct]=p.useState(0),[dt,yt]=p.useState(""),[Ie,vt]=p.useState(""),[jt,Nt]=p.useState(null),[ln,He]=p.useState(r),Me=p.useRef(0),We=p.useRef(0),gt=p.useRef(!1),st=p.useRef(null),xt=p.useRef(null),ft=p.useRef(null),Ht=p.useDeferredValue(P),cn=p.useDeferredValue(Y),hn=ln&&(M||ln.selectPublishSpace)?ln.operation==="create"?u("skillCenter.createSkill"):u("skillCenter.optimizeNamed",{name:((ir=ln.source)==null?void 0:ir.name)||u("skillCenter.skill")}):"",Ge=M!=null&&M.isShared?u("skillCenter.sharedSpace"):rc(M),bt=!(M!=null&&M.isShared)||M.canWrite===!0,St=hn||Ge||u("skillCenter.library");p.useEffect(()=>{n&&(o==null||o(St))},[n,o,St]),p.useEffect(()=>{r&&(s==null||s())},[r,s]);const dn=p.useMemo(()=>{const ze=Ht.trim().toLocaleLowerCase(),kt=h.filter(nn=>!nn.isShared);return ze?kt.filter(nn=>`${rc(nn)} ${nn.name} ${nn.description||""} ${nn.projectName||""}`.toLocaleLowerCase().includes(ze)):kt},[Ht,h]),Rt=p.useMemo(()=>{const ze=cn.trim().toLocaleLowerCase();return ze?I.filter(kt=>`${kt.skillName} ${kt.skillDescription||""}`.toLocaleLowerCase().includes(ze)):I},[cn,I]),$e=(M==null?void 0:M.region)||Ki(e);p.useEffect(()=>{if(!n||!M)return;const ze=()=>Ct(nn=>nn+1),kt=()=>{document.visibilityState==="visible"&&ze()};return window.addEventListener("focus",ze),document.addEventListener("visibilitychange",kt),()=>{window.removeEventListener("focus",ze),document.removeEventListener("visibilitychange",kt)}},[n,M==null?void 0:M.id]),p.useEffect(()=>{const ze=M?`${$e}:${M.id}`:"";if(R.current!==ze&&(R.current=ze,y([]),O(null),se(null)),k(null),E(!1),!n||!M||M.isShared)return;const kt=new AbortController;return E(!0),kPt({spaceId:M.id,region:$e,signal:kt.signal}).then(nn=>{kt.signal.aborted||y(nn.items)}).catch(nn=>{kt.signal.aborted||k(vr(nn,u("skillCenter.reviewStatusFailed")))}).finally(()=>{kt.signal.aborted||E(!1)}),()=>kt.abort()},[M==null?void 0:M.id,M==null?void 0:M.isShared,$e,Ot,n,i,u]);const ot=p.useMemo(()=>f.flatMap(ze=>{var nn;const kt=(nn=j[ze])==null?void 0:nn.error;return kt?[{region:ze,error:kt}]:[]}),[j,f]),vn=f.some(ze=>{const kt=j[ze];return!!(kt&&!kt.done&&!kt.error)}),Ye=ot.length===f.length;p.useEffect(()=>{const ze=new AbortController;return KP(ze.signal).then(ke).catch(()=>ke({enabled:!1,reason:u("skillCenter.adminNotConfigured"),operations:["create","optimize"],models:[],styles:{}})),()=>ze.abort()},[u]);const mt=p.useCallback(async(ze,kt)=>{var $r;if(gt.current||ze.length===0)return;gt.current=!0,A(!0),kt&&(($r=st.current)==null||$r.abort(),m([]),T(Object.fromEntries(ze.map(({region:qn})=>[qn,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const nn=new AbortController;st.current=nn;const Nn=++We.current,re=await Promise.allSettled(ze.map(async({region:qn,page:oi})=>({region:qn,page:oi,result:await gPt({region:qn,page:oi,pageSize:THt,signal:nn.signal})})));if(We.current!==Nn)return;const xi=re.map((qn,oi)=>{const Vi=ze[oi];return qn.status==="rejected"?{request:Vi,error:vr(qn.reason,u("skillCenter.errors.loadSpaces")),items:[],totalCount:0,scannedCount:0}:{request:Vi,error:null,items:(qn.value.result.items||[]).map(Fr=>({...Fr,region:Fr.region||qn.value.region})),totalCount:qn.value.result.totalCount||0,scannedCount:qn.value.result.scannedCount??qn.value.result.items.length}}),is=xi.flatMap(qn=>qn.items);T(qn=>{const oi={...qn};return xi.forEach(({request:Vi,error:Fr,scannedCount:ea,totalCount:za})=>{const Hr=oi[Vi.region]||{nextPage:Vi.page,loadedCount:0,done:!1,error:null};if(Fr){oi[Vi.region]={...Hr,error:Fr};return}const vo=Hr.loadedCount+ea;oi[Vi.region]={nextPage:Vi.page+1,loadedCount:vo,done:ea===0||vo>=za,error:null}}),oi}),m(qn=>NHt(kt?[]:qn,is)),L(qn=>qn&&(is.find(oi=>Pc(oi)===Pc(qn))||qn)),gt.current=!1,A(!1)},[]),_n=p.useCallback(()=>{if(gt.current)return;const ze=f.flatMap(kt=>{const nn=j[kt];return nn&&!nn.done&&!nn.error?[{region:kt,page:nn.nextPage}]:[]});mt(ze,!1)},[mt,j,f]);p.useEffect(()=>{Hn(),L(null),H([]),F(1)},[e]),p.useEffect(()=>{if(n)return mt(f.map(ze=>({region:ze,page:1})),!0),()=>{var ze;We.current+=1,(ze=st.current)==null||ze.abort(),gt.current=!1}},[n,i,mt,f,It]),p.useEffect(()=>{const ze=ft.current,kt=xt.current;if(!ze||!kt||!vn||N)return;const nn=new IntersectionObserver(([Nn])=>{Nn.isIntersecting&&_n()},{root:kt,rootMargin:"240px 0px",threshold:.01});return nn.observe(ze),()=>nn.disconnect()},[vn,_n,N]);const Vt=()=>{const ze=xt.current;!ze||!vn||N||ze.scrollHeight-ze.scrollTop-ze.clientHeight<=240&&_n()};p.useEffect(()=>{if(!M){H([]),V(0),Ee(!1);return}let ze=!0;return ie(!0),Z(null),jPt(M.id,{region:$e,page:K,pageSize:ase,project:M.projectName}).then(kt=>{ze&&(H(kt.items||[]),V(kt.totalCount||0),Ee(kt.degraded===!0))}).catch(kt=>{ze&&(H([]),V(0),Ee(!1),Z(vr(kt,u("skillCenter.errors.loadSkills"))))}).finally(()=>{ze&&ie(!1)}),()=>{ze=!1}},[$e,M,K,Ot,u]);const Ai=ze=>{Hn(),L(ze),ye("overview"),F(1),G("")},jn=()=>{Hn(),L(null),H([]),V(0),Ee(!1),ye("overview"),F(1),G(""),Nt(null)},Hn=()=>{Me.current+=1,pe(null),Le(null),Ve([]),ge(null),Re(!1)},En=async ze=>{if(!M)return;const kt=Db(ze),nn=Me.current+1;Me.current=nn,pe(ze),Le(null),ge(null),Re(!0);try{const[Nn,re]=await Promise.all([NPt(M.id,kt,ze.version,$e,M.projectName,ze.skillName,M.name),GDe({spaceId:M.id,skillId:kt,version:ze.version,region:$e,skillSpaceName:M.name,skillName:ze.skillName})]);Me.current===nn&&(Le(Nn),Ve(re))}catch(Nn){Me.current===nn&&ge(vr(Nn,u("skillCenter.errors.loadSkillDetails")))}finally{Me.current===nn&&Re(!1)}},vi=ze=>{if(M)return{kind:"skill-center",skillId:Db(ze),version:ze.version,region:$e,projectName:M.projectName,skillSpaceId:M.id,skillSpaceName:M.name,name:ze.skillName,description:ze.skillDescription}},Fn=ze=>{const kt=vi(ze);!kt||!(Ce!=null&&Ce.enabled)||(Hn(),He({operation:"optimize",source:kt}))},di=async ze=>{if(!(!M||!window.confirm(u("skillCenter.deleteSkillConfirm",{name:ze.skillName})))){yt(ze.skillId),Nt(null);try{await APt({spaceId:M.id,skillId:ze.skillId,region:$e}),Ct(kt=>kt+1),lt(kt=>kt+1)}catch(kt){Nt(vr(kt,u("skillCenter.errors.deleteSkill")))}finally{yt("")}}},wr=async ze=>{if(!window.confirm(u("skillCenter.deleteSpaceConfirm",{name:rc(ze)})))return;const kt=Pc(ze);vt(kt),Nt(null);try{await EPt({spaceId:ze.id,region:ze.region||Ki(e)}),M&&Pc(M)===kt&&jn(),lt(nn=>nn+1)}catch(nn){Nt(vr(nn,u("skillCenter.errors.deleteSpace")))}finally{vt("")}},mr=async(ze,kt=ze.version,nn=!1)=>{var xi,is,$r,qn;if(!M||_.current)return;const Nn=M,re=`${Nn.region}:${Nn.id}:${ze.skillId}:${kt}`;_.current=!0,b(re),Nt(null);try{const oi=await vPt({spaceId:Nn.id,skillId:ze.skillId,version:kt,region:Nn.region||$e});((xi=U.current)==null?void 0:xi.id)===Nn.id&&((is=U.current)==null?void 0:is.region)===Nn.region&&y(Vi=>[...Vi.filter(Fr=>Fr.id!==oi.id),oi])}catch(oi){if(nn)throw vr(oi,u("skillCenter.reviewFailed"));(($r=U.current)==null?void 0:$r.id)===Nn.id&&((qn=U.current)==null?void 0:qn.region)===Nn.region&&Nt(vr(oi,u("skillCenter.reviewFailed")))}finally{_.current=!1,b(null)}};return ln&&(M||ln.selectPublishSpace)?a.jsx(iHt,{operation:ln.operation,cloudProvider:e,space:M??void 0,availableSpaces:h.filter(ze=>!ze.isShared),spacesLoading:N,initialIntent:ln.initialIntent,source:ln.source,onBack:()=>He(null),onPublished:()=>{Ct(ze=>ze+1),lt(ze=>ze+1)}}):a.jsxs("section",{className:`skillcenter${M?" is-space":" resource-collection"}`,children:[M?a.jsx(LC,{className:"skillcenter-detail",title:Ge||M.name,description:M.isShared?u("skillCenter.sharedDescription"):M.description||u("skillCenter.manageSpaceDescription"),identitySeed:M.name,backLabel:u("skillCenter.backToSpaces"),onBack:jn,sections:[{key:"overview",label:u("skillCenter.overview"),content:a.jsxs(a.Fragment,{children:[jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,S?a.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[a.jsx(ms,{error:S}),a.jsx("button",{type:"button",onClick:()=>Ct(ze=>ze+1),children:u("common.reload")})]}):null,a.jsx("section",{className:"skillcenter-overview",children:a.jsxs(Oz,{className:"skillcenter-detail-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:u("skillCenter.skillCount")}),a.jsx("dd",{children:W})]}),a.jsxs("div",{children:[a.jsx("dt",{children:u("skillCenter.updatedAt")}),a.jsx("dd",{children:M.updatedAt?jHt(M.updatedAt,d.resolvedLanguage??d.language):"—"})]})]})})]})},{key:"skills",label:u("skillCenter.skills"),content:a.jsxs(a.Fragment,{children:[jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,S?a.jsxs("div",{className:"skillcenter-inline-error",role:"alert",children:[a.jsx(ms,{error:S}),a.jsx("button",{type:"button",onClick:()=>Ct(ze=>ze+1),children:u("common.reload")})]}):null,a.jsxs("section",{className:"skillcenter-results","aria-label":u("skillCenter.skillsInSpace",{name:Ge||M.name}),children:[a.jsx(HRe,{title:u("skillCenter.skills"),description:u("skillCenter.totalItems",{count:W}),actions:a.jsxs(a.Fragment,{children:[a.jsx(hp,{"aria-label":u("skillCenter.searchSkills"),value:Y,onChange:ze=>G(ze.target.value),placeholder:u("skillCenter.searchSkills")}),a.jsx(Dt,{color:"secondary",variant:"outline",size:"sm",pill:!1,disabled:X||C,onClick:()=>Ct(ze=>ze+1),children:u("common.refresh")})]})}),ce?a.jsx("div",{className:"skillcenter-inline-warning",role:"status",children:u("skillCenter.degradedRelationWarning")}):null,X&&I.length===0?a.jsx(Fa,{}):Q&&I.length===0?a.jsx(o4,{kind:"error",title:u("skillCenter.cannotLoadSkills"),error:Q,action:{label:u("common.reload"),onClick:()=>Ct(ze=>ze+1)}}):Rt.length===0?a.jsx(o4,{kind:"empty",title:Y.trim()?u("skillCenter.noMatchingSkills"):u("skillCenter.noSkills"),description:Y.trim()?u("skillCenter.tryAnotherName"):u(M.isShared?"skillCenter.sharedEmpty":"skillCenter.emptySkillsDescription"),action:!Y.trim()&&bt?{label:u("skillCenter.localUpload"),onClick:()=>At(M)}:void 0}):a.jsx("div",{className:"skillcenter-table-wrap",children:a.jsxs("table",{className:"skillcenter-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:u("skillCenter.skills")}),a.jsx("th",{scope:"col",children:u("agentSelector.status")}),a.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:u("skillCenter.actions")})]})}),a.jsx("tbody",{children:Rt.map(ze=>{const kt=x.get(`${ze.skillId}:${ze.version}`);return a.jsxs("tr",{children:[a.jsx("td",{className:"skillcenter-table__skill",children:a.jsxs("button",{type:"button",onClick:()=>void En(ze),children:[a.jsxs("span",{className:"skillcenter-table__title-row",children:[a.jsx("strong",{title:ze.skillName,children:ze.skillName}),ze.version?a.jsx("span",{className:"skillcenter-table__version-badge",children:ze.sourceVersion||ze.version}):null]}),a.jsx("span",{className:"skillcenter-table__description",children:y6e(ze.skillDescription,u)}),M.isShared&&ze.author?a.jsx("span",{className:"skillcenter-table__author",children:u("skillCenter.authorName",{name:ze.author})}):null]})}),a.jsx("td",{children:a.jsxs("div",{className:"skillcenter-review-status",children:[a.jsx("span",{className:`skillcenter-status ${_Ht(ze.skillStatus)}`,children:b6e(ze.skillStatus,u)}),kt?a.jsx(fT,{status:kt.status}):null,kt!=null&&kt.reviewer||kt!=null&&kt.reviewedBy?a.jsx($H,{compact:!0,person:kt.reviewer,fallback:kt.reviewedBy}):null]})}),a.jsx("td",{children:a.jsxs("div",{className:"skillcenter-table__actions",children:[a.jsx("button",{type:"button",onClick:()=>void En(ze),children:u("common.view")}),!ze.lookupByName&&ze.skillId?a.jsx("button",{type:"button",onClick:()=>se(ze),children:u("skillCenter.versions.title")}):null,!M.isShared&&!ze.lookupByName&&ze.skillId?a.jsx("button",{type:"button",disabled:C||S!==null||g!==null||kt!==void 0&&kt.status!=="returned",onClick:()=>void mr(ze),children:g===`${M.region}:${M.id}:${ze.skillId}:${ze.version}`?u("skillCenter.reviewSubmitting"):u(kt?{pending:"skillCenter.reviewPending",approving:"skillCenter.reviewApproving",approved:"skillCenter.reviewApproved",returned:"skillCenter.reviewRetry"}[kt.status]:"skillCenter.requestPublication")}):null,v.some(nn=>nn.sourceSkillId===ze.skillId)?a.jsx("button",{type:"button",onClick:()=>O(ze),children:u("skillCenter.reviewHistory")}):null,M.isShared?null:a.jsx(DR,{disabled:!(Ce!=null&&Ce.enabled),children:a.jsx("button",{type:"button",disabled:!(Ce!=null&&Ce.enabled),onClick:()=>Fn(ze),children:u("skillCenter.optimize")})}),!ze.lookupByName&&bt?a.jsx("button",{type:"button",className:"is-danger",disabled:dt===ze.skillId,onClick:()=>void di(ze),children:dt===ze.skillId?u("common.deleting"):u("common.delete")}):null]})})]},`${Db(ze)}:${ze.version}`)})})]})}),!Y.trim()&&!X&&!Q&&W>0?a.jsx(MHt,{page:K,total:W,pageSize:ase,onPage:F}):null]})]})}],activeSectionKey:te,navigationLabel:u("skillCenter.spaceDetails"),onSectionChange:ze=>ye(ze),actionsClassName:"skillcenter-toolbar-actions",actions:a.jsxs(a.Fragment,{children:[M.isShared?null:a.jsxs(a.Fragment,{children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>xe(M),children:u("skillCenter.editSpace")}),a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:Ie===Pc(M),onClick:()=>void wr(M),children:Ie===Pc(M)?u("common.deleting"):u("skillCenter.deleteSpace")})]}),bt?a.jsx(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>At(M),children:u("skillCenter.localUpload")}):null,M.isShared?null:a.jsx(DR,{disabled:!(Ce!=null&&Ce.enabled),children:a.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(Ce!=null&&Ce.enabled),onClick:()=>He({operation:"create"}),children:[a.jsx(xAe,{"aria-hidden":"true"}),a.jsx("span",{children:u("skillCenter.createSkill")})]})})]})}):a.jsxs(a.Fragment,{children:[a.jsxs(Gy,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,a.jsxs("div",{className:"resource-toolbar__actions",children:[c,a.jsx(hp,{"aria-label":u("skillCenter.searchSpaces"),value:P,onChange:ze=>D(ze.target.value),placeholder:u("skillCenter.searchSpaces")})]})]}),jt?a.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:a.jsx(ms,{error:jt})}):null,a.jsxs(Rg,{className:"skillcenter-list-results",ref:xt,"aria-label":u("skillCenter.spaceList"),onScroll:Vt,children:[ot.length>0&&!Ye?a.jsx(use,{errors:ot,cloudProvider:e,onRetry:()=>lt(ze=>ze+1)}):null,a.jsxs(Yy,{children:[a.jsx(OHt,{region:t,active:n,revision:It+i,onOpen:Ai},`${e}:${t}`),P.trim()?null:a.jsx(ug,{"aria-label":u("skillCenter.createSpace"),icon:a.jsx(PHt,{}),onClick:()=>it(!0),children:u("skillCenter.newSpace")}),dn.map(ze=>{const kt=Pc(ze);return a.jsx(Jy,{className:"skillcenter-space-card",title:rc(ze),description:ze.description||u("common.noDescription"),metadata:[{label:u("skillCenter.skillCount"),value:u("skillCenter.skillCountValue",{count:ze.skillCount??0})},{label:u("skillCenter.updatedAt"),value:LD(ze.updatedAt,Date.now(),d.resolvedLanguage??d.language)}],action:{label:u("skillCenter.addSkill"),icon:"plus",onClick:()=>qe(ze)},detailAction:{label:u("common.viewDetails"),onClick:()=>Ai(ze)}},kt)})]}),N&&h.length===0?a.jsx(Fa,{}):Ye&&h.length===0?a.jsx(use,{errors:ot,cloudProvider:e,fullPage:!0,onRetry:()=>lt(ze=>ze+1)}):dn.length===0&&P.trim()?a.jsx(o4,{kind:"empty",title:u("skillCenter.noMatchingSpaces"),description:u("skillCenter.tryAnotherName")}):null,!Ye&&h.length>0?a.jsx("div",{className:"my-agent-load-more",ref:ft,"aria-live":"polite",children:N?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:u("skillCenter.loadingMoreSpaces")})]}):vn?a.jsx("span",{children:u("skillCenter.scrollForMore")}):ot.length>0?a.jsx("span",{children:u("skillCenter.someSpacesFailed")}):a.jsx("span",{children:u("skillCenter.allSpacesLoaded")})}):null]})]}),me&&M?a.jsx(wHt,{skill:me,space:M,region:$e,reviews:v.filter(ze=>ze.sourceSkillId===me.skillId),onClose:()=>se(null),onChanged:()=>Ct(ze=>ze+1),onSubmitReview:!M.isShared&&!C&&!S?ze=>mr(me,ze,!0):void 0},`${$e}:${M.id}:${me.skillId}`):null,w?a.jsx(xHt,{name:w.skillName,applications:v.filter(ze=>ze.sourceSkillId===w.skillId),onClose:()=>O(null)}):null,Ne&&M&&a.jsx($Ht,{skill:Ne,space:M,region:$e,cloudProvider:e,detail:Se,files:be,loading:ve,error:ne,reviews:v.filter(ze=>ze.sourceSkillId===Ne.skillId),reviewsLoading:C,reviewsError:S,canOptimize:!M.isShared&&(Ce==null?void 0:Ce.enabled)===!0,onOptimize:()=>Fn(Ne),onDownload:()=>void _Pt({spaceId:M.id,skillId:Db(Ne),version:Ne.version,region:$e,fallbackName:Ne.skillName,skillSpaceName:M.name,skillName:Ne.skillName}).catch(ze=>ge(vr(ze,u("skillCenter.errors.downloadSkill")))),onClose:Hn}),Ke?a.jsx(kHt,{region:t,regionOptions:Jc(e),onClose:()=>it(!1),onCreated:ze=>{it(!1),lt(kt=>kt+1),L({...ze,region:ze.region||t})}}):null,ue?a.jsx(SHt,{space:ue,region:ue.region||Ki(e),onClose:()=>xe(null),onUpdated:ze=>{const kt={...ze,region:ze.region||ue.region||Ki(e)};xe(null),L(nn=>nn&&Pc(nn)===Pc(kt)?kt:nn),m(nn=>nn.map(Nn=>Pc(Nn)===Pc(kt)?kt:Nn)),lt(nn=>nn+1)}}):null,Te?a.jsx(FHt,{space:Te,canUseSandbox:(Ce==null?void 0:Ce.enabled)===!0,onClose:()=>qe(null),onUpload:()=>{At(Te),qe(null)},onSandbox:()=>{const ze=Te;qe(null),Ai(ze),He({operation:"create"})}}):null,De?a.jsx(EHt,{space:De,region:De.region||Ki(e),onClose:()=>At(null),onUploaded:()=>{At(null),Ct(ze=>ze+1),lt(ze=>ze+1)}}):null]})}function UHt(e){return[{id:"skills",label:e("library.tabs.skills"),panelId:"library-skills-panel"},{id:"knowledge",label:e("library.tabs.knowledge"),panelId:"library-knowledge-panel"},{id:"artifacts",label:e("library.tabs.artifacts"),panelId:"library-artifacts-panel"}]}function QHt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:i,onPageTitleChange:r,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:o,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const{t:f,i18n:h}=Ae("workspaceTools"),m=p.useMemo(()=>UHt(f),[f]),g=f("library.tabs.skills"),b=_I(t)?t:Ki(e),[v,y]=p.useState(b),[x,w]=p.useState(g),O=p.useRef(g),[S,k]=p.useState(!1),[C,E]=p.useState(()=>new Set(["skills",n])),[R,_]=p.useState({skills:0,knowledge:0,artifacts:0}),j=p.useRef(u),[T,N]=p.useState([]),[A,P]=p.useState(!1),[D,M]=p.useState(""),L=p.useMemo(()=>{const ie=$wt(l,f("library.untitledSession"));return{key:JSON.stringify(ie),candidates:ie}},[l,f]),U=p.useRef(L);U.current.key!==L.key&&(U.current=L);const I=U.current.candidates,H=p.useMemo(()=>Jc(e),[e]);p.useEffect(()=>{y(b)},[b]),p.useEffect(()=>{const ie=O.current;w(Q=>Q===ie?g:Q),O.current=g},[g]),p.useEffect(()=>{j.current=u},[u]),p.useEffect(()=>{E(ie=>{if(ie.has(n))return ie;const Q=new Set(ie);return Q.add(n),Q})},[n]),p.useEffect(()=>{var Q;const ie=n==="skills"?x:((Q=m.find(Z=>Z.id===n))==null?void 0:Q.label)||f("library.title");r==null||r(ie)},[n,r,x,f,m]),p.useEffect(()=>{var ie;n==="artifacts"&&((ie=j.current)==null||ie.call(j))},[n,R.artifacts]);const K=p.useCallback(async()=>{P(!0),M("");try{N(await Wwt(I))}catch(ie){M(ie instanceof Error?ie.message:String(ie))}finally{P(!1)}},[I]);p.useEffect(()=>{n==="artifacts"&&K()},[n,R.artifacts,K]);const F=ie=>{E(Q=>{if(Q.has(ie))return Q;const Z=new Set(Q);return Z.add(ie),Z}),_(Q=>({...Q,[ie]:Q[ie]+1})),i(ie)},W=a.jsx(Xy,{idPrefix:"library",ariaLabel:f("library.categoryAria"),value:n,items:m,onChange:F}),V=ie=>a.jsx(cg,{id:ie,ariaLabel:f("library.regionAria"),value:v,options:H,onChange:y}),X=n==="skills"?x!==g:n==="knowledge"&&S;return a.jsxs(Df,{className:`library-view${X?" is-detail":""}`,"aria-label":f("library.title"),children:[X?null:a.jsx(Ky,{className:"library-view__header",title:f("library.title")}),a.jsxs("div",{className:"library-panels",children:[C.has("skills")?a.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:a.jsx(BHt,{cloudProvider:e,region:v,active:n==="skills",activationRevision:R.skills,onPageTitleChange:w,initialWorkspace:s,onInitialWorkspaceConsumed:o,toolbarLeading:W,toolbarFilters:V("library-skills-region-filter")})}):null,C.has("knowledge")?a.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:a.jsx(ePt,{cloudProvider:e,region:v,active:n==="knowledge",activationRevision:R.knowledge,onDetailChange:k,toolbarLeading:W,toolbarFilters:V("library-knowledge-region-filter")})}):null,C.has("artifacts")?a.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:a.jsx(Vwt,{items:T,region:v,userId:c,active:n==="artifacts",activationRevision:R.artifacts,loading:A,error:D?Fu(D,h.resolvedLanguage||h.language)||f("artifactLibrary.loadDetailFallback"):"",onRetry:()=>void K(),onEdit:Kwt,onDelete:Gwt,onDownload:Xwt,onOpenSource:d?ie=>d(ie.appName,ie.sessionId):void 0,toolbarLeading:W,toolbarFilters:V("library-artifacts-region-filter")})}):null]})]})}const v6e="veadk_agentkit_connections",zHt=3e3,dse=6e4;function yd(){try{const e=localStorage.getItem(v6e);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function $D(e){try{localStorage.setItem(v6e,JSON.stringify(e))}catch{}}function _d(e,t){return`agentkit:${e}:${t}`}function x6e(e){try{return new URL(e).host}catch{return e}}function g1(e){YSe();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)XSe(_d(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function w6e(e,t,n,i,r,s){const o={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:i,appLabels:r,currentVersion:s},l=yd(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(o):l[c]=o,$D(l),g1(l),o}async function VHt(e,t,n,i,r){let s=null,o=n||"cn-beijing",l=null;for(const f of uC(n))try{const h=await Vx(e,f,{retryProbe:!0,preferCached:!0,currentVersion:i});if(h&&h.length>0){await pCe(e,f),s=h,o=f;break}}catch(h){if(h instanceof Lw)throw MR(e),h;if(h instanceof co&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw MR(e),l||new co(z("connections.runtimeUnsupported"),!0,!0);const c=(r==null?void 0:r.trim())||s[0],u=Object.fromEntries(s.map(f=>[f,f===s[0]?c:f])),d=w6e(e,t,o,s,u,i);return _d(d.id,s[0])}function HHt(e){return new Promise(t=>window.setTimeout(t,e))}async function mj(e,t,n,i,r={}){const s=Date.now();for(;;)try{return await VHt(e,t,n,i,r.agentName)}catch(o){const l=Date.now()-s;if(!r.waitForReady||!(o instanceof co)||!o.retryable||l>=dse)throw o;const c=Math.min(zHt,dse-l);await HHt(c)}}async function O6e(e,t,n,i){const r=t.trim().replace(/\/+$/,""),s=await dC(r,n.trim()),o={id:Date.now().toString(36),name:e.trim()||x6e(r),base:r,apiKey:n.trim(),apps:s,appLabels:i&&s.length>0?{[s[0]]:i}:void 0},l=[...yd().filter(c=>c.base!==r),o];return $D(l),g1(l),o}function qHt(e){const t=yd().filter(n=>n.id!==e);return $D(t),g1(t),t}function MR(e){const t=yd().filter(n=>n.runtimeId!==e);return $D(t),g1(t),t}function k6e(e,t){const n=e.map(r=>({id:r,label:r,app:r,remote:!1})),i=t.flatMap(r=>r.apps.map(s=>{var l;const o=((l=r.appLabels)==null?void 0:l[s])??s;return{id:_d(r.id,s),label:o,app:s,remote:!0,host:r.runtimeId?r.name:x6e(r.base??""),runtimeId:r.runtimeId,region:r.region,currentVersion:r.currentVersion}}));return[...n,...i]}const fse=Object.freeze(Object.defineProperty({__proto__:null,addConnection:O6e,addRuntimeConnection:w6e,buildAgentEntries:k6e,connectRuntime:mj,loadConnections:yd,registerConnections:g1,remoteAppId:_d,removeConnection:qHt,removeRuntimeConnection:MR},Symbol.toStringTag,{value:"Module"}));function WHt({onAdded:e,onCancel:t}){const{t:n}=Ae("conversation"),[i,r]=p.useState(""),[s,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(!1),[f,h]=p.useState(""),m=i.trim().length>0&&s.trim().length>0&&!u;async function g(){if(m){d(!0),h("");try{const b=await O6e(l,i,s,l);if(b.apps.length===0){h(n("addAgentKit.noAgents")),d(!1);return}e(_d(b.id,b.apps[0]))}catch(b){h(n("addAgentKit.connectionFailed",{error:String(b)})),d(!1)}}}return a.jsx("div",{className:"addagent",children:a.jsxs("div",{className:"addagent-card",children:[a.jsx("h2",{className:"addagent-title",children:n("addAgentKit.title")}),a.jsx("p",{className:"addagent-sub",children:n("addAgentKit.description")}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:n("addAgentKit.url")}),a.jsx("input",{className:"addagent-input",value:i,onChange:b=>r(b.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:"API Key"}),a.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:b=>o(b.target.value),placeholder:n("addAgentKit.apiKeyHint")})]}),a.jsxs("label",{className:"addagent-field",children:[a.jsx("span",{className:"addagent-label",children:n("addAgentKit.displayName")}),a.jsx("input",{className:"addagent-input",value:l,onChange:b=>c(b.target.value),placeholder:n("addAgentKit.displayNameHint")})]}),f&&a.jsx("div",{className:"addagent-error",children:f}),a.jsxs("div",{className:"addagent-actions",children:[a.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:u,children:n("addAgentKit.cancel")}),a.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:g,disabled:!m,children:[u?a.jsx(Ei,{className:"icon spin"}):null,n(u?"addAgentKit.connecting":"addAgentKit.connect")]})]})]})})}const KHt=/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u,GHt={"deploy.build.logs_syncing":"client.deploymentProgress.buildLogsSyncing","deploy.build.logs_complete":"client.deploymentProgress.buildLogsComplete","deploy.build.failed_logs_synced":"client.deploymentProgress.buildFailedLogsSynced","deploy.build.logs_unavailable":"client.deploymentProgress.buildLogsUnavailable","deploy.build.final_logs_unavailable":"client.deploymentProgress.finalBuildLogsUnavailable"},XHt={prepare:"client.deploymentProgress.preparing",upload:"client.deploymentProgress.uploading",build:"client.deploymentProgress.building",deploy:"client.deploymentProgress.deploying",publish:"client.deploymentProgress.publishing",evaluation:"client.deploymentProgress.evaluating",update:"client.deploymentProgress.updating",complete:"client.deploymentProgress.completing",github:"client.deploymentProgress.github"};function FD(e){var r,s;const t=((r=e.message)==null?void 0:r.trim())??"",n=e.messageCode?GHt[e.messageCode]:void 0;if(n)return z(n);if(t&&(k6().toLowerCase()==="zh-cn"||!KHt.test(t)))return t;if(e.phase==="build"&&((s=e.buildLog)!=null&&s.status)){const o={running:"client.deploymentProgress.buildLogsSyncing",complete:"client.deploymentProgress.buildLogsComplete",error:"client.deploymentProgress.buildLogsUnavailable"}[e.buildLog.status];if(o)return z(o)}const i=e.phase?XHt[e.phase]:void 0;return i?z(i):t||z("client.deploymentProgress.inProgress")}function YHt(e){return[{id:"case-1",itemKey:"case-1",kind:"good",input:e("agentWorkspace.defaultCases.weeklyFeedback.input"),output:e("agentWorkspace.defaultCases.weeklyFeedback.output"),referenceOutput:e("agentWorkspace.defaultCases.weeklyFeedback.output"),comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.goodSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.weeklyFeedback.tag"),source:"auto",score:.92,reason:e("agentWorkspace.defaultCases.weeklyFeedback.reason")},{id:"case-2",itemKey:"case-2",kind:"good",input:e("agentWorkspace.defaultCases.research.input"),output:e("agentWorkspace.defaultCases.research.output"),referenceOutput:e("agentWorkspace.defaultCases.research.output"),comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.goodSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.research.tag"),source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:e("agentWorkspace.defaultCases.uncertainConclusion.input"),output:e("agentWorkspace.defaultCases.uncertainConclusion.output"),referenceOutput:"",comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.badSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.uncertainConclusion.tag"),source:"auto",score:.28,reason:e("agentWorkspace.defaultCases.uncertainConclusion.reason")},{id:"case-4",itemKey:"case-4",kind:"bad",input:e("agentWorkspace.defaultCases.repeatedTool.input"),output:e("agentWorkspace.defaultCases.repeatedTool.output"),referenceOutput:"",comment:"",agentName:e("agentWorkspace.defaultCases.agentName"),sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:e("agentWorkspace.defaultCases.badSetName"),workspaceId:"",tag:e("agentWorkspace.defaultCases.repeatedTool.tag"),source:"user"}]}const ZHt=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],JHt={核心能力回归:"agentWorkspace.evaluationDefaults.coreRegression",安全与幻觉检查:"agentWorkspace.evaluationDefaults.safetyCheck",核心回归集:"agentWorkspace.evaluationDefaults.coreSet",安全边界集:"agentWorkspace.evaluationDefaults.safetySet",工具调用集:"agentWorkspace.evaluationDefaults.toolSet",综合质量评估器:"agentWorkspace.evaluationDefaults.qualityEvaluator",事实一致性评估器:"agentWorkspace.evaluationDefaults.factualEvaluator",工具调用评估器:"agentWorkspace.evaluationDefaults.toolEvaluator",回答质量:"agentWorkspace.evaluationDefaults.responseQuality",事实准确性:"agentWorkspace.evaluationDefaults.factualAccuracy",工具调用:"agentWorkspace.evaluationDefaults.toolUse",响应效率:"agentWorkspace.evaluationDefaults.responseEfficiency","今天 10:32":"agentWorkspace.evaluationDefaults.todayTime","昨天 16:08":"agentWorkspace.evaluationDefaults.yesterdayTime","7 月 25 日 14:20":"agentWorkspace.evaluationDefaults.julyTime",刚刚:"agentWorkspace.evaluationDefaults.justNow"};function ok(e,t){const n=JHt[e];return n?t(n):e}const hse=["basic","usage","evaluations","optimizations","integrations","versions"],eqt=20;function tqt(e,t,n){const i=Date.parse(e);return Number.isNaN(i)?n("agentWorkspace.notProvided"):new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}const wO=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function a4(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function nqt(e,t){const n=e.trim();if(!n||!t)return n;try{const i=new URL(n),r=i.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(r))return n;const s=new URL(t);return i.protocol=s.protocol,i.hostname=s.hostname,i.port=s.port,i.toString()}catch{return n}}function pse(e,t){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":t(e==="none"?"agentWorkspace.noAuthentication":"agentWorkspace.notAvailable")}function mse(e,t){return t(e==="published"?"agentWorkspace.githubStatus.published":e==="publishing"?"agentWorkspace.githubStatus.publishing":e==="failed"?"agentWorkspace.githubStatus.failed":e==="pending"?"agentWorkspace.githubStatus.pending":"agentWorkspace.githubStatus.unknown")}function iqt(e,t){return e.changeType==="rollback"?t("agentWorkspace.rollbackEvent"):e.version}function $B(e){return JSON.stringify(e)}function S6e(e){return e==="key_auth"?`API_KEY = "" HEADERS = {"Authorization": f"Bearer {API_KEY}"}`:e==="custom_jwt"?`ACCESS_TOKEN = "" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"}`:e==="none"?"HEADERS = {}":`AUTH_TOKEN = "" -HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function nqt(e,t,n){const i=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function rqt(e,t,n){const i=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests @@ -790,7 +790,7 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function iqt(e,t){return`\`\`\`python +\`\`\``}function sqt(e,t){return`\`\`\`python import uuid import requests @@ -817,23 +817,23 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function rqt({visible:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),a.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&a.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function gse({available:e,authType:t,value:n,visible:i,loading:r,error:s,onToggle:o}){const{t:l}=Ae("ui");return e?t==="none"?l("agentWorkspace.noApiKeyRequired"):t==="custom_jwt"?l("agentWorkspace.usesOauthJwt"):t!=="key_auth"?l("agentWorkspace.notAvailable"):a.jsxs("span",{className:"aw-integration-secret",children:[a.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:i&&n?n:"****"}),a.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":l(i?"agentWorkspace.hideApiKey":"agentWorkspace.showApiKey"),title:l(i?"agentWorkspace.hideApiKey":"agentWorkspace.showApiKey"),disabled:r,onClick:o,children:r?a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):a.jsx(rqt,{visible:i})}),s&&a.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):l("agentWorkspace.notAvailable")}function bse({protocol:e,title:t,available:n,fields:i,example:r}){const{t:s}=Ae("ui");return a.jsxs("section",{className:`aw-integration-panel${n&&r?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[a.jsx("header",{children:a.jsx("h3",{children:t})}),a.jsx("dl",{children:i.map(o=>a.jsxs("div",{children:[a.jsx("dt",{children:o.label}),a.jsx("dd",{children:o.value||s("agentWorkspace.notAvailable")})]},o.label))}),n&&r&&a.jsxs("section",{className:"aw-integration-example",children:[a.jsx("h4",{children:s("agentWorkspace.pythonExample")}),a.jsx(Yu,{text:r,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function sqt(e,t,n){var i;return bz({appName:((i=e==null?void 0:e.appName)==null?void 0:i.trim())||t,name:e==null?void 0:e.name,description:e==null?void 0:e.description,type:e==null?void 0:e.type,model:e==null?void 0:e.model,tools:e==null?void 0:e.tools,skills:e==null?void 0:e.skills,graph:e==null?void 0:e.graph,draft:e==null?void 0:e.draft},n)}function E6e(e){return e?1+e.children.reduce((t,n)=>t+E6e(n),0):1}function C6e(e){return 1+e.subAgents.reduce((t,n)=>t+C6e(n),0)}function FB(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function oqt(e,t,n){const i=FB(e);return i?new Intl.DateTimeFormat(t,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(i)):n("agentWorkspace.unknownTime")}function aqt(e,t){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":t("agentWorkspace.scoreValue",{score:Math.round(e.score*100)})}function lqt(e,t){return t(`agentWorkspace.priority.${e}`)}const cqt={agent_structure:"agentWorkspace.modules.agentStructure",prompt:"agentWorkspace.modules.prompt",tool:"agentWorkspace.modules.tool",knowledge:"agentWorkspace.modules.knowledge",memory:"agentWorkspace.modules.memory",workflow:"agentWorkspace.modules.workflow",other:"agentWorkspace.modules.other"};function uqt(e,t){var n;return e.module==="other"?((n=e.customModule)==null?void 0:n.trim())||t("agentWorkspace.modules.other"):t(cqt[e.module])}function dqt(e,t){return e.find(n=>n.kind===t)}function yse(e,t){return e.items.map(n=>({...n,tag:t(n.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")})).sort((n,i)=>FB(i.createdAt)-FB(n.createdAt))}function fqt(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(i=>i.name),(n.mcpTools??[]).map(i=>i.name),n.skills??[],(n.selectedSkills??[]).map(i=>i.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}function hqt(e){return[{phase:"prepare",label:e("agentWorkspace.deploymentSteps.prepare.label"),description:e("agentWorkspace.deploymentSteps.prepare.description")},{phase:"build",label:e("agentWorkspace.deploymentSteps.build.label"),description:e("agentWorkspace.deploymentSteps.build.description")},{phase:"deploy",label:e("agentWorkspace.deploymentSteps.deploy.label"),description:e("agentWorkspace.deploymentSteps.deploy.description")},{phase:"publish",label:e("agentWorkspace.deploymentSteps.publish.label"),description:e("agentWorkspace.deploymentSteps.publish.description")},{phase:"complete",label:e("agentWorkspace.deploymentSteps.complete.label"),description:e("agentWorkspace.deploymentSteps.complete.description")}]}function pqt(e,t){return{phase:"update",label:t("agentWorkspace.deploymentSteps.update.label"),description:t("agentWorkspace.deploymentSteps.update.description",e)}}function T6e(e,t){const n=hqt(t),i=[...n.slice(0,-1)];return e.instanceRange&&i.push(pqt(e.instanceRange,t)),e.createEvaluationSets&&i.push({phase:"evaluation",label:t("agentWorkspace.deploymentSteps.evaluation.label"),description:t("agentWorkspace.deploymentSteps.evaluation.description")}),e.githubDelivery&&i.push({phase:"github",label:t("agentWorkspace.deploymentSteps.github.label"),description:t("agentWorkspace.deploymentSteps.github.description")}),i.push(n[n.length-1]),i}function A6e(e,t){const n=T6e(e,t);if(e.status==="success")return n.length-1;const i=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation","挂载 GitHub 持续交付":"github",部署完成:"complete"}[e.label],r=n.findIndex(s=>s.phase===i);return r<0?0:r}function mqt(e,t){if(!e)return"";try{return new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function _6e({log:e,autoExpand:t,title:n,ariaLabel:i,copyLabel:r,defaultPendingMessage:s}){const{t:o,i18n:l}=Ae("ui"),c=p.useRef(null),u=!!((e==null?void 0:e.status)!=="complete"&&t),[d,f]=p.useState(u),[h,m]=p.useState(!1),g=!!(e!=null&&e.text||e!=null&&e.error),b=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",v=b.split(` +\`\`\``}function oqt({visible:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),a.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&a.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function gse({available:e,authType:t,value:n,visible:i,loading:r,error:s,onToggle:o}){const{t:l}=Ae("ui");return e?t==="none"?l("agentWorkspace.noApiKeyRequired"):t==="custom_jwt"?l("agentWorkspace.usesOauthJwt"):t!=="key_auth"?l("agentWorkspace.notAvailable"):a.jsxs("span",{className:"aw-integration-secret",children:[a.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:i&&n?n:"****"}),a.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":l(i?"agentWorkspace.hideApiKey":"agentWorkspace.showApiKey"),title:l(i?"agentWorkspace.hideApiKey":"agentWorkspace.showApiKey"),disabled:r,onClick:o,children:r?a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):a.jsx(oqt,{visible:i})}),s&&a.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):l("agentWorkspace.notAvailable")}function bse({protocol:e,title:t,available:n,fields:i,example:r}){const{t:s}=Ae("ui");return a.jsxs("section",{className:`aw-integration-panel${n&&r?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[a.jsx("header",{children:a.jsx("h3",{children:t})}),a.jsx("dl",{children:i.map(o=>a.jsxs("div",{children:[a.jsx("dt",{children:o.label}),a.jsx("dd",{children:o.value||s("agentWorkspace.notAvailable")})]},o.label))}),n&&r&&a.jsxs("section",{className:"aw-integration-example",children:[a.jsx("h4",{children:s("agentWorkspace.pythonExample")}),a.jsx(Yu,{text:r,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function aqt(e,t,n){var i;return bz({appName:((i=e==null?void 0:e.appName)==null?void 0:i.trim())||t,name:e==null?void 0:e.name,description:e==null?void 0:e.description,type:e==null?void 0:e.type,model:e==null?void 0:e.model,tools:e==null?void 0:e.tools,skills:e==null?void 0:e.skills,graph:e==null?void 0:e.graph,draft:e==null?void 0:e.draft},n)}function E6e(e){return e?1+e.children.reduce((t,n)=>t+E6e(n),0):1}function C6e(e){return 1+e.subAgents.reduce((t,n)=>t+C6e(n),0)}function FB(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function lqt(e,t,n){const i=FB(e);return i?new Intl.DateTimeFormat(t,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(i)):n("agentWorkspace.unknownTime")}function cqt(e,t){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":t("agentWorkspace.scoreValue",{score:Math.round(e.score*100)})}function uqt(e,t){return t(`agentWorkspace.priority.${e}`)}const dqt={agent_structure:"agentWorkspace.modules.agentStructure",prompt:"agentWorkspace.modules.prompt",tool:"agentWorkspace.modules.tool",knowledge:"agentWorkspace.modules.knowledge",memory:"agentWorkspace.modules.memory",workflow:"agentWorkspace.modules.workflow",other:"agentWorkspace.modules.other"};function fqt(e,t){var n;return e.module==="other"?((n=e.customModule)==null?void 0:n.trim())||t("agentWorkspace.modules.other"):t(dqt[e.module])}function hqt(e,t){return e.find(n=>n.kind===t)}function yse(e,t){return e.items.map(n=>({...n,tag:t(n.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")})).sort((n,i)=>FB(i.createdAt)-FB(n.createdAt))}function pqt(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(i=>i.name),(n.mcpTools??[]).map(i=>i.name),n.skills??[],(n.selectedSkills??[]).map(i=>i.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}function mqt(e){return[{phase:"prepare",label:e("agentWorkspace.deploymentSteps.prepare.label"),description:e("agentWorkspace.deploymentSteps.prepare.description")},{phase:"build",label:e("agentWorkspace.deploymentSteps.build.label"),description:e("agentWorkspace.deploymentSteps.build.description")},{phase:"deploy",label:e("agentWorkspace.deploymentSteps.deploy.label"),description:e("agentWorkspace.deploymentSteps.deploy.description")},{phase:"publish",label:e("agentWorkspace.deploymentSteps.publish.label"),description:e("agentWorkspace.deploymentSteps.publish.description")},{phase:"complete",label:e("agentWorkspace.deploymentSteps.complete.label"),description:e("agentWorkspace.deploymentSteps.complete.description")}]}function gqt(e,t){return{phase:"update",label:t("agentWorkspace.deploymentSteps.update.label"),description:t("agentWorkspace.deploymentSteps.update.description",e)}}function T6e(e,t){const n=mqt(t),i=[...n.slice(0,-1)];return e.instanceRange&&i.push(gqt(e.instanceRange,t)),e.createEvaluationSets&&i.push({phase:"evaluation",label:t("agentWorkspace.deploymentSteps.evaluation.label"),description:t("agentWorkspace.deploymentSteps.evaluation.description")}),e.githubDelivery&&i.push({phase:"github",label:t("agentWorkspace.deploymentSteps.github.label"),description:t("agentWorkspace.deploymentSteps.github.description")}),i.push(n[n.length-1]),i}function A6e(e,t){const n=T6e(e,t);if(e.status==="success")return n.length-1;const i=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation","挂载 GitHub 持续交付":"github",部署完成:"complete"}[e.label],r=n.findIndex(s=>s.phase===i);return r<0?0:r}function bqt(e,t){if(!e)return"";try{return new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function _6e({log:e,autoExpand:t,title:n,ariaLabel:i,copyLabel:r,defaultPendingMessage:s}){const{t:o,i18n:l}=Ae("ui"),c=p.useRef(null),u=!!((e==null?void 0:e.status)!=="complete"&&t),[d,f]=p.useState(u),[h,m]=p.useState(!1),g=!!(e!=null&&e.text||e!=null&&e.error),b=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",v=b.split(` `),y=d?b:v.slice(-36).join(` -`),x=(e==null?void 0:e.pendingMessage)||s;if(p.useEffect(()=>{e&&f(u)},[e==null?void 0:e.status,u]),p.useEffect(()=>{if(!d||!g)return;const E=c.current;E&&(E.scrollTop=E.scrollHeight)},[d,g,y]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const w=mqt(e.updatedAt,l.resolvedLanguage??l.language),O=e.status==="complete"?o("agentWorkspace.logStatus.synced"):e.status==="error"?o("agentWorkspace.logStatus.failed"):o("agentWorkspace.logStatus.syncing"),S=e.omittedEarly?o("agentWorkspace.logStatus.earlyOmitted"):e.snapshotTruncated?o("agentWorkspace.logStatus.recentOnly"):e.truncated?o("agentWorkspace.logStatus.partiallyOmitted"):"",k=[O,e.lineCount?o("agentWorkspace.logLines",{count:e.lineCount}):"",S,w].filter(Boolean).join(" · ");async function C(){try{await navigator.clipboard.writeText(b),m(!0),window.setTimeout(()=>m(!1),1500)}catch{m(!1)}}return a.jsxs("section",{className:`aw-deploy-log is-${e.status}${d?"":" is-collapsed"}`,"aria-label":i,children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("strong",{children:n}),a.jsx("span",{children:k})]}),a.jsxs("div",{className:"aw-deploy-log-actions",children:[g&&a.jsx("button",{type:"button",onClick:()=>f(E=>!E),children:o(d?"common.collapse":"common.expand")}),g&&a.jsxs("button",{type:"button",onClick:()=>void C(),"aria-label":h?o("agentWorkspace.copiedLabel",{label:r}):o("agentWorkspace.copyLabel",{label:r}),title:h?o("agentWorkspace.copied"):o("agentWorkspace.copyLabel",{label:r}),children:[h?a.jsx(Md,{"aria-hidden":!0}):a.jsx(JI,{"aria-hidden":!0}),a.jsx("span",{children:o(h?"agentWorkspace.copied":"agentWorkspace.copy")})]})]})]}),d&&(g?a.jsx("pre",{ref:c,children:y}):a.jsx("div",{className:"aw-deploy-log-empty",children:x}))]})}function gqt({task:e}){var n;const{t}=Ae("ui");return a.jsx(_6e,{log:e.buildLog,autoExpand:((n=e.buildLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&A6e(e,t)===1,title:t("agentWorkspace.buildLog"),ariaLabel:t("agentWorkspace.buildLog"),copyLabel:t("agentWorkspace.buildLog"),defaultPendingMessage:t("agentWorkspace.waitingBuildLog")})}function bqt({task:e}){var n;const{t}=Ae("ui");return a.jsx(_6e,{log:e.githubLog,autoExpand:((n=e.githubLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&e.phase==="github",title:t("agentWorkspace.githubMountLog"),ariaLabel:t("agentWorkspace.githubDeliveryMountLog"),copyLabel:t("agentWorkspace.githubMountLog"),defaultPendingMessage:t("agentWorkspace.waitingGithubMountLog")})}function yqt({task:e,onReturnToEdit:t}){const{t:n}=Ae("ui"),i=T6e(e,n),r=A6e(e,n),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),o=e.status==="running"&&e.statusUnconfirmed?n("agentWorkspace.deployStatus.unconfirmed"):e.status==="running"?n("agentWorkspace.deployStatus.running"):e.status==="success"?n("agentWorkspace.deployStatus.success"):e.status==="error"?n("agentWorkspace.deployStatus.error"):n("agentWorkspace.deployStatus.cancelled");return a.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[a.jsxs("div",{className:"aw-deploy-progress-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"&&e.statusUnconfirmed?a.jsx(N_,{}):e.status==="running"?a.jsx(Ei,{className:"spin"}):e.status==="success"?a.jsx(qnt,{}):e.status==="error"?a.jsx(N_,{}):a.jsx(Z6,{})}),a.jsxs("div",{children:[a.jsx("h3",{children:o}),a.jsx("p",{children:e.runtimeName})]})]}),a.jsx("strong",{children:e.status==="running"&&!e.statusUnconfirmed?`${Math.round(s)}%`:e.label})]}),a.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":n("agentWorkspace.deploymentProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:a.jsx("span",{style:{width:`${s}%`}})}),a.jsx("ol",{className:"aw-deploy-steps",children:i.map((l,c)=>{const u=e.status==="success"||cnew Set),[mt,_n]=p.useState(()=>new Set),[Vt,Ai]=p.useState(!1),[jn,Hn]=p.useState(""),[En,vi]=p.useState(null),[Fn,di]=p.useState([]),[wr,mr]=p.useState([]),[ir,ze]=p.useState(!1),[kt,nn]=p.useState(""),[Nn,re]=p.useState(""),[xi,is]=p.useState(0),[$r,qn]=p.useState([]),[oi,Vi]=p.useState(!1),[Fr,ea]=p.useState(""),[za,Hr]=p.useState(0),[vo,Bs]=p.useState(null),[Js,js]=p.useState(1),[Us,xo]=p.useState(!1),[Oa,_i]=p.useState(""),[yi,Ll]=p.useState(0),[wo,Li]=p.useState(!1),[ul,$o]=p.useState(()=>new Set),[Ns,gc]=p.useState(!1),[ta,or]=p.useState(""),[Oo,rs]=p.useState(""),[Va,Qn]=p.useState(()=>new Set),Qs=p.useRef(!1),vs=p.useRef(""),ss=p.useRef(null),zs=p.useRef(0),qr=p.useRef(0),ji=p.useRef(0),[Fo,eo]=p.useState(XHt),[pu,dl]=p.useState("");p.useEffect(()=>{e.length!==0&&eo(de=>de.map((Ue,tt)=>tt===0&&Ue.agentIds.length===0?{...Ue,agentIds:e.slice(0,2).map(nt=>nt.id)}:Ue))},[e]);const ka=p.useMemo(()=>{const de=new Map;for(const Ue of e)Ue.runtimeId&&de.set(Ue.runtimeId,Ue);return de},[e]),Bo=p.useMemo(()=>{var Ue;const de=new Map;for(const tt of t){const nt=(Ue=tt.deploymentTarget)==null?void 0:Ue.runtimeId;if(!nt||!ka.has(nt))continue;const kn=de.get(nt);(!kn||tt.updatedAt>kn.updatedAt)&&de.set(nt,tt)}return de},[ka,t]),Wr=p.useMemo(()=>{const de=new Map;for(const Ue of f){if(!Ue.runtimeId)continue;const tt=de.get(Ue.runtimeId);(!tt||Ue.startedAt>tt.startedAt)&&de.set(Ue.runtimeId,Ue)}return de},[f]),id=p.useMemo(()=>{const de=Me.trim().toLowerCase();return de?e.filter(Ue=>{const tt=Ue.runtimeId?Bo.get(Ue.runtimeId):void 0,nt=Ue.runtimeId?Wr.get(Ue.runtimeId):void 0;return[Ue.label,Ue.app,Ue.host??"",(tt==null?void 0:tt.draft.name)??"",(tt==null?void 0:tt.draft.description)??"",(nt==null?void 0:nt.runtimeName)??""].join(" ").toLowerCase().includes(de)}):e},[e,Wr,Me,Bo]),xs=p.useMemo(()=>{const de=Me.trim().toLowerCase();return t.filter(Ue=>{var nt;const tt=(nt=Ue.deploymentTarget)==null?void 0:nt.runtimeId;return tt&&ka.has(tt)?!1:de?`${Ue.draft.name} ${Ue.draft.description}`.toLowerCase().includes(de):!0})},[ka,t,Me]),bc=p.useMemo(()=>t.filter(de=>{var tt;const Ue=(tt=de.deploymentTarget)==null?void 0:tt.runtimeId;return!Ue||!ka.has(Ue)}).length,[ka,t]),mu=p.useMemo(()=>{const de=Me.trim().toLowerCase();return de?Fo.filter(Ue=>Ue.name.toLowerCase().includes(de)):Fo},[Fo,Me]),we=e.find(de=>de.id===I),ai=t.find(de=>de.id===K),Yi=h?f.find(de=>de.id===h):void 0,na=we!=null&&we.runtimeId?Bo.get(we.runtimeId):void 0,gi=y?It:I&&r===I?i:null,Zi=(gi==null?void 0:gi.appName)||(we==null?void 0:we.runtimeApp)||(we==null?void 0:we.app)||"",Ha=(c&&(we!=null&&we.runtimeId)?hse:hse.filter(de=>de!=="usage")).map(de=>({id:de,label:A(`agentWorkspace.sections.${de}`)})),Uo=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"cn-beijing",Zi,Js]),os=(vo==null?void 0:vo.requestKey)===Uo?vo.value:null,ia=`${(we==null?void 0:we.region)??"cn-beijing"}:${(we==null?void 0:we.runtimeId)??""}`,$l=(Ne==null?void 0:Ne.requestKey)===ia?Ne.value:"",gr=(X==null?void 0:X.requestKey)===ia?X:null,Qo=!!((Jn=gr==null?void 0:gr.apiApps)!=null&&Jn.length),qa=!!(gr!=null&&gr.a2a),ra=((Jf=gr==null?void 0:gr.apiApps)==null?void 0:Jf[0])??Zi,Mn=(W==null?void 0:W.endpoint)??"",Wa=eqt(((S1=gr==null?void 0:gr.a2a)==null?void 0:S1.endpoint)??"",Mn),sa=(we==null?void 0:we.runtimeApp)||"",Ka=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"",(we==null?void 0:we.currentVersion)??null,sa]),_e=l&&(we!=null&&we.runtimeId)&&we.region&&ln===0?L6({runtimeId:we.runtimeId,region:we.region,appName:sa,currentVersion:we.currentVersion}):null,Je=(ue==null?void 0:ue.requestKey)===Ka?ue.value:_e,Mt=Je!=null&&Je.reason?Fu(Je.reason,P.resolvedLanguage||P.language):"",Tn=(Je==null?void 0:Je.warnings.filter(de=>Fu(de,P.resolvedLanguage||P.language)))??[];p.useEffect(()=>{const de=zs.current+1;zs.current=de,xe(null),At("");const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"";if(!l||!Ue||!tt){qe(!1);return}const nt=ln===0?L6({runtimeId:Ue,region:tt,appName:sa,currentVersion:we==null?void 0:we.currentVersion}):null;if(nt){xe({requestKey:Ka,value:nt}),qe(!1);return}const kn=new AbortController;let ct,wi=0;const io=60;qe(!0);const Oi=Vs=>{DI({runtimeId:Ue,region:tt,appName:sa,currentVersion:we==null?void 0:we.currentVersion,signal:kn.signal,force:Vs&&ln>0}).then(ml=>{var b0,xT;if(de!==zs.current)return;const Pp=ml.recoveryStatus==="preparing";if(ml.runtime.runtimeId!==Ue||ml.runtime.region!==tt||!Pp&&sa&&((b0=ml.agent)==null?void 0:b0.appName)!==sa||ml.canUpdate&&!((xT=ml.agent)!=null&&xT.appName)){At(A("agentWorkspace.errors.updateCapabilityMismatch"));return}if(xe({requestKey:Ka,value:ml}),qe(!1),!!Pp){if(wi+=1,wi>=io){At(A("agentWorkspace.errors.updateConfigRestoring"));return}ct=window.setTimeout(()=>Oi(!1),1e3)}}).catch(()=>{de!==zs.current||kn.signal.aborted||At(A("agentWorkspace.errors.checkUpdateCapability"))}).finally(()=>{de===zs.current&&!kn.signal.aborted&&qe(!1)})};return Oi(!0),()=>{kn.abort(),ct!=null&&window.clearTimeout(ct)}},[l,sa,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId,Ka]);const on=p.useMemo(()=>{const de=new Map(e.map((tt,nt)=>[tt.id,nt])),Ue=new Map(n.map((tt,nt)=>[tt,nt]));return[...id].sort((tt,nt)=>{const kn=tt.runtimeId?Wr.get(tt.runtimeId):void 0,ct=nt.runtimeId?Wr.get(nt.runtimeId):void 0,wi=(kn==null?void 0:kn.status)==="running"?kn.startedAt:0,io=(ct==null?void 0:ct.status)==="running"?ct.startedAt:0;if(wi!==io)return io-wi;const Oi=Ue.get(tt.id),Vs=Ue.get(nt.id);return Oi!=null&&Vs!=null?Oi-Vs:Oi!=null?-1:Vs!=null?1:(de.get(tt.id)??0)-(de.get(nt.id)??0)})},[n,e,id,Wr]),bn=(we==null?void 0:we.label)||(gi==null?void 0:gi.name)||(ai==null?void 0:ai.draft.name)||(Yi==null?void 0:Yi.agentName)||((g0=Yi==null?void 0:Yi.agentDraft)==null?void 0:g0.name)||A("agentWorkspace.noAgentSelected"),On=Fo.find(de=>de.id===pu),ae=on.filter(de=>de.canDelete===!0),Pe=on.filter(de=>vn.has(de.id)&&de.canDelete===!0),et=xs.filter(de=>mt.has(de.id)),ht=ae.length+xs.length,Yt=Pe.length+et.length,un=p.useMemo(()=>{var Ue;if(Yi!=null&&Yi.agentDraft)return Yi.agentDraft;if(ai!=null&&ai.draft)return ai.draft;const de=(Ue=we==null?void 0:we.region)!=null&&Ue.startsWith("ap-")?"byteplus":"volcengine";return Je!=null&&Je.agent&&(Je.recoveryStatus==="complete"||Je.recoveryStatus==="draft-only")?bz(Je.agent,de,Je.runtime.configuredEnvKeys):sqt(gi,Zi||(we==null?void 0:we.label)||"agent",de)},[gi,Zi,we==null?void 0:we.label,we==null?void 0:we.region,ai==null?void 0:ai.draft,Yi==null?void 0:Yi.agentDraft,Je]),Kr=((vT=gi==null?void 0:gi.draft)==null?void 0:vT.harnessSidecar)??Ivt(W==null?void 0:W.envs),zo=Kr?Yw.filter(de=>Kr.componentOverrides[de]):[],fl=ai?o?"":A("agentWorkspace.errors.noCreatePermission"):l?we!=null&&we.runtimeId?we.region?Te?A("agentWorkspace.errors.checkingUpdateConfig"):De||(Je?Je.recoveryStatus!=="complete"&&Je.recoveryStatus!=="draft-only"?Mt||A("agentWorkspace.errors.originalConfigUnavailable"):Je.canUpdate?(gu=Je.agent)!=null&&gu.appName?"":A("agentWorkspace.errors.agentInfoMissing"):Mt||A("agentWorkspace.errors.updateUnsupported"):A("agentWorkspace.errors.updateCapabilityPending")):A("agentWorkspace.errors.runtimeRegionMissing"):A("agentWorkspace.errors.cloudOnlyUpdate"):A("agentWorkspace.errors.noManagePermission"),hl="aw-update-disabled-reason",Xf=p.useMemo(()=>{if(gi)return gi.tools;const de=(un.builtinTools??[]).map(Ue=>{var tt;return((tt=Xw.find(nt=>nt.id===Ue))==null?void 0:tt.label)??Ue});return Array.from(new Set([...un.tools,...de,...(un.customTools??[]).map(Ue=>Ue.name),...(un.mcpTools??[]).map(Ue=>Ue.name)].filter(Boolean)))},[un,gi]),Hi=p.useMemo(()=>gi?gi.skillsPreviewSupported?gi.skills.map(de=>de.name):null:Array.from(new Set([...(un.selectedSkills??[]).map(de=>de.name),...un.skills].filter(Boolean))),[un,gi]),qi=p.useMemo(()=>{if(Yi)return Yi;if(ai){const de=f.filter(Ue=>Ue.draftId===ai.id).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0];return de||f.filter(Ue=>{var tt,nt;return((tt=Ue.agentDraft)==null?void 0:tt.name)===ai.draft.name||Ue.agentName===ai.draft.name||!!((nt=ai.deploymentTarget)!=null&&nt.runtimeId)&&Ue.runtimeId===ai.deploymentTarget.runtimeId}).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0]}if(we)return f.filter(de=>!!we.runtimeId&&de.runtimeId===we.runtimeId||de.agentName===we.label).sort((de,Ue)=>Ue.startedAt-de.startedAt)[0]},[f,we,ai,Yi]),Tt=!!(h&&qi&&qi.id===h),fi=!!(qi&&(qi.status!=="success"||Tt)),ee=(qi==null?void 0:qi.status)==="running",Fe=qi!=null&&qi.draftId?t.find(de=>de.id===qi.draftId)??(qi.agentDraft?{id:qi.draftId,draft:qi.agentDraft,updatedAt:qi.startedAt}:void 0):void 0,pt=p.useMemo(()=>fqt(un),[un]),qt=(we==null?void 0:we.currentVersion)??(W==null?void 0:W.currentVersion)??null,xn=qt??(Yi==null?void 0:Yi.startedAt)??"unknown",Zn=gi?`runtime:${(we==null?void 0:we.runtimeId)??gi.name}:v${xn}:${pt}`:`draft:${(Yi==null?void 0:Yi.id)??(ai==null?void 0:ai.id)??(we==null?void 0:we.id)??bn}:${pt}`;p.useEffect(()=>{L==="usage"&&!c&&U("basic")},[c,L]),p.useEffect(()=>{if(!h)return;const de=f.find(tt=>tt.id===h),Ue=de!=null&&de.runtimeId?ka.get(de.runtimeId):void 0;if(Ue){F(""),H(Ue.id),U("basic");return}H(""),F(""),U("basic")},[ka,f,h]),p.useEffect(()=>{if(!m){vs.current="";return}const de=`${m}:${g}:${b}:${c}`;vs.current!==de&&e.some(Ue=>Ue.id===m)&&(vs.current=de,F(""),H(m),U(g==="usage"&&!c?"basic":g),g==="evaluations"&&(st(b),ft("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const de of on.slice(0,8)){if(!de.runtimeId)continue;const Ue=de.region??"cn-beijing";xCe(de.runtimeId,Ue),yEe(de.runtimeId,Ue,de.runtimeApp??"")}},[on]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=(we==null?void 0:we.runtimeApp)??"",kn=Ue?bEe(Ue,tt,nt):null;if(lt(kn),yt(""),vt(!1),Ct(!!kn||!y||!Ue),!(!y||!Ue))return hU(Ue,tt,nt,{force:!0}).then(ct=>{de||lt(ct)}).catch(ct=>{!de&&!kn&<(null),de||(vt(ct instanceof co&&ct.unsupported),yt(A("agentWorkspace.errors.loadAgentInfo")))}).finally(()=>{de||Ct(!0)}),()=>{de=!0}},[y,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeApp,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing";if(qn([]),ea(""),L!=="optimizations"||!Ue){Vi(!1);return}if(y&&!Zi){Vi(!Ot);return}return Vi(!0),aEe({runtimeId:Ue,region:tt,appName:Zi}).then(nt=>{de||qn(nt.groups)}).catch(()=>{de||ea(A("agentWorkspace.errors.loadOptimizations"))}).finally(()=>{de||Vi(!1)}),()=>{de=!0}},[Ot,y,za,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{js(1)},[we==null?void 0:we.runtimeId,Zi]),p.useEffect(()=>{const de=ji.current+1;ji.current=de;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Zi;if(_i(""),L!=="usage"||!Ue){xo(!1);return}if(!nt){xo(y&&!Ot);return}const kn=new AbortController;return xo(!0),oCe({runtimeId:Ue,region:tt,appName:nt,page:Js,pageSize:ZHt,signal:kn.signal}).then(ct=>{if(de===ji.current){if(ct.runtimeId!==Ue||ct.appName!==nt||ct.page!==Js){_i(A("agentWorkspace.errors.usageMismatch"));return}Bs({requestKey:Uo,value:ct})}}).catch(()=>{de!==ji.current||kn.signal.aborted||_i(A("agentWorkspace.errors.loadUsage"))}).finally(()=>{de===ji.current&&xo(!1)}),()=>{kn.abort()}},[Js,yi,Uo,Ot,y,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{qr.current+=1,pe(null),se(!1),Le(!1),Ve(""),ye("api-server")},[ia,L]);function Gr(){qr.current+=1,pe(null),se(!1),Le(!1),Ve("")}function Or(de){de!==te&&(Gr(),ye(de))}async function Tr(){if(me){Gr();return}const de=(we==null?void 0:we.runtimeId)??"",Ue=(we==null?void 0:we.region)??"cn-beijing";if(!de)return;const tt=qr.current+1;qr.current=tt,Le(!0),Ve("");try{const nt=await gCe(de,Ue);if(tt!==qr.current)return;pe({requestKey:ia,value:nt}),se(!0)}catch(nt){if(tt!==qr.current)return;pe(null),se(!1),Ve(nt instanceof Error?nt.message:A("agentWorkspace.errors.loadApiKey"))}finally{tt===qr.current&&Le(!1)}}p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue?vCe(Ue,tt):null;if(V(nt),Nt(""),!!Ue)return xU(Ue,tt,{force:!0}).then(kn=>{de||V(kn)}).catch(()=>{!de&&!nt&&V(null),de||Nt(A("agentWorkspace.errors.loadRuntimeDetails"))}),()=>{de=!0}},[ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"";if(ke(""),L!=="versions"||!Ue){ge(!1),Ue||Re(null);return}return ge(!0),C_(Ue).then(tt=>{de||Re(tt)}).catch(()=>{de||(Re(null),ke(A("agentWorkspace.errors.loadGithubVersions")))}).finally(()=>{de||ge(!1)}),()=>{de=!0}},[L,we==null?void 0:we.currentVersion,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=`${tt}:${Ue}`;if(Ee(""),L!=="integrations"||!Ue){Z(!1),Ue||ie(null);return}Z(!0);const kn=Vx(Ue,tt,{retryProbe:!0}).catch(ct=>{if(ct instanceof co&&ct.unsupported)return null;throw ct});return Promise.all([kn,mCe(Ue,tt,{retryProbe:!0})]).then(([ct,wi])=>{de||ie({requestKey:nt,apiApps:ct,a2a:wi})}).catch(()=>{de||(ie(null),Ee(A("agentWorkspace.errors.probeIntegration")))}).finally(()=>{de||Z(!1)}),()=>{de=!0}},[Y,L,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue&&Zi?lEe({runtimeId:Ue,region:tt,appName:Zi,pageSize:100}):null;if(di(nt?yse(nt,A):[]),mr((nt==null?void 0:nt.sets)??[]),nn(""),re((nt==null?void 0:nt.unsupportedMessage)??""),L!=="evaluations"||!Ue){ze(!1);return}if(y&&!Zi){ze(!Ot);return}return ze(!nt),RI({runtimeId:Ue,region:tt,appName:Zi,pageSize:100},{force:!0}).then(kn=>{de||(mr(kn.sets),di(yse(kn,A)),re(kn.unsupportedMessage??""))}).catch(()=>{de||(nn(A("agentWorkspace.errors.loadEvaluations")),re(""))}).finally(()=>{de||ze(!1)}),()=>{de=!0}},[Ot,y,xi,L,Zi,gi==null?void 0:gi.appName,we==null?void 0:we.region,we==null?void 0:we.runtimeId,A]);async function kr(de){const Ue=(we==null?void 0:we.runtimeId)??"",tt=de.commitSha??"";if(!(!Ue||!tt||Ke)){it(tt),ke("");try{await YEe({runtimeId:Ue,targetCommitSha:tt});const nt=await C_(Ue);Re(nt)}catch(nt){ke(nt instanceof Error?nt.message:A("agentWorkspace.errors.rollbackVersion"))}finally{it("")}}}p.useEffect(()=>{const de=new Set(Fn.map(Ue=>Ue.id));$o(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt}),Qn(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt}),Oo&&!de.has(Oo)&&rs("")},[Fn,Oo]),p.useEffect(()=>{Li(!1),$o(new Set),Qn(new Set),or(""),rs("")},[we==null?void 0:we.runtimeId]),p.useEffect(()=>{const de=new Set(on.filter(Ue=>Ue.canDelete===!0).map(Ue=>Ue.id));Ye(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt})},[on]),p.useEffect(()=>{const de=new Set(xs.map(Ue=>Ue.id));_n(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt})},[xs]);const Xr=p.useMemo(()=>!v||!(we!=null&&we.runtimeId)||v.runtimeId!==we.runtimeId||Zi&&v.agentName&&v.agentName!==Zi?null:{...v,tag:A(v.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},[v,we==null?void 0:we.runtimeId,Zi,A]),pl=p.useMemo(()=>GHt(A),[A]),to=p.useMemo(()=>we!=null&&we.runtimeId?Xr?[Xr,...Fn.filter(de=>de.id!==Xr.id&&(!de.messageId||de.messageId!==Xr.messageId))]:Fn:pl,[pl,Fn,Xr,we==null?void 0:we.runtimeId]),Ar=to.filter(de=>{if(de.kind!==gt||(de.source==="auto"?"auto":"user")!==Ht)return!1;const tt=xt.trim().toLowerCase();return tt?[de.input,de.output,de.referenceOutput,de.comment,de.tag??"",de.sessionId,de.messageId,de.userId,de.evaluationSetName].join(" ").toLowerCase().includes(tt):!0}),ws=Ar.filter(de=>ul.has(de.id)),no=!!(we!=null&&we.runtimeId),Hd=de=>{st(de),ft(""),or("");const Ue=to.find(tt=>tt.kind===de);rs((Ue==null?void 0:Ue.id)??""),window.setTimeout(()=>{var tt;(tt=ss.current)==null||tt.scrollIntoView({behavior:"smooth",block:"start"})},0)},Fg=de=>{or(""),$o(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt})},d0=()=>{or(""),$o(new Set(Ar.map(de=>de.id)))},f0=()=>{or(""),$o(new Set),Li(!1)},h0=de=>{Qn(Ue=>{const tt=new Set(Ue);return tt.has(de)?tt.delete(de):tt.add(de),tt})},p0=de=>{rs(de.id),or(""),!(!de.sessionId||!de.messageId)&&(R==null||R(de))},Bg=async de=>{if(!(we!=null&&we.runtimeId)||!Zi||Ns||de.length===0)return;const Ue=de.length===1?A("agentWorkspace.deleteOneCaseConfirm"):A("agentWorkspace.deleteCasesConfirm",{count:de.length});if(!window.confirm(Ue))return;const tt=de.map(kn=>kn.id),nt=new Set(tt);gc(!0),or("");try{await dEe({runtimeId:we.runtimeId,region:we.region??"cn-beijing",appName:Zi,itemIds:tt});const kn=new Map;for(const ct of de)kn.set(ct.kind,(kn.get(ct.kind)??0)+1);di(ct=>ct.filter(wi=>!nt.has(wi.id))),mr(ct=>ct.map(wi=>({...wi,itemCount:Math.max(0,wi.itemCount-(kn.get(wi.kind)??0))}))),$o(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Qn(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Oo&&nt.has(Oo)&&rs(""),de.length>1&&Li(!1),_==null||_(de)}catch(kn){or(kn instanceof Error?kn.message:String(kn))}finally{gc(!1)}},$i=de=>{eo(Ue=>Ue.map(tt=>tt.id===de.id?de:tt))},yc=()=>{const de=new Set(e.map(nt=>nt.id)),Ue=n.filter(nt=>de.has(nt)),tt=new Set(Ue);return[...Ue,...e.filter(nt=>!tt.has(nt.id)).map(nt=>nt.id)]},Ug=(de,Ue,tt)=>{if(!O||de===Ue)return;const nt=yc().filter(wi=>wi!==de),kn=nt.indexOf(Ue),ct=kn<0?nt.length:tt==="after"?kn+1:kn;nt.splice(ct,0,de),O(nt)},Yf=(de,Ue)=>{if(!hn||hn===Ue)return;const tt=de.currentTarget.getBoundingClientRect();St(Ue),Rt(de.clientY>tt.top+tt.height/2?"after":"before")},Rp=(de,Ue)=>{if(!O)return;const tt=yc(),nt=tt.indexOf(de),kn=Math.max(0,Math.min(tt.length-1,nt+Ue));nt<0||nt===kn||(tt.splice(nt,1),tt.splice(kn,0,de),O(tt))},Ip=de=>{de.canDelete===!0&&(Hn(""),Ye(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt}))},Zf=de=>{Hn(""),_n(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt})},qd=()=>{Hn(""),Ye(new Set(ae.map(de=>de.id))),_n(new Set(xs.map(de=>de.id)))},rd=()=>{Hn(""),Ye(new Set),_n(new Set),ot(!1)},Qg=()=>{if(Yt===0||Vt)return;const de=Pe.length,Ue=et.length;Hn(""),vi({kind:"selection",title:A(de===1&&Ue===0?"agentWorkspace.deleteAgentTitle":de===0&&Ue===1?"myAgents.deleteDraftTitle":"agentWorkspace.deleteSelectedTitle"),description:de===1&&Ue===0?A("agentWorkspace.deleteAgentDescription",{name:Pe[0].label}):de===0&&Ue===1?A("agentWorkspace.deleteDraftDescription",{name:et[0].draft.name||A("agentSelector.unnamedAgent")}):A("agentWorkspace.deleteSelectionDescription",{count:Yt,warning:de>0?A("agentWorkspace.runtimeDeletionWarning",{count:de}):A("agentWorkspace.draftDeletionWarning")}),confirmLabel:A(de===0&&Ue===1?"myAgents.deleteDraft":"agentWorkspace.deleteSelected"),agents:Pe,drafts:et})},zg=async()=>{if(!(!En||Vt)){Ai(!0),Hn("");try{if(En.kind==="selection"){const{agents:de,drafts:Ue}=En;if(de.length>0){if(!S)throw new Error(A("agentWorkspace.errors.deleteDeployedUnsupported"));await S(de)}Ue.length>0&&(k==null||k(Ue)),Ye(new Set),_n(new Set),ot(!1),de.some(tt=>tt.id===I)&&H(""),Ue.some(tt=>tt.id===K)&&F("")}else if(En.kind==="agent"){if(!S)throw new Error(A("agentWorkspace.errors.deleteDeployedUnsupported"));await S([En.agent]),I===En.agent.id&&H("")}else{if(!k)throw new Error(A("agentWorkspace.errors.deleteDraftUnsupported"));k([En.draft]),K===En.draft.id&&F("")}vi(null)}catch(de){Hn(de instanceof Error?de.message:String(de))}finally{Ai(!1)}}},Ft=de=>{!S||de.canDelete!==!0||Vt||(Hn(""),vi({kind:"agent",title:A("agentWorkspace.deleteAgentTitle"),description:A("agentWorkspace.deleteAgentDescription",{name:de.label}),confirmLabel:A("agentWorkspace.deleteAgent"),agent:de}))},_r=de=>{if(!k||Vt)return;const Ue=de.draft.name||A("agentSelector.unnamedAgent");Hn(""),vi({kind:"draft",title:A("myAgents.deleteDraftTitle"),description:A("agentWorkspace.deleteDraftDescription",{name:Ue}),confirmLabel:A("myAgents.deleteDraft"),draft:de})},sd=()=>{const de=`eval-${Date.now()}`,Ue={id:de,name:A("agentWorkspace.newEvaluationGroupName",{count:Fo.length+1}),agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};eo(tt=>[Ue,...tt]),dl(de)},m0=de=>{$i({...de,history:[{id:`run-${Date.now()}`,createdAt:A("agentWorkspace.evaluationDefaults.justNow"),score:86+de.history.length%7,status:"completed"},...de.history]})};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[a.jsxs("nav",{className:"aw-view-tabs","aria-label":A("agentWorkspace.workspace"),children:[a.jsx("button",{type:"button",className:D==="library"?"is-active":"","aria-pressed":D==="library",onClick:()=>{M("library"),We("")},children:A("agentWorkspace.library")}),a.jsx("button",{type:"button",className:D==="evaluation"?"is-active":"","aria-pressed":D==="evaluation",onClick:()=>{M("evaluation"),We("")},children:A("agentWorkspace.evaluation")})]}),a.jsxs("div",{className:"aw-workspace-frame",children:[a.jsxs("div",{className:"aw-workspace","aria-hidden":D==="evaluation"||void 0,ref:de=>{de==null||de.toggleAttribute("inert",D==="evaluation")},children:[a.jsxs("aside",{className:"aw-sidebar","aria-label":A(D==="library"?"agentWorkspace.agentList":"agentWorkspace.evaluationGroupList"),children:[a.jsxs("label",{className:"aw-search",children:[a.jsx(vN,{"aria-hidden":!0}),a.jsx("input",{value:Me,onChange:de=>We(de.currentTarget.value),placeholder:A(D==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups"),"aria-label":A(D==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups")})]}),a.jsxs("button",{type:"button",className:"aw-create-card",onClick:D==="library"?j:sd,disabled:D==="library"&&!o,children:[a.jsx(Tl,{"aria-hidden":!0}),a.jsx("span",{children:A(D==="library"?"agentWorkspace.newAgent":"agentWorkspace.newEvaluationGroup")})]}),D==="library"&&(S||k)&&a.jsx("div",{className:`aw-selection-toolbar${$e?" is-active":""}`,children:$e?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-selection-count",children:A("agentWorkspace.selectedCount",{count:Yt})}),a.jsx("button",{type:"button",onClick:qd,disabled:ht===0||Vt,children:A("agentWorkspace.selectAll")}),a.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Qg(),disabled:Yt===0||Vt,children:A(Vt?"common.deleting":"agentWorkspace.deleteSelected")}),a.jsx("button",{type:"button",onClick:rd,disabled:Vt,children:A("common.cancel")})]}):a.jsx("button",{type:"button",onClick:()=>{Hn(""),ot(!0)},disabled:ht===0,children:A("common.select")})}),D==="library"&&jn&&a.jsx("div",{className:"aw-delete-error",role:"alert",children:jn}),a.jsx("div",{className:"aw-agent-list",children:D==="evaluation"?mu.length===0?a.jsx("div",{className:"aw-list-empty",children:A("agentWorkspace.noMatchingEvaluationGroups")}):mu.map(de=>a.jsxs("button",{type:"button",className:`aw-agent-item${de.id===pu?" is-active":""}`,onClick:()=>dl(de.id),children:[a.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[a.jsx("strong",{children:ok(de.name,A)}),a.jsx("small",{children:A("agentWorkspace.groupStats",{agents:de.agentIds.length,runs:de.history.length})})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)):u&&on.length===0&&xs.length===0?a.jsx("div",{className:"aw-list-empty",children:A("agentWorkspace.loadingCloudAgents")}):d&&on.length===0&&xs.length===0?a.jsxs("div",{className:"aw-list-empty aw-list-error",children:[a.jsx("span",{children:d}),w&&a.jsx("button",{type:"button",onClick:w,children:A("common.retry")})]}):on.length===0&&xs.length===0?a.jsx("div",{className:"aw-list-empty",children:A("myAgents.noMatchingAgents")}):a.jsxs(a.Fragment,{children:[xs.map(de=>{const tt=f.filter(kn=>kn.draftId===de.id).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0]??f.filter(kn=>{var ct,wi;return((ct=kn.agentDraft)==null?void 0:ct.name)===de.draft.name||kn.agentName===de.draft.name||!!((wi=de.deploymentTarget)!=null&&wi.runtimeId)&&kn.runtimeId===de.deploymentTarget.runtimeId}).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0],nt=mt.has(de.id);return a.jsxs("button",{type:"button",className:["aw-agent-item",$e?"is-selecting":"",nt?"is-selected-for-delete":"",de.id===K?"is-active":""].filter(Boolean).join(" "),"aria-pressed":$e?nt:void 0,onClick:()=>{if($e){Zf(de);return}H(""),F(de.id),U("basic")},children:[$e&&a.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),a.jsxs("span",{className:"aw-agent-copy",children:[a.jsxs("span",{className:"aw-agent-name-row",children:[a.jsx("strong",{children:de.draft.name||A("agentSelector.unnamedAgent")}),a.jsx("span",{className:`aw-draft-badge${(tt==null?void 0:tt.status)==="running"?" is-deploying":""}`,children:(tt==null?void 0:tt.status)==="running"?A("myAgents.deploying"):A("myAgents.draft")})]}),a.jsx("small",{children:de.deploymentTarget?A("agentWorkspace.updatePending"):A("agentWorkspace.notPublished")})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)}),on.map(de=>{const Ue=de.runtimeId?Wr.get(de.runtimeId):void 0,tt=de.runtimeId?Bo.get(de.runtimeId):void 0,nt=vn.has(de.id),kn=de.canDelete===!0,ct=(Ue==null?void 0:Ue.status)==="running"?{label:A("myAgents.deploying"),className:" is-deploying"}:(Ue==null?void 0:Ue.status)==="error"?{label:A("agentWorkspace.failed"),className:" is-error"}:(Ue==null?void 0:Ue.status)==="cancelled"?{label:A("agentWorkspace.cancelled"),className:" is-muted"}:tt?{label:A("agentWorkspace.updatePending"),className:""}:null,wi=(Ue==null?void 0:Ue.status)==="running"?A("agentWorkspace.updatingDeployment"):tt?A("agentWorkspace.updatePending"):de.remote?de.host||A("agentWorkspace.remoteAgent"):A("agentWorkspace.localAgent"),io=["aw-agent-item","aw-agent-item--sortable",de.id===I?"is-active":"",$e?"is-selecting":"",nt?"is-selected-for-delete":"",$e&&!kn?"is-selection-disabled":"",de.id===hn?"is-dragging":"",de.id===bt&&de.id!==hn?`is-drop-target is-drop-${dn}`:""].filter(Boolean).join(" ");return a.jsxs("button",{type:"button",draggable:!!O&&!$e,className:io,"aria-pressed":$e?nt:void 0,"aria-keyshortcuts":O?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Oi=>{O&&(Qs.current=!0,Ge(de.id),Oi.dataTransfer.effectAllowed="move",Oi.dataTransfer.setData("text/plain",de.id))},onDragEnter:Oi=>{Yf(Oi,de.id)},onDragOver:Oi=>{!hn||hn===de.id||(Oi.preventDefault(),Oi.dataTransfer.dropEffect="move",Yf(Oi,de.id))},onDragLeave:Oi=>{const Vs=Oi.relatedTarget;Vs instanceof Node&&Oi.currentTarget.contains(Vs)||bt===de.id&&St("")},onDrop:Oi=>{Oi.preventDefault();const Vs=Oi.dataTransfer.getData("text/plain")||hn;Ug(Vs,de.id,dn),Ge(""),St(""),Rt("before")},onDragEnd:()=>{Ge(""),St(""),Rt("before"),window.setTimeout(()=>{Qs.current=!1},0)},onKeyDown:Oi=>{Oi.altKey&&(Oi.key==="ArrowUp"?(Oi.preventDefault(),Rp(de.id,-1)):Oi.key==="ArrowDown"&&(Oi.preventDefault(),Rp(de.id,1)))},onClick:Oi=>{if($e){Oi.preventDefault(),Ip(de);return}if(Qs.current){Oi.preventDefault(),Qs.current=!1;return}F(""),H(de.id),U("basic"),C(de.id)},children:[$e&&a.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),a.jsxs("span",{className:"aw-agent-copy",children:[a.jsxs("span",{className:"aw-agent-name-row",children:[a.jsx("strong",{children:de.label}),de.currentVersion!=null&&a.jsxs("span",{className:"aw-version-badge",children:["v",de.currentVersion]}),ct&&a.jsx("span",{className:`aw-draft-badge${ct.className}`,children:ct.label})]}),a.jsx("small",{children:wi})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)})]})}),a.jsx("div",{className:"aw-list-count",children:A("agentWorkspace.totalCount",{count:D==="library"?e.length+bc:Fo.length})})]}),D==="evaluation"&&On?a.jsx(kqt,{group:On,agents:e,cases:to,onChange:$i,onRun:m0}):D==="evaluation"?a.jsx("main",{className:"aw-main aw-empty-selection",children:a.jsx("p",{children:A("agentWorkspace.noEvaluationGroupSelected")})}):!we&&!ai&&!Yi?a.jsx("main",{className:"aw-main aw-empty-selection",children:a.jsx("p",{children:A("agentWorkspace.noAgentSelected")})}):a.jsxs("main",{className:`aw-main${ee?" is-deploying":""}${y?" resource-page":""}`,children:[we&&!gi&&s&&a.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"aw-detail-loading-card",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsxs("span",{children:[a.jsx("strong",{children:A("agentWorkspace.loadingAgent")}),a.jsx("small",{children:A("agentWorkspace.loadingAgentDescription")})]})]})}),L==="integrations"&&Q&&a.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"aw-detail-loading-card",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsxs("span",{children:[a.jsx("strong",{children:A("agentWorkspace.probingIntegration")}),a.jsx("small",{children:A("agentWorkspace.probingIntegrationDescription")})]})]})}),a.jsx(LC,{className:"aw-agent-detail",title:bn,description:un.description||A(s||y&&!Ot?"agentWorkspace.loadingAgentInfo":"common.noDescription"),identitySeed:bn,backLabel:A("agentWorkspace.backToAgentList"),onBack:y?x:void 0,meta:a.jsxs(a.Fragment,{children:[qt!=null&&a.jsxs("span",{className:"aw-agent-meta",children:["v",qt]}),ai&&a.jsx("span",{className:"aw-agent-meta",children:A("myAgents.draft")}),na&&a.jsx("span",{className:"aw-agent-meta",children:A("agentWorkspace.updatePending")}),!we&&!ai&&Yi&&a.jsx("span",{className:"aw-agent-meta",children:Yi.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:ai||na||we!=null&&we.canDelete?a.jsxs(a.Fragment,{children:[(ai||na)&&a.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const de=ai??na;de&&_r(de)},disabled:Vt,"aria-label":A("myAgents.deleteDraft"),title:A("myAgents.deleteDraft"),children:[a.jsx(rg,{"aria-hidden":!0}),a.jsx("span",{children:A("myAgents.deleteDraft")})]}),(we==null?void 0:we.canDelete)&&a.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void Ft(we),disabled:Vt,"aria-label":A("agentWorkspace.deleteAgent"),title:A("agentWorkspace.deleteAgent"),children:[a.jsx(rg,{"aria-hidden":!0}),a.jsx("span",{children:A(Vt?"common.deleting":"agentWorkspace.deleteAgent")})]})]}):void 0,sections:Ha.map(de=>{var Ue,tt,nt,kn;return{key:de.id,label:de.label,disabled:ee,content:de.id===L?a.jsxs(a.Fragment,{children:[qi&&fi&&a.jsx("div",{className:`aw-detail-deployment${ee?" is-running":""}`,children:a.jsx(yqt,{task:qi,onReturnToEdit:Fe&&N?()=>N(Fe):void 0})}),a.jsxs("div",{className:"aw-content",children:[L==="basic"&&a.jsxs("div",{className:"aw-basic-stack",children:[Ie&&a.jsx(Oy,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:A("agentWorkspace.partialInfoUnavailable"),description:A("agentWorkspace.upgradeRuntimeForDetails")}),(dt&&!Ie||jt)&&a.jsx(Oy,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:A("agentWorkspace.detailLoadFailed"),description:A("agentWorkspace.detailLoadFailedDescription"),actions:a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>He(ct=>ct+1),children:A("common.retry")})}),we&&Je&&!Je.canUpdate&&a.jsxs("div",{className:"aw-update-recovery-notice",role:Je.recoveryStatus==="preparing"?"status":"alert",children:[a.jsx("strong",{children:Je.recoveryStatus==="preparing"?A("agentWorkspace.restoringUpdateConfig"):A("agentWorkspace.updateConfigUnavailable")}),Mt&&a.jsx("span",{children:Mt}),Tn.map(ct=>a.jsx("span",{children:ct},ct))]}),a.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:A("agentWorkspace.deploymentConfig")}),a.jsx("p",{children:A("agentWorkspace.deploymentConfigDescription")})]})}),a.jsxs("dl",{className:"aw-readonly-config",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.runtimeStatus")}),a.jsxs("dd",{className:(W==null?void 0:W.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(W==null?void 0:W.status.toLowerCase())==="ready"&&a.jsx("span",{className:"aw-status-dot"}),(W==null?void 0:W.status)||A("agentWorkspace.loading")]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.deploymentRegion")}),a.jsx("dd",{children:(W==null?void 0:W.region)||(we==null?void 0:we.region)||(qi==null?void 0:qi.region)||A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.networkAccess")}),a.jsx("dd",{children:W!=null&&W.networkTypes.length?W.networkTypes.join(" / "):A("agentWorkspace.notAvailable")})]})]})]}),a.jsxs("section",{className:"aw-canvas-card",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:A("agentWorkspace.executionFlow")})}),a.jsx("div",{className:"aw-canvas",children:a.jsx(rE,{draft:un,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Zn)})]}),a.jsxs("section",{className:"aw-details-card",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:A("agentWorkspace.details")})}),a.jsxs("dl",{className:"aw-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.model")}),a.jsx("dd",{children:gz(gi==null?void 0:gi.model)||un.modelName||A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.agentCountLabel")}),a.jsx("dd",{children:gi!=null&&gi.graph?E6e(gi.graph):C6e(un)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.tools")}),a.jsx("dd",{className:"aw-fact-badges",children:Xf.length?Xf.map(ct=>a.jsx("span",{children:ct},ct)):A("agentWorkspace.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.skills")}),a.jsx("dd",{className:"aw-fact-badges",children:Hi===null?A("agentSelector.previewUnsupported"):Hi.length?Hi.map(ct=>a.jsx("span",{children:ct},ct)):A("agentWorkspace.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("systemInfo.currentVersion")}),a.jsx("dd",{children:qt!=null?`v${qt}`:A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.status")}),a.jsx("dd",{children:ai?A("myAgents.draft"):(qi==null?void 0:qi.status)==="error"?A("agentWorkspace.deploymentFailed"):(qi==null?void 0:qi.status)==="cancelled"?A("agentWorkspace.cancelled"):na?A("agentWorkspace.updatePending"):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-status-dot"}),A("skillCenter.status.available")]})})]})]})]}),a.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":A("agentWorkspace.selectedOptimizations"),children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:A("agentWorkspace.selectedOptimizations")}),a.jsx("p",{children:A("agentWorkspace.selectedOptimizationsDescription")})]})}),a.jsxs("dl",{className:"aw-readonly-config",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.configurationStatus")}),a.jsx("dd",{className:Kr!=null&&Kr.enabled?"is-ready":void 0,children:Kr?Kr.enabled?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-status-dot"}),A("skillCenter.status.enabled")]}):A("skillCenter.status.inactive"):A("agentWorkspace.notRecorded")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.optimizationProfile")}),a.jsx("dd",{children:Kr?Nvt(Kr.profile):A("agentWorkspace.legacyConfigMissing")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.selectedOptimizations")}),a.jsx("dd",{className:"aw-fact-badges",children:Kr?zo.length?zo.map(ct=>a.jsx("span",{children:z_(ct)},ct)):A("agentWorkspace.noneSelected"):A("agentWorkspace.legacyConfigMissing")})]})]})]})]}),L==="usage"&&(we==null?void 0:we.runtimeId)&&a.jsxs("section",{className:"aw-usage","aria-busy":Us,children:[a.jsx("div",{className:"aw-usage-intro",children:a.jsx("h3",{children:A("agentWorkspace.usageOverview")})}),Us&&!os&&a.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:A("agentWorkspace.loadingUsage")})}),Oa&&a.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[a.jsx("span",{children:Oa}),a.jsx("button",{type:"button",onClick:()=>Ll(ct=>ct+1),children:A("common.retry")})]}),!Us&&!Oa&&!os&&!Zi&&a.jsx("div",{className:"aw-usage-state",children:A("agentWorkspace.usageUnavailable")}),os&&a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"aw-usage-summary","aria-label":A("agentWorkspace.usageSummary"),children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.totalCalls")}),a.jsx("dd",{children:os.totalInvocations.toLocaleString(P.resolvedLanguage??P.language)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.userCount")}),a.jsx("dd",{children:os.totalUsers.toLocaleString(P.resolvedLanguage??P.language)})]})]}),a.jsxs("div",{className:"aw-usage-users-head",children:[a.jsx("h3",{children:A("agentWorkspace.userDetails")}),Us&&a.jsx(yn,{as:"span",role:"status","aria-live":"polite",children:A("agentWorkspace.refreshing")})]}),os.users.length===0?a.jsx("div",{className:"aw-usage-state",children:A("agentWorkspace.noUsage")}):a.jsx("div",{className:"aw-usage-table-wrap",children:a.jsxs("table",{className:"aw-usage-table",children:[a.jsx("caption",{children:A("agentWorkspace.usageUserList")}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:A("agentWorkspace.user")}),a.jsx("th",{scope:"col",children:A("agentWorkspace.callCount")}),a.jsx("th",{scope:"col",children:A("agentWorkspace.lastUsed")})]})}),a.jsx("tbody",{children:os.users.map(ct=>a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:ct.displayName||ct.userId||A("agentWorkspace.unknownUser")}),ct.displayName&&ct.userId&&a.jsx("small",{title:ct.userId,children:ct.userId})]}),a.jsx("td",{children:ct.invocationCount.toLocaleString(P.resolvedLanguage??P.language)}),a.jsx("td",{children:a.jsx("time",{dateTime:ct.lastUsedAt,children:JHt(ct.lastUsedAt,P.resolvedLanguage??P.language,A)})})]},ct.userId))})]})}),os.totalPages>1&&a.jsxs("nav",{className:"aw-usage-pagination","aria-label":A("agentWorkspace.usagePagination"),children:[a.jsx("button",{type:"button",disabled:Us||os.page<=1,onClick:()=>js(ct=>Math.max(1,ct-1)),children:A("common.previousPage")}),a.jsx("span",{"aria-live":"polite",children:A("agentWorkspace.pageOf",{page:os.page,total:os.totalPages})}),a.jsx("button",{type:"button",disabled:Us||os.page>=os.totalPages,onClick:()=>js(ct=>ct+1),children:A("common.nextPage")})]})]})]}),L==="versions"&&a.jsxs("section",{className:"aw-version-stack",children:[a.jsxs("div",{className:"aw-integration-intro",children:[a.jsx("h3",{children:A("agentWorkspace.githubVersions")}),a.jsx("p",{children:(Ue=ve==null?void 0:ve.cicd)!=null&&Ue.enabled?A("agentWorkspace.githubVersionsDescription"):A("agentWorkspace.currentVersionOnly")})]}),ne&&a.jsx("div",{className:"aw-case-empty",children:A("agentWorkspace.loadingVersions")}),Ce&&a.jsxs("div",{className:"aw-integration-error",role:"alert",children:[a.jsx("span",{children:Ce}),(we==null?void 0:we.runtimeId)&&a.jsx("button",{type:"button",onClick:()=>void C_(we.runtimeId??"").then(Re),children:A("common.retry")})]}),!ne&&!Ce&&a.jsxs("div",{className:"aw-version-list",children:[(ve==null?void 0:ve.githubSyncError)&&a.jsx("div",{className:"aw-integration-error",role:"alert",children:a.jsx("span",{children:ve.githubSyncError})}),(ve==null?void 0:ve.latestSourceRuntimeStatus)&&ve.latestSourceRuntimeStatus!=="published"&&((tt=ve.versions[0])==null?void 0:tt.commitSha)&&ve.versions[0].commitSha!==ve.currentCommitSha&&a.jsx("div",{className:"aw-integration-notice",role:"status",children:a.jsxs("span",{children:[A("agentWorkspace.sourceMergedRuntimeStill"),mse(ve.latestSourceRuntimeStatus,A),A("agentWorkspace.currentProductionVersionHint")]})}),ve!=null&&ve.versions.length?ve.versions.map(ct=>{var ml;const wi=ct.commitSha??"",io=ct.runtimeStatus??ct.status,Oi=ct.changeType==="rollback",Vs=!!((ml=ve.cicd)!=null&&ml.enabled)&&!!wi&&!Oi&&wi!==ve.currentCommitSha;return a.jsxs("article",{className:"aw-version-row",children:[a.jsxs("div",{children:[a.jsx("strong",{children:tqt(ct,A)}),a.jsx("small",{children:ct.createdAt||A("agentWorkspace.noTime")})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.prLink")}),ct.pullRequestUrl?a.jsx("a",{href:ct.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:A("agentWorkspace.viewPr")}):a.jsx("em",{children:A("agentWorkspace.noPr")})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.author")}),a.jsx("em",{children:ct.author||"Studio"})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.publishStatus")}),a.jsx("em",{children:mse(io,A)})]}),a.jsxs("div",{className:"aw-version-actions",children:[a.jsx("button",{type:"button",disabled:!Vs||Ke===wi,onClick:()=>void kr(ct),children:A(Ke===wi?"agentWorkspace.rollingBack":"agentWorkspace.rollbackToVersion")}),ct.workflowRunUrl&&a.jsx("a",{href:ct.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:A("agentWorkspace.viewRelease")})]})]},`${ct.version}-${wi||ct.createdAt}`)}):a.jsxs("article",{className:"aw-version-row",children:[a.jsxs("div",{children:[a.jsx("strong",{children:qt!=null?`v${qt}`:A("agentWorkspace.noVersion")}),a.jsx("small",{children:(W==null?void 0:W.updatedAt)||A("agentWorkspace.noTime")})]}),a.jsx("p",{children:A("agentWorkspace.currentVersionOnly")})]})]})]}),L==="integrations"&&a.jsxs("div",{className:"aw-integration-stack",children:[a.jsxs("div",{className:"aw-integration-intro",children:[a.jsx("h3",{children:A("agentWorkspace.integrationMethods")}),a.jsx("p",{children:A("agentWorkspace.integrationDescription")})]}),ce&&a.jsxs("div",{className:"aw-integration-error",role:"alert",children:[a.jsx("span",{children:ce}),a.jsx("button",{type:"button",onClick:()=>G(ct=>ct+1),children:A("common.retry")})]}),!ce&&a.jsxs("div",{className:"aw-integration-body",children:[a.jsxs("div",{className:`aw-integration-protocol-tabs${te==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":A("agentWorkspace.integrationProtocol"),children:[a.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),wO.map((ct,wi)=>a.jsx("button",{type:"button",id:`integration-${ct.id}-tab`,role:"tab","aria-selected":te===ct.id,"aria-controls":`integration-${ct.id}-panel`,tabIndex:te===ct.id?0:-1,onClick:()=>Or(ct.id),onKeyDown:io=>{var ml;if(!["ArrowLeft","ArrowRight","Home","End"].includes(io.key))return;io.preventDefault();const Oi=io.key==="Home"?0:io.key==="End"?wO.length-1:(wi+(io.key==="ArrowRight"?1:-1)+wO.length)%wO.length,Vs=wO[Oi];Or(Vs.id),(ml=document.getElementById(`integration-${Vs.id}-tab`))==null||ml.focus()},children:ct.label},ct.id))]}),te==="api-server"?a.jsx(bse,{protocol:"api-server",title:"API Server",available:Qo,fields:[{label:"Agent",value:Qo?((nt=gr==null?void 0:gr.apiApps)==null?void 0:nt.join("、"))??"":""},{label:A("agentWorkspace.discoveryEndpoint"),value:Qo?a4(Mn,"/list-apps"):""},{label:A("agentWorkspace.invocationEndpoint"),value:Qo?a4(Mn,"/run_sse"):""},{label:A("agentWorkspace.authentication"),value:Qo?pse(W==null?void 0:W.authType,A):""},{label:"API Key",value:a.jsx(gse,{available:Qo,authType:W==null?void 0:W.authType,value:$l,visible:me&&!!$l,loading:Se,error:be,onToggle:()=>void Tr()})}],example:Qo?nqt(Mn,ra,W==null?void 0:W.authType):""}):a.jsx(bse,{protocol:"a2a",title:"A2A",available:qa,fields:[{label:"Agent",value:((kn=gr==null?void 0:gr.a2a)==null?void 0:kn.name)??""},{label:"Agent Card",value:qa?a4(Mn,"/.well-known/agent-card.json"):""},{label:A("agentWorkspace.invocationUrl"),value:Wa},{label:A("agentWorkspace.authentication"),value:qa?pse(W==null?void 0:W.authType,A):""},{label:"API Key",value:a.jsx(gse,{available:qa,authType:W==null?void 0:W.authType,value:$l,visible:me&&!!$l,loading:Se,error:be,onToggle:()=>void Tr()})}],example:qa?iqt(Wa,W==null?void 0:W.authType):""})]})]}),L==="evaluations"&&a.jsxs("section",{className:"aw-cases",children:[(we==null?void 0:we.runtimeId)&&a.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(ct=>{const wi=dqt(wr,ct),io=to.filter(Vs=>Vs.kind===ct).length,Oi=Xr?io:(wi==null?void 0:wi.itemCount)??io;return a.jsxs("button",{type:"button",onClick:()=>Hd(ct),children:[a.jsx("strong",{children:Oi}),a.jsx("span",{children:A(ct==="good"?"agentWorkspace.goodCases":"agentWorkspace.badCases")})]},ct)})}),a.jsxs("div",{className:"aw-case-filter-bar",children:[a.jsxs("div",{className:"aw-case-filter-stack",children:[a.jsx("div",{className:"aw-case-filters","aria-label":A("agentWorkspace.caseResultFilter"),children:["good","bad"].map(ct=>a.jsx("button",{type:"button",className:gt===ct?"is-active":"","aria-pressed":gt===ct,onClick:()=>st(ct),children:A(ct==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},ct))}),a.jsx("div",{className:"aw-case-source-filters","aria-label":A("agentWorkspace.feedbackSourceFilter"),children:["auto","user"].map(ct=>a.jsx("button",{type:"button",className:Ht===ct?"is-active":"","aria-pressed":Ht===ct,onClick:()=>cn(ct),children:A(ct==="auto"?"agentWorkspace.automaticFeedback":"agentWorkspace.manualFeedback")},ct))})]}),a.jsxs("label",{className:"aw-case-search",children:[a.jsx(vN,{"aria-hidden":!0}),a.jsx("input",{type:"search",value:xt,onChange:ct=>ft(ct.currentTarget.value),placeholder:A("agentWorkspace.searchCasesPlaceholder"),"aria-label":A("agentWorkspace.searchCases")})]})]}),no&&a.jsx("div",{className:`aw-case-toolbar${wo?" is-active":""}`,children:wo?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-selection-count",children:A("agentWorkspace.selectedCaseCount",{count:ws.length})}),a.jsx("button",{type:"button",onClick:d0,disabled:Ar.length===0||Ns,children:A("agentWorkspace.selectAllVisible")}),a.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Bg(ws),disabled:ws.length===0||Ns,children:A(Ns?"common.deleting":"agentWorkspace.deleteSelected")}),a.jsx("button",{type:"button",onClick:f0,disabled:Ns,children:A("common.cancel")})]}):a.jsx("button",{type:"button",onClick:()=>{or(""),Li(!0)},disabled:Ar.length===0||Ns,children:A("agentWorkspace.selectCases")})}),ta&&a.jsx("div",{className:"aw-delete-error",role:"alert",children:ta}),a.jsx("div",{ref:ss,children:a.jsx(Oqt,{cases:Ar,loading:ir&&Ar.length===0,error:kt,notice:Nn,runtimeBacked:!!(we!=null&&we.runtimeId),selectionMode:wo,selectedCaseIds:ul,focusedCaseId:Oo,expandedCaseIds:Va,deleting:Ns,canDelete:no,onOpenCase:p0,onToggleCase:Fg,onToggleExpanded:h0,onDeleteCase:ct=>void Bg([ct]),onRetry:()=>is(ct=>ct+1)})})]}),L==="optimizations"&&a.jsxs("section",{className:"aw-optimizations",children:[a.jsxs("div",{className:"aw-optimization-intro",children:[a.jsx("h3",{children:A("agentWorkspace.optimizations")}),a.jsx("p",{children:A("agentWorkspace.optimizationsDescription")})]}),oi?a.jsxs("div",{className:"aw-optimization-state",role:"status",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsx("span",{children:A("agentWorkspace.loadingOptimizations")})]}):Fr?a.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[a.jsx("span",{children:Fr}),a.jsx("button",{type:"button",onClick:()=>Hr(ct=>ct+1),children:A("common.retry")})]}):$r.length>0?a.jsx(xqt,{groups:$r}):a.jsx("div",{className:"aw-optimization-state",children:A("agentWorkspace.noOptimizations")})]})]}),L==="basic"&&(we||ai)&&a.jsxs("div",{className:"aw-basic-actions",children:[we&&a.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>E==null?void 0:E(we),children:[a.jsx(cit,{"aria-hidden":!0}),a.jsx("span",{children:A("agentWorkspace.chat")})]}),a.jsxs("span",{className:`aw-update-wrap${fl?" is-disabled":""}`,tabIndex:fl?0:void 0,"aria-describedby":fl?hl:void 0,children:[a.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!fl,"aria-busy":Te||void 0,"aria-describedby":fl?hl:void 0,onClick:()=>ai?N==null?void 0:N(ai):Je?T(Je):void 0,children:Te?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),a.jsx("span",{children:A("agentWorkspace.preparing")})]}):A(ai||na?"agentWorkspace.continueEditing":"agentWorkspace.update")}),fl&&a.jsx("span",{id:hl,className:"aw-update-disabled-reason",role:"tooltip",children:fl})]})]})]}):null}}),activeSectionKey:L,navigationLabel:A("agentWorkspace.agentDetails"),onSectionChange:U})]})]}),D==="evaluation"&&a.jsx("div",{className:"aw-evaluation-glass",role:"status",children:a.jsx("span",{children:A("agentWorkspace.comingSoon")})})]})]}),En&&a.jsx(Gu,{variant:"danger",title:En.title,description:En.description,confirmLabel:Vt?A("common.deleting"):En.confirmLabel,closeLabel:A("agentWorkspace.closeDeleteConfirmation"),busy:Vt,onCancel:()=>vi(null),onConfirm:()=>void zg()})]})}function xqt({groups:e}){const{t}=Ae("ui");return a.jsx("div",{className:"aw-optimization-table-wrap",children:a.jsxs("table",{className:"aw-optimization-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:t("agentWorkspace.fixPriority")}),a.jsx("th",{scope:"col",children:t("agentWorkspace.suggestedModule")}),a.jsx("th",{scope:"col",children:t("agentWorkspace.suggestionAndReason")})]})}),a.jsx("tbody",{children:e.map(n=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`aw-priority is-${n.priority}`,children:lqt(n.priority,t)})}),a.jsx("td",{children:a.jsx("span",{className:"aw-optimization-module",children:uqt(n,t)})}),a.jsx("td",{children:a.jsx("ul",{className:"aw-optimization-list",children:n.items.map(i=>a.jsxs("li",{children:[a.jsx("strong",{children:i.suggestion}),a.jsx("p",{children:i.reason})]},`${i.suggestion}:${i.reason}`))})})]},`${n.priority}:${n.module}:${n.customModule??""}`))})]})})}function wqt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M4.5 7h15"}),a.jsx("path",{d:"M9 7V4.8h6V7"}),a.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),a.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function Oqt({cases:e,loading:t=!1,error:n="",notice:i="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:o,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:m,onDeleteCase:g,onRetry:b}){const{t:v,i18n:y}=Ae("ui");return a.jsxs("div",{className:"aw-case-table",children:[a.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[a.jsx("span",{children:v("agentWorkspace.userInput")}),a.jsx("span",{children:v("agentWorkspace.agentOutput")}),a.jsx("span",{children:v("agentWorkspace.score")}),a.jsx("span",{children:v("agentWorkspace.scoreReason")}),a.jsx("span",{className:"aw-case-action-head",children:v("skillCenter.actions")})]}),t?a.jsx("div",{className:"aw-case-empty",children:v("agentWorkspace.loadingEvaluationSet")}):n?a.jsxs("div",{className:"aw-case-empty aw-case-error",children:[a.jsx("span",{children:n}),b&&a.jsx("button",{type:"button",onClick:b,children:v("common.retry")})]}):i?a.jsx("div",{className:"aw-case-empty",children:i}):e.length===0?a.jsx("div",{className:"aw-case-empty",children:v(r?"agentWorkspace.noFeedbackCases":"agentWorkspace.noMatchingCases")}):e.map(x=>{var _,j;const w=x.id.startsWith("local:"),O=(o==null?void 0:o.has(x.id))??!1,S=(c==null?void 0:c.has(x.id))??!1,C=x.output.length+x.referenceOutput.length>220||(((_=x.reason)==null?void 0:_.length)??0)>120,E=d&&!w,R=!!(x.comment&&x.comment.trim()!==((j=x.reason)==null?void 0:j.trim()));return a.jsxs("div",{className:["aw-case-row",l===x.id?"is-focused":"",s?"is-selecting":"",O?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?O:void 0,onClick:()=>{if(s){E&&(h==null||h(x));return}f==null||f(x)},onKeyDown:T=>{T.target===T.currentTarget&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),s?E&&(h==null||h(x)):f==null||f(x)))},children:[a.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":v("agentWorkspace.userInput"),children:[a.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&a.jsx("span",{className:`aw-select-marker${O?" is-checked":""}`,"aria-hidden":"true"}),a.jsx("strong",{title:x.input,children:x.input||v("agentWorkspace.noUserInput")})]}),R&&a.jsxs("small",{title:x.comment,children:[v("agentWorkspace.note"),x.comment]}),a.jsx("small",{className:"aw-case-time",children:oqt(x.createdAt,y.resolvedLanguage??y.language,v)}),(x.userId||x.sessionId)&&a.jsx("small",{title:[x.userId,x.sessionId].filter(Boolean).join(" · "),children:[x.userId,x.sessionId].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:`aw-case-output aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.agentOutput"),children:[a.jsx("p",{className:"aw-case-output-preview",title:x.output,children:x.output||v("agentWorkspace.noVisibleResponse")}),x.referenceOutput&&a.jsxs("small",{className:"aw-case-output-preview",title:x.referenceOutput,children:[v("agentWorkspace.reference"),": ",x.referenceOutput]}),C&&a.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),m==null||m(x.id)},children:v(S?"common.collapse":"common.expand")})]}),a.jsx("div",{className:"aw-case-score aw-case-cell","data-label":v("agentWorkspace.score"),children:aqt(x,v)}),a.jsx("div",{className:`aw-case-reason aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.scoreReason"),children:a.jsx("p",{title:x.reason||void 0,children:x.reason||"—"})}),a.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":v("skillCenter.actions"),children:E&&a.jsx("button",{type:"button",className:"aw-case-delete",onClick:T=>{T.stopPropagation(),g==null||g(x)},disabled:u,title:v("agentWorkspace.deleteFeedbackCase"),"aria-label":v("agentWorkspace.deleteFeedbackCase"),children:a.jsx(wqt,{})})})]},x.id)})]})}function kqt({group:e,agents:t,cases:n,onChange:i,onRun:r}){const{t:s}=Ae("ui"),[o,l]=p.useState("config"),c=e.agentIds.map(h=>t.find(m=>m.id===h)).filter(h=>!!h),u=["回答质量","事实准确性","工具调用","响应效率"];p.useEffect(()=>l("config"),[e.id]);const d=h=>{i({...e,agentIds:e.agentIds.includes(h)?e.agentIds.filter(m=>m!==h):[...e.agentIds,h]})},f=h=>{i({...e,metrics:e.metrics.includes(h)?e.metrics.filter(m=>m!==h):[...e.metrics,h]})};return a.jsxs("main",{className:"aw-main",children:[a.jsxs("div",{className:"aw-eval-head",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"aw-agent-title-row",children:[a.jsx("h2",{children:ok(e.name,s)}),a.jsx("span",{children:s("agentWorkspace.evaluationGroup")})]}),a.jsx("p",{children:s("agentWorkspace.evaluationGroupStats",{agents:c.length,caseSet:ok(e.caseSet,s),runs:e.history.length})})]}),a.jsxs("button",{type:"button",className:"aw-run",onClick:()=>r(e),disabled:!0,children:[a.jsx(nit,{"aria-hidden":!0}),s("agentWorkspace.startEvaluation")]})]}),a.jsxs("nav",{className:"aw-agent-tabs","aria-label":s("agentWorkspace.evaluationGroupDetails"),children:[a.jsx("button",{type:"button",className:o==="config"?"is-active":"","aria-pressed":o==="config",onClick:()=>l("config"),disabled:!0,children:s("agentWorkspace.evaluationConfig")}),a.jsx("button",{type:"button",className:o==="history"?"is-active":"","aria-pressed":o==="history",onClick:()=>l("history"),disabled:!0,children:s("agentWorkspace.historyResults")})]}),a.jsx("div",{className:"aw-content",children:o==="config"?a.jsxs("div",{className:"aw-eval-setup",children:[a.jsxs("section",{className:"aw-eval-block",children:[a.jsxs("div",{className:"aw-card-head",children:[a.jsx("strong",{children:s("agentWorkspace.participatingAgents")}),a.jsx("span",{children:s("agentWorkspace.selectedCount",{count:c.length})})]}),a.jsx("div",{className:"aw-eval-agent-grid",children:t.map(h=>a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:e.agentIds.includes(h.id),onChange:()=>d(h.id)}),a.jsxs("span",{children:[a.jsx("strong",{children:h.label}),a.jsx("small",{children:h.remote?s("agentWorkspace.remote"):s("agentWorkspace.local")})]})]},h.id))})]}),a.jsxs("div",{className:"aw-eval-setting-grid",children:[a.jsxs("section",{className:"aw-eval-block",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:s("agentWorkspace.evaluationResources")})}),a.jsxs("div",{className:"aw-eval-fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.evaluationSet")}),a.jsxs("select",{value:e.caseSet,onChange:h=>i({...e,caseSet:h.currentTarget.value}),children:[a.jsx("option",{value:"核心回归集",children:s("agentWorkspace.evaluationDefaults.coreSet")}),a.jsx("option",{value:"安全边界集",children:s("agentWorkspace.evaluationDefaults.safetySet")}),a.jsx("option",{value:"工具调用集",children:s("agentWorkspace.evaluationDefaults.toolSet")})]}),a.jsx("small",{children:s("agentWorkspace.caseCount",{count:n.length})})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.evaluator")}),a.jsxs("select",{value:e.evaluator,onChange:h=>i({...e,evaluator:h.currentTarget.value}),children:[a.jsx("option",{value:"综合质量评估器",children:s("agentWorkspace.evaluationDefaults.qualityEvaluator")}),a.jsx("option",{value:"事实一致性评估器",children:s("agentWorkspace.evaluationDefaults.factualEvaluator")}),a.jsx("option",{value:"工具调用评估器",children:s("agentWorkspace.evaluationDefaults.toolEvaluator")})]})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.concurrency")}),a.jsxs("select",{value:e.concurrency,onChange:h=>i({...e,concurrency:h.currentTarget.value}),children:[a.jsx("option",{value:"2",children:"2"}),a.jsx("option",{value:"4",children:"4"}),a.jsx("option",{value:"8",children:"8"})]})]})]})]}),a.jsxs("section",{className:"aw-eval-block",children:[a.jsxs("div",{className:"aw-card-head",children:[a.jsx("strong",{children:s("agentWorkspace.evaluationMetrics")}),a.jsx("span",{children:s("agentWorkspace.selectedMetricCount",{count:e.metrics.length})})]}),a.jsx("div",{className:"aw-metric-list",children:u.map(h=>a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:e.metrics.includes(h),onChange:()=>f(h)}),a.jsx("span",{children:ok(h,s)})]},h))})]})]})]}):a.jsxs("section",{className:"aw-eval-history",children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:s("agentWorkspace.historyResults")}),a.jsx("p",{children:s("agentWorkspace.historyDescription")})]})}),e.history.length===0?a.jsxs("div",{className:"aw-results-empty",children:[a.jsx("strong",{children:s("agentWorkspace.noHistory")}),a.jsx("span",{children:s("agentWorkspace.noHistoryDescription")})]}):a.jsx("div",{className:"aw-history-list",children:e.history.map((h,m)=>a.jsxs("button",{type:"button",children:[a.jsxs("span",{children:[a.jsx("strong",{children:s("agentWorkspace.evaluationRun",{index:e.history.length-m})}),a.jsx("small",{children:s("agentWorkspace.evaluationRunMeta",{time:ok(h.createdAt,s),agents:c.length})})]}),a.jsxs("span",{className:"aw-history-score",children:[a.jsx("strong",{children:h.score}),a.jsx("small",{children:s("agentWorkspace.overallScore")})]}),a.jsxs("span",{className:"aw-complete",children:[a.jsx(Md,{}),s("agentWorkspace.completed")]}),a.jsx(Lk,{"aria-hidden":!0})]},h.id))})]})})]})}async function QH(e,t={}){const n=await fetch(Zo(`/web/agent-reviews${e}`),{...t,headers:Pl(uu({"Content-Type":"application/json"})),signal:Ua(t.signal??void 0,6e4)});if(!n.ok)throw new Error(await n.text());return n.json()}function Sqt(e,t){return QH(`?${new URLSearchParams({region:e})}`,{signal:t})}function Eqt(e,t,n){return QH(`/${encodeURIComponent(e)}?${new URLSearchParams({region:t})}`,{signal:n})}function Cqt(e,t,n){return QH(`/${encodeURIComponent(e)}/${t}`,{method:"POST",body:JSON.stringify(n)})}const Tqt=20,vse=256;function l4({label:e,value:t,onChange:n,limit:i,disabled:r,required:s=!1}){const{t:o}=Ae("agentReviews");return a.jsxs("label",{children:[e,a.jsx("textarea",{"aria-label":e,value:t,onChange:l=>n(Array.from(l.target.value).slice(0,i).join("")),maxLength:i*2,disabled:r,required:s,rows:3}),a.jsx("span",{className:"agent-review-text-count",children:o("textCount",{count:Array.from(t).length,limit:i})})]})}function LR({person:e}){return a.jsxs("span",{className:"agent-review-person",title:e.email||e.name,children:[e.avatarUrl?a.jsx("img",{src:e.avatarUrl,alt:"",referrerPolicy:"no-referrer",onError:t=>{t.currentTarget.hidden=!0}}):null,a.jsx("span",{children:e.name||e.id})]})}function j6e({runtimeId:e,region:t,name:n,canPublish:i,onClose:r,onChanged:s}){const{t:o,i18n:l}=Ae("agentReviews"),[c,u]=p.useState(null),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(""),[v,y]=p.useState(""),[x,w]=p.useState(""),[O,S]=p.useState(""),[k,C]=p.useState(0),[E,R]=p.useState(!1),[_,j]=p.useState(null);p.useEffect(()=>{const M=new AbortController;return f(!0),b(""),Eqt(e,t,M.signal).then(L=>{M.signal.aborted||u(L.application)}).catch(L=>{M.signal.aborted||b(L instanceof Error?L.message:String(L))}).finally(()=>{M.signal.aborted||f(!1)}),()=>M.abort()},[e,t,k]);async function T(M,L){if(!h){m(!0),b("");try{const U=await Cqt(e,M,{region:t,...M==="submit"?{message:v}:{},...M==="publish"||M==="decision"?{comment:x}:{},...M==="decision"?{applicationId:c==null?void 0:c.id,decision:L,reason:O}:{}});u(U),w(""),S(""),R(!1),j(null),s()}catch(U){b(U instanceof Error?U.message:String(U))}finally{m(!1)}}}const N=(c==null?void 0:c.status)==="pending",A=!!(c!=null&&c.published),P=!N&&!A,D=M=>new Date(M).toLocaleString(l.language);return a.jsx(DD,{open:!0,onOpenChange:M=>{!M&&!h&&r()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"agent-review-backdrop"}),a.jsxs(ID,{className:"agent-review-dialog",children:[a.jsxs("header",{className:"agent-review-dialog-header",children:[a.jsxs("div",{children:[a.jsx(MD,{children:n}),a.jsx(RD,{children:o("dialogDescription")})]}),a.jsx(MH,{className:"agent-review-close",disabled:h,"aria-label":o("close"),children:a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m6 6 12 12M6 18 18 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"agent-review-dialog-body",children:[d?a.jsx(Fa,{}):null,g?a.jsxs("div",{className:"agent-review-error",role:"alert",children:[a.jsx("p",{children:g}),a.jsx("button",{type:"button",disabled:h||d,onClick:()=>C(M=>M+1),children:o("refresh")})]}):null,!d&&c?a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"agent-review-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:o("statusTitle")}),a.jsxs("dd",{children:[o(`status.${c.status}`),c.status==="approved"&&!A?` · ${o("private")}`:""]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("submitter")}),a.jsx("dd",{children:a.jsx(LR,{person:c.submitter})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("submittedAt")}),a.jsx("dd",{children:D(c.submittedAt)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("version")}),a.jsx("dd",{children:c.agent.version??"—"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("model")}),a.jsx("dd",{children:c.agent.model||"—"})]}),c.reviewer?a.jsxs("div",{children:[a.jsx("dt",{children:o(c.status==="returned"?"returnedBy":"approvedBy")}),a.jsx("dd",{children:a.jsx(LR,{person:c.reviewer})})]}):null,c.reviewedAt?a.jsxs("div",{children:[a.jsx("dt",{children:o("reviewedAt")}),a.jsx("dd",{children:D(c.reviewedAt)})]}):null]}),a.jsxs("section",{children:[a.jsx("h3",{children:o("description")}),a.jsx("p",{children:c.agent.description||"—"})]}),c.message?a.jsxs("section",{children:[a.jsx("h3",{children:o("message")}),a.jsx("p",{children:c.message})]}):null,c.reason?a.jsxs("section",{children:[a.jsx("h3",{children:o("reason")}),a.jsx("p",{children:c.reason})]}):null,c.comment?a.jsxs("section",{children:[a.jsx("h3",{children:o("comment")}),a.jsx("p",{children:c.comment})]}):null,c.contentChanged?a.jsx("p",{role:"alert",className:"agent-review-warning",children:o("contentChanged")}):null]}):null,!d&&!g&&P&&!i?a.jsx(l4,{label:o("message"),value:v,onChange:y,limit:Tqt,disabled:h}):null,!d&&!g&&i&&(N||P)?a.jsx(l4,{label:o("comment"),value:x,onChange:w,limit:vse,disabled:h}):null,E?a.jsx(l4,{label:o("reasonRequired"),value:O,onChange:S,limit:vse,disabled:h,required:!0}):null,_?a.jsx("p",{role:"status",children:o(`${_}Confirm`)}):null]}),a.jsxs("footer",{className:"agent-review-dialog-footer",children:[h?a.jsx("span",{role:"status",children:o("saving")}):null,!d&&(!g||c)?_?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>j(null),children:o("cancel")}),a.jsx("button",{type:"button",disabled:h,onClick:()=>void T(_),children:o("confirm")})]}):E?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>R(!1),children:o("cancel")}),a.jsx("button",{type:"button",disabled:h||!O.trim(),onClick:()=>void T("decision","returned"),children:o("return")})]}):a.jsxs(a.Fragment,{children:[A?a.jsx("button",{type:"button",disabled:h,onClick:()=>j("unpublish"),children:o("unpublish")}):null,N?a.jsx("button",{type:"button",disabled:h,onClick:()=>j("withdraw"),children:o("withdraw")}):null,N&&i?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>R(!0),children:o("return")}),a.jsx("button",{type:"button",className:"is-primary",disabled:h||(c==null?void 0:c.contentChanged),onClick:()=>void T("decision","approved"),children:o("approve")})]}):null,P?a.jsx("button",{type:"button",className:"is-primary",disabled:h,onClick:()=>void T(i?"publish":"submit"),children:o(i?"publish":"submit")}):null]}):null]})]})]})})}const Aqt=5e3,_qt=4;let c4=0;const xse=[];function wse(e){return e instanceof Error&&e.name==="AbortError"}function jqt(e){return e instanceof Error&&e.name==="TimeoutError"}function Nqt(e){return jqt(e)||e instanceof vU&&[500,502,503,504].includes(e.status)}function Rqt(e,t){return t!=null&&t.aborted?Promise.reject(t.reason??new DOMException("Request aborted","AbortError")):new Promise((n,i)=>{const r=()=>{globalThis.clearTimeout(s),i((t==null?void 0:t.reason)??new DOMException("Request aborted","AbortError"))},s=globalThis.setTimeout(()=>{t==null||t.removeEventListener("abort",r),n()},e);t==null||t.addEventListener("abort",r,{once:!0})})}async function Iqt(e={},t={}){const n=t.request??Fw,i=t.wait??Rqt;try{return await n(e)}catch(r){if(!Nqt(r))throw r;return await i(Aqt,e.signal),n(e)}}async function N6e(e){var t;c4>=_qt&&await new Promise(n=>xse.push(n)),c4+=1;try{return await e()}finally{c4-=1,(t=xse.shift())==null||t()}}async function Pqt(e,t){await Promise.allSettled(e.map(n=>N6e(()=>t(n))))}function Ab(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||z("common.unknownError"));return[z("requestError.actionFailed",{action:t}),z("requestError.detail",{detail:i}),n?z("requestError.request",{request:n}):""].filter(Boolean).join(` -`)}function Bh({className:e="icon"}){return a.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),a.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),a.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function Dqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),a.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function Mqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),a.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),a.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),a.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function Lqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),a.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),a.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),a.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function $qt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),a.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),a.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),a.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function UE({kind:e,...t}){return e==="codex"?a.jsx(Dqt,{...t}):e==="deepseek-harness"?a.jsx($qt,{...t}):e==="openclaw"?a.jsx(Mqt,{...t}):a.jsx(Lqt,{...t})}const Fqt=["general","codex","deepseek-harness","openclaw","hermes"],Bqt=24,Uqt=3e4,Qqt=7e3,zqt=2e4,Vqt=6,Hqt=2,qqt=250,jm=new Map,kx=new Map,Wqt=new Set;function rb(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function Ose(e,t){const n=e instanceof Error&&e.message.trim()?e.message.trim():t("myAgents.compatibility.unknownError");return{status:e instanceof co&&e.unsupported?"unsupported":"error",message:n}}function wb(e){if(!e){jm.clear(),kx.clear(),F6();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of kx)i.page.runtimes.some(r=>t.has(r.runtimeId))&&kx.delete(n);for(const n of t)F6(n);jm.clear()}}function Kqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function Gqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8.313 3.646a.5.5 0 0 1 .707 0l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 1 1-.707-.708L11.46 8.5H3.333a.5.5 0 0 1 0-1h8.127L8.313 4.354a.5.5 0 0 1 0-.708Z",fill:"currentColor"})})}function Xqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M2.75 5.25h8.75m0 0-2-2m2 2-2 2M13.25 10.75H4.5m0 0 2 2m-2-2 2-2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Yqt({type:e}){return e==="general"?a.jsx(Bh,{}):a.jsx(UE,{kind:e})}function Zqt(e,t=Date.now(),n){const i=Date.parse(e);if(!Number.isFinite(i)||i-t<6e4)return n("myAgents.expiringSoon");const r=Math.ceil((i-t)/6e4),s=Math.floor(r/60),o=r%60;return n("myAgents.sandboxRemaining",{hours:s,minutes:o})}function kse(e,t){var n;return{id:e.runtimeId,name:e.name,description:((n=e.description)==null?void 0:n.trim())||t("common.noDescription"),createdAt:e.createdAt??"",specificationLabel:t("myAgents.creator"),specification:$De(e.author),isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete,canManage:e.canManage,canPublish:e.canPublish,visibility:e.visibility,reviewStatus:e.reviewStatus}}}function Jqt(e,t){const n=MI(e.status);return{id:e.id,name:e.displayName||t("myAgents.namedAgent",{name:e.toolName}),description:t(`myAgents.sandboxStatus.${n}`,{defaultValue:t("myAgents.sandboxStatus.unknown")}),createdAt:e.createdAt,specificationLabel:t("myAgents.creator"),specification:$De(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function eWt(e,t){var n,i;return{id:e.id,name:e.draft.name||t("agentSelector.unnamedAgent"),description:((n=e.draft.description)==null?void 0:n.trim())||t("common.noDescription"),createdAt:new Date(e.updatedAt).toISOString(),specificationLabel:t("myAgents.storageLocation"),specification:t("myAgents.currentBrowser"),isMine:!0,region:(i=e.deploymentTarget)==null?void 0:i.region,draft:e}}function tWt(e,t,n){if(!e.draft)return e;const i=e.draft.deploymentTarget;return i?t.find(r=>{var s;return((s=r.runtime)==null?void 0:s.runtimeId)===i.runtimeId&&r.runtime.region===i.region})??{id:i.runtimeId,appName:i.appName,name:i.name||e.name,description:e.description,createdAt:e.createdAt,specificationLabel:n("myAgents.region"),specification:i.region,isMine:!0,runtime:{runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion,canDelete:!1}}:null}function nWt(e,t){return e.trim()||Ki(t)}async function iWt(e,t,n,i,r,s){const o=`${e}:${t}:${n}`,l=kx.get(o);if(l&&l.expiresAt>Date.now())return i(l.page.runtimes.map(d=>kse(d,r))),l.page.nextToken;l&&kx.delete(o);let c=jm.get(o);c||(c=Iqt({scope:e,region:t,pageSize:Bqt,nextToken:n,signal:s}),jm.set(o,c),c.then(()=>jm.delete(o),()=>jm.delete(o)));const u=await c;return kx.set(o,{page:u,expiresAt:Date.now()+Uqt}),i(u.runtimes.map(d=>kse(d,r))),u.nextToken}function rWt({agent:e,onReview:t,onUse:n,onViewDetails:i,onPrepareUpdate:r,compatibility:s,onRetryCompatibility:o,connecting:l,connectError:c,connected:u,deploymentTask:d,nowMs:f,onViewDeploymentTask:h,onEditDraft:m,onDeleteDraft:g}){var j,T,N,A;const{t:b,i18n:v}=Ae("ui"),y=(j=e.sandbox)==null?void 0:j.status.toLowerCase(),x=((T=e.sandbox)==null?void 0:T.resourceType)==="snapshot",w=!!(e.runtime||y==="ready"||y==="wakeable"),O=(s==null?void 0:s.status)==="checking",S=(s==null?void 0:s.status)==="unsupported",k=(s==null?void 0:s.status)==="error",C=((N=e.sandbox)==null?void 0:N.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(A=e.sandbox)==null?void 0:A.id,E=()=>{if(e.draft){d?h==null||h(d):i==null||i(e);return}!w&&!e.sandbox||(d?h==null||h(d):i==null||i(e))},R=(e.draft||w||!!e.sandbox)&&!!(d?h:i),_=e.draft?d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.viewRuntimeDetails",{name:e.name}):d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.viewDetails",{name:e.name});return a.jsxs(Sz,{className:`my-agent-card${l?" is-connecting":""}${e.runtime?" has-review":""}`,activateLabel:R?_:void 0,onActivate:R?E:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:a.jsxs("div",{className:"my-agent-card-footer",children:[a.jsx(qRe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:b("myAgents.time"),value:LD(e.createdAt,f,v.resolvedLanguage??v.language),hideLabel:!0,className:"my-agent-created-at"},...e.sandbox?[{label:b("myAgents.remainingTime"),value:e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?b("myAgents.neverExpires"):Zqt(e.sandbox.expireAt,f,b),className:`my-agent-expiry${e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),e.runtime?a.jsxs("div",{className:"agent-review-card-controls",children:[a.jsx("span",{className:"agent-review-card-status",children:b(e.runtime.visibility==="enterprise"?"enterprise":"private",{ns:"agentReviews"})}),e.runtime.canManage?a.jsxs(H_,{className:"agent-review-card-action",onClick:P=>{P.stopPropagation(),t==null||t(e)},children:[b(e.runtime.reviewStatus?"details":e.runtime.canPublish?"publish":"submit",{ns:"agentReviews"}),e.runtime.reviewStatus?` · ${b(`status.${e.runtime.reviewStatus}`,{ns:"agentReviews"})}`:""]}):null]}):null]}),actions:e.draft?a.jsxs(a.Fragment,{children:[a.jsx(H_,{"aria-label":d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.editDraftNamed",{name:e.name}),onClick:()=>d?h==null?void 0:h(d):m==null?void 0:m(e.draft),children:b(d?"myAgents.viewProgress":"common.edit")}),a.jsx(H_,{tone:"danger","aria-label":b("myAgents.deleteDraftNamed",{name:e.name}),onClick:()=>g==null?void 0:g(e.draft),children:b("common.delete")})]}):k||S?a.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":b("myAgents.recheckCompatibility",{name:e.name}),onClick:()=>o==null?void 0:o(e),children:[a.jsx(ZI,{}),b("common.retry")]}):a.jsx(KF,{className:u?"my-agent-use is-connected":"my-agent-use",disabled:!w||O||S||l||u,"aria-busy":l||void 0,label:u?b("myAgents.connectedNamed",{name:e.name}):x?b("myAgents.wakeAndChat",{name:e.name}):b("myAgents.chatWith",{name:e.name}),onClick:()=>void(n==null?void 0:n(e)),children:l?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:b(x?"myAgents.waking":"agentSelector.connecting")})]}):a.jsx(Gqt,{})}),children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:e.name}),title:e.name,subtitle:e.sandbox?a.jsx("span",{className:"my-agent-session-id",title:C,children:C}):void 0,status:e.draft?d?a.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):a.jsx("span",{className:"my-agent-draft-badge",children:b("myAgents.draft")}):e.sandbox?a.jsx("span",{className:"my-agent-status-label","data-ready":MI(e.sandbox.status)==="ready"||void 0,children:e.description}):e.runtime&&d?a.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):O?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsxs(Io,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[a.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),a.jsx("span",{children:b("myAgents.checking")})]})})}):S?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsx(Io,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:b("myAgents.chatUnsupported")})})}):k?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsx(Io,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:b("myAgents.checkFailed")})})}):null}),c?a.jsx(uo,{content:c,contentClassName:"my-agent-error-tooltip",maxWidth:360,interactive:!0,children:a.jsx("p",{className:"my-agent-wake-note",role:"alert",tabIndex:0,children:c})}):null,x&&l?a.jsx("p",{className:"my-agent-wake-note",role:"status",children:a.jsx(yn,{children:b("myAgents.wakingHint")})}):null,e.sandbox?null:a.jsx(Cz,{children:e.description})]})}function sWt({cloudProvider:e,studioRegion:t,canCreateRuntimeAgents:n,canCreatePersonalAgents:i,canUpdate:r,runtimeScope:s,onCreateAgent:o,onOpenCodexProjectUpload:l,onUseAgent:c,onViewAgentDetails:u,onCreateSandboxAgent:d,onUseSandboxAgent:f,onViewSandboxAgentDetails:h,activeType:m,onActiveTypeChange:g,sandboxRefreshKey:b=0,connectedRuntimeId:v="",hiddenRuntimeIds:y=Wqt,drafts:x=[],deploymentTasks:w=[],draftDeploymentTaskIds:O={},onViewDeploymentTask:S,onEditDraft:k,onDeleteDraft:C}){const{t:E}=Ae("ui"),R=p.useRef(null),_=p.useRef(null),j=p.useRef(0),T=p.useRef(null),N=p.useRef(0),A=p.useRef(null),P=p.useRef(new Map),D=nWt(t,e),[M,L]=p.useState(null),[U,I]=p.useState(""),[H,K]=p.useState(s==="mine"?"mine":"all"),[F,W]=p.useState(D),[V,X]=p.useState([]),[ie,Q]=p.useState(""),[Z,ce]=p.useState(!0),[Ee,Y]=p.useState(""),[G,te]=p.useState([]),[ye,Ne]=p.useState(!1),[pe,me]=p.useState(""),[se,Se]=p.useState(""),[Le,be]=p.useState({}),[Ve,ve]=p.useState({}),[Re,ne]=p.useState(null),[ge,Ce]=p.useState(()=>Date.now()),ke=p.useMemo(()=>Fqt.map(Me=>({value:Me,label:E(`myAgents.agentTypes.${Me}`)})),[E]),Ke=p.useMemo(()=>{const Me=Jc(e);return Me.some(We=>We.value===D)?Me:[{value:D,label:D},...Me]},[e,D]);p.useEffect(()=>{s==="mine"&&K("mine")},[s]),p.useEffect(()=>{W(D)},[D]),p.useEffect(()=>{Ce(Date.now());const Me=window.setInterval(()=>Ce(Date.now()),1e3);return()=>window.clearInterval(Me)},[]);const it=p.useMemo(()=>x.map(Me=>eWt(Me,E)),[x,E]),ue=p.useMemo(()=>{const Me=new Map,We=new Map,gt=new Map;for(const st of w){if(st.status!=="running")continue;if(Me.set(st.id,st),st.draftId){const ft=We.get(st.draftId);(!ft||st.startedAt>ft.startedAt)&&We.set(st.draftId,st)}if(!st.runtimeId)continue;const xt=gt.get(st.runtimeId);(!xt||st.startedAt>xt.startedAt)&>.set(st.runtimeId,st)}return{byId:Me,byDraftId:We,byRuntimeId:gt}},[w]),xe=p.useCallback(Me=>{var gt;if(Me.draft){const st=O[Me.draft.id];return ue.byDraftId.get(Me.draft.id)??(st?ue.byId.get(st):void 0)}const We=(gt=Me.runtime)==null?void 0:gt.runtimeId;return We?ue.byRuntimeId.get(We):void 0},[ue,O]),Te=p.useCallback((Me,We)=>{var xt;(xt=T.current)==null||xt.abort(),jm.clear();const gt=new AbortController;T.current=gt;const st=++j.current;return ce(!0),Y(""),iWt(H,F,Me,ft=>{j.current===st&&X(Ht=>We?ft:[...Ht,...ft])},E,gt.signal).then(ft=>{j.current===st&&Q(ft)}).catch(ft=>{j.current===st&&(wse(ft)||Y(Ab(ft,E("myAgents.loadGeneralAgents"),"GET /web/runtimes")))}).finally(()=>{j.current===st&&ce(!1),T.current===gt&&(T.current=null)})},[H,F,E]);p.useEffect(()=>{if(m==="general")return X([]),Q(""),Te("",!0),()=>{var Me;(Me=T.current)==null||Me.abort(),T.current=null,jm.clear(),j.current+=1}},[m,Te]),p.useEffect(()=>{if(m!=="general"){for(const gt of P.current.values())gt.abort();P.current.clear();return}const Me=new Set(V.filter(gt=>{var st,xt;return((st=gt.runtime)==null?void 0:st.runtimeId)!==v&&((xt=gt.runtime)==null?void 0:xt.region)===F}).map(rb).filter(Boolean));for(const[gt,st]of P.current)Me.has(gt)||(st.abort(),P.current.delete(gt));const We=V.filter(gt=>{var Ht,cn,hn;const st=(Ht=gt.runtime)==null?void 0:Ht.runtimeId;if(!st||st===v||((cn=gt.runtime)==null?void 0:cn.region)!==F)return!1;const xt=rb(gt),ft=(hn=Ve[xt])==null?void 0:hn.status;return!P.current.has(xt)&&(!ft||ft==="checking")});for(const gt of We)P.current.set(rb(gt),new AbortController);ve(gt=>{var ft,Ht;let st=!1;const xt={...gt};for(const cn of V){const hn=rb(cn);if(!hn)continue;const Ge=((ft=cn.runtime)==null?void 0:ft.runtimeId)===v;Ge&&((Ht=xt[hn])==null?void 0:Ht.status)!=="compatible"?(xt[hn]={status:"compatible",message:E("myAgents.compatibility.supported")},st=!0):!Ge&&!xt[hn]&&(xt[hn]={status:"checking",message:E("myAgents.compatibility.checking")},st=!0)}return st?xt:gt}),Pqt(We,async gt=>{const st=gt.runtime;if(!st)return;const xt=rb(gt),ft=P.current.get(xt);if(ft)try{const Ht=await Vx(st.runtimeId,st.region,{signal:ft.signal,preferCached:!0,timeoutMs:Qqt,currentVersion:st.currentVersion});if(ft.signal.aborted)return;ve(cn=>({...cn,[xt]:Ht&&Ht.length>0?{status:"compatible",message:E("myAgents.compatibility.supported")}:{status:"unsupported",message:E("myAgents.compatibility.empty")}}))}catch(Ht){if(ft.signal.aborted||(Ht==null?void 0:Ht.name)==="AbortError")return;ve(cn=>({...cn,[xt]:Ose(Ht,E)}))}finally{P.current.get(xt)===ft&&P.current.delete(xt)}})},[m,v,F,V,E]),p.useEffect(()=>()=>{var Me;(Me=T.current)==null||Me.abort();for(const We of P.current.values())We.abort();P.current.clear()},[]);const qe=p.useCallback(async Me=>{var st;(st=A.current)==null||st.abort();const We=new AbortController;A.current=We;const gt=++N.current;Ne(!0),me(""),te([]);try{const xt=Me==="codex"?await Sr.listSessions({signal:We.signal,autoResumeSnapshots:!1}):await Sr.listAgentSessions(Me,{signal:We.signal,autoResumeSnapshots:!1});if(N.current!==gt)return;te(xt.map(ft=>Jqt(ft,E)))}catch(xt){if((xt==null?void 0:xt.name)==="AbortError"||N.current!==gt)return;me(Ab(xt,E("myAgents.loadAgentType",{type:E(`myAgents.agentTypes.${Me}`)}),`GET /web/${Me==="codex"?"sandbox":Me}/sessions`))}finally{A.current===We&&(A.current=null),N.current===gt&&Ne(!1)}},[E]);function De(Me){var We;Me!==m&&(Me==="general"?(j.current+=1,X([]),Q(""),Y(""),ce(!0)):((We=A.current)==null||We.abort(),A.current=null,N.current+=1,te([]),me(""),Ne(!0)),g(Me))}function At(){m==="general"&&(j.current+=1,X([]),Q(""),Y(""),ce(!0))}function It(Me){Me!==H&&(At(),K(Me))}function lt(Me){Me!==F&&(At(),W(Me))}p.useEffect(()=>{var Me;if(m==="general"){(Me=A.current)==null||Me.abort(),A.current=null,N.current+=1;return}return qe(m),()=>{var We;(We=A.current)==null||We.abort(),A.current=null,N.current+=1}},[m,qe,b]),p.useEffect(()=>{const Me=_.current,We=R.current;if(!Me||!We||m!=="general"||!ie||Z)return;const gt=new IntersectionObserver(([st])=>{st.isIntersecting&&Te(ie,!1)},{root:We,rootMargin:"240px 0px",threshold:.01});return gt.observe(Me),()=>gt.disconnect()},[m,Te,Z,ie]);const Ot=p.useCallback(async Me=>{if(!se){Se(Me.id),be(We=>({...We,[Me.id]:""}));try{await new Promise(We=>requestAnimationFrame(()=>We())),Me.sandbox?await f(Me.sandbox):await c(Me)}catch(We){be(gt=>({...gt,[Me.id]:We instanceof Error?We.message:String(We)}))}finally{Se("")}}},[se,c,f]),Ct=p.useCallback(async Me=>{var xt;const We=Me.runtime;if(!We)return;const gt=rb(Me);ve(ft=>({...ft,[gt]:{status:"checking",message:E("myAgents.compatibility.checking")}})),(xt=P.current.get(gt))==null||xt.abort();const st=new AbortController;P.current.set(gt,st);try{const ft=await N6e(()=>Vx(We.runtimeId,We.region,{retryProbe:!0,signal:st.signal,timeoutMs:zqt,currentVersion:We.currentVersion}));if(st.signal.aborted)return;ve(Ht=>({...Ht,[gt]:ft&&ft.length>0?{status:"compatible",message:E("myAgents.compatibility.supported")}:{status:"unsupported",message:E("myAgents.compatibility.empty")}}))}catch(ft){if(st.signal.aborted||wse(ft))return;ve(Ht=>({...Ht,[gt]:Ose(ft,E)}))}finally{P.current.get(gt)===st&&P.current.delete(gt)}},[E]),dt=p.useCallback(Me=>{const We=Me.runtime;!r||!We||xe(Me)||$6({runtimeId:We.runtimeId,region:We.region,appName:Me.appName,currentVersion:We.currentVersion})},[r,xe]),yt=p.useMemo(()=>{const Me=U.trim().toLocaleLowerCase(),We=m==="general"?[...it,...V]:G,st=(H==="mine"?We.filter(cn=>cn.isMine):We).filter(cn=>{var Ge;const hn=((Ge=cn.runtime)==null?void 0:Ge.region)??cn.region;return!hn||hn===F}),xt=Me?st.filter(cn=>cn.name.toLocaleLowerCase().includes(Me)):st;if(m!=="general")return xt;const ft=y.size>0?xt.filter(cn=>!cn.runtime||!y.has(cn.runtime.runtimeId)):xt,Ht=ft.findIndex(cn=>{var hn;return((hn=cn.runtime)==null?void 0:hn.runtimeId)===v});return Ht<=0?ft:[ft[Ht],...ft.slice(0,Ht),...ft.slice(Ht+1)]},[m,v,it,y,U,H,F,V,G]);p.useEffect(()=>{if(!r||m!=="general")return;const Me=yt.filter(ft=>!!ft.runtime).filter(ft=>!xe(ft)).slice(0,Vqt);if(Me.length===0)return;let We=!1,gt=0;const st=async()=>{for(;!We;){const ft=Me[gt];if(gt+=1,!(ft!=null&&ft.runtime)||(await $6({runtimeId:ft.runtime.runtimeId,region:ft.runtime.region,appName:ft.appName,currentVersion:ft.runtime.currentVersion}),We))return}},xt=window.setTimeout(()=>{for(let ft=0;ft{We=!0,window.clearTimeout(xt)}},[m,r,xe,yt]);const Ie=E(`myAgents.agentTypes.${m}`,{defaultValue:E("myAgents.agent")}),vt=m==="general"?Z&&V.length===0&&it.length===0:ye&&G.length===0,jt=!vt&&yt.length===0,ln=(m==="general"?n:i)?m==="general"?()=>o(F):()=>d(m):void 0,He=m==="codex"&&i&&!!l;return a.jsxs(Df,{className:"my-agents-page","aria-label":E("myAgents.agent"),children:[a.jsx(Ky,{title:E("myAgents.agent"),className:"my-agents-header"}),a.jsxs(Gy,{className:"my-agent-toolbar",children:[a.jsx(Xy,{idPrefix:"my-agent-ownership",ariaLabel:E("myAgents.creatorFilter"),value:H,items:[{id:"all",label:E("common.all"),disabled:s==="mine"},{id:"mine",label:E("agentSelector.createdByMe")}],onChange:It}),a.jsxs("div",{className:"resource-toolbar__actions",children:[a.jsx(cg,{id:"my-agent-type-filter",ariaLabel:E("myAgents.agentType"),value:m,options:ke,onChange:De}),a.jsx(cg,{id:"my-agent-region-filter",ariaLabel:E("myAgents.region"),value:F,options:Ke,onChange:lt}),a.jsx(hp,{className:"my-agent-search","aria-label":E("myAgents.searchAgents"),value:U,onChange:Me=>I(Me.target.value),placeholder:E("common.search")}),He?a.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:l,children:[a.jsx(Xqt,{}),a.jsx("span",{children:E("myAgents.handoff")})]}):null]})]}),a.jsxs(Rg,{className:"my-agent-results",ref:R,"aria-label":E("myAgents.agentList",{type:Ie}),children:[vt?a.jsx(Fa,{}):(m==="general"?Ee:pe)&&yt.length===0?a.jsxs("div",{className:"my-agent-empty",role:"alert",children:[a.jsx("p",{children:m==="general"?Ee:pe}),a.jsx("button",{type:"button",onClick:()=>{m==="general"?Te("",!0):qe(m)},children:E("common.reload")})]}):jt&&!ln?U.trim()||H==="mine"||F!==D?a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Snt,{})}),a.jsx(Pn.Title,{children:E("myAgents.noMatchingAgents")}),a.jsx(Pn.Description,{children:E("myAgents.adjustSearch")})]})}):m!=="general"?a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Yqt,{type:m})}),a.jsx(Pn.Title,{className:"my-agent-sandbox-empty-title",children:E("myAgents.noAgentType",{type:Ie})})]})}):a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Bh,{})}),a.jsx(Pn.Title,{children:E("myAgents.noGeneralAgents")}),a.jsx(Pn.Description,{children:E("myAgents.createGeneralAgentDescription")})]})}):a.jsxs(a.Fragment,{children:[m==="general"&&Ee?a.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[a.jsx("span",{children:Ee}),a.jsx("button",{type:"button",onClick:()=>void Te("",!0),children:E("common.reload")})]}):null,a.jsxs(Yy,{className:"my-agent-grid",children:[ln?a.jsx(ug,{className:"my-agent-create-card","aria-label":E("myAgents.createAgentType",{type:Ie}),onClick:ln,icon:a.jsx(Kqt,{}),children:E("myAgents.createAgent")}):null,yt.map(Me=>{var gt,st,xt,ft,Ht;const We=tWt(Me,V,E);return a.jsx(rWt,{agent:Me,onReview:L,deploymentTask:xe(Me),nowMs:ge,onViewDeploymentTask:S,onUse:Ot,compatibility:Me.runtime?Ve[rb(Me)]??{status:"checking",message:E("myAgents.compatibility.checking")}:void 0,onRetryCompatibility:Ct,onPrepareUpdate:((gt=Me.runtime)==null?void 0:gt.canManage)===!1||((st=Me.runtime)==null?void 0:st.visibility)==="enterprise"||((xt=Me.runtime)==null?void 0:xt.reviewStatus)==="pending"?void 0:dt,onViewDetails:We&&((ft=Me.runtime)==null?void 0:ft.canManage)!==!1?()=>{We.sandbox?h(We.sandbox):u(We)}:void 0,connecting:Me.id===se,connectError:Le[Me.id],connected:((Ht=Me.runtime)==null?void 0:Ht.runtimeId)===v,onEditDraft:k,onDeleteDraft:ne},Me.id)})]})]}),m==="general"&&!Ee&&!vt&&(yt.length>0||!!ie)&&a.jsx("div",{className:"my-agent-load-more",ref:_,"aria-live":"polite",children:Z?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:E("myAgents.loadingMore")})]}):ie?a.jsx("span",{children:E("myAgents.scrollForMore")}):a.jsx("span",{children:E("myAgents.allLoaded")})})]}),M!=null&&M.runtime?a.jsx(j6e,{runtimeId:M.runtime.runtimeId,region:M.runtime.region,name:M.name,canPublish:M.runtime.canPublish===!0,onClose:()=>L(null),onChanged:()=>{wb(),Te("",!0)}},`${M.runtime.region}:${M.runtime.runtimeId}`):null,Re?a.jsx(Gu,{title:E("myAgents.deleteDraftTitle"),description:E("myAgents.deleteDraftDescription",{name:Re.draft.name||E("agentSelector.unnamedAgent")}),confirmLabel:E("myAgents.deleteDraft"),variant:"danger",onCancel:()=>ne(null),onConfirm:()=>{C==null||C(Re),ne(null)}}):null]})}function zH({section:e,onWorkspace:t,onEnvironment:n,onProjects:i,actions:r,children:s,className:o=""}){const{t:l}=Ae("ui"),c=l(e==="workspaces"?"workspace.title":e==="environments"?"common.environment":"workspace.codeProjects");return a.jsxs(Df,{className:`workspace-center ${o}`,"aria-label":c,children:[a.jsx(Ky,{title:c}),a.jsxs(Gy,{children:[(t||n)&&a.jsx(Xy,{items:[{id:"workspaces",label:l("workspace.title")},{id:"environments",label:l("common.environment")},...i?[{id:"projects",label:l("workspace.codeProjects")}]:[]],value:e,onChange:u=>{u==="workspaces"&&(t==null||t()),u==="environments"&&(n==null||n()),u==="projects"&&(i==null||i())},ariaLabel:l("workspace.resourceType"),idPrefix:"workspace-center"}),a.jsx("div",{className:"resource-toolbar__actions",children:r})]}),s]})}const oWt="_Container_13560_1",aWt="_Textarea_13560_174",Sse={Container:oWt,Textarea:aWt},Og=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,variant:o="outline",size:l="md",gutterSize:c,className:u,autoComplete:d,disabled:f=!1,readOnly:h=!1,invalid:m=!1,allowAutofillExtensions:g=!!s,onFocus:b,onBlur:v,onAnimationStart:y,onAutofill:x,autoSelect:w,rows:O=3,maxRows:S,autoResize:k,ref:C,onChange:E,...R}=e,[_,j]=p.useState(!1),T=k?Math.max(S??10,O):O;p.useEffect(()=>{var P;w&&((P=t.current)==null||P.select())},[w]);const N=P=>{y==null||y(P),P.animationName==="native-autofill-in"&&(x==null||x())},A=p.useCallback(()=>{if(!k||!t.current||T===void 0)return;t.current.style.height="0px";const P=t.current.scrollHeight;t.current.style.height=P+"px"},[k,T]);return p.useEffect(()=>{A()},[e.value,O,A]),a.jsx("div",{className:Ti(Sse.Container,u),"data-variant":o,"data-size":l,"data-gutter-size":c,"data-focused":_,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:zy({"textarea-min-rows":`${O}`,"textarea-max-rows":`${T}`}),children:a.jsx("textarea",{...R,onChange:P=>{E==null||E(P),A()},ref:EC([t,C]),id:r||(g?void 0:i),className:Sse.Textarea,name:s,readOnly:h,disabled:f,rows:O,onFocus:P=>{j(!0),b==null||b(P)},onBlur:P=>{j(!1),v==null||v(P)},onAnimationStart:N,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},BD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",lWt="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20100%20100'%3e%3ctitle%3ePandoc%20Icon%3c/title%3e%3cdesc%20property='dc:creator'%3eAlbert%20Krewinkel%3c/desc%3e%3cmetadata%20id='license'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3ccc:license%20rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'%20/%3e%3c/cc:Work%3e%3ccc:License%20rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Reproduction'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Distribution'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Notice'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Attribution'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23DerivativeWorks'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23ShareAlike'%20/%3e%3c/cc:License%3e%3c/rdf:RDF%3e%3c/metadata%3e%3crect%20fill='%23fed'%20stroke='%23fed'%20width='100'%20height='100'/%3e%3cg%20fill='none'%20stroke='%234093da'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='8'%20transform='skewX(-6)%20translate(8%201)'%3e%3cpath%20d='M%2030,10%20l%200,80%20M%2045,10%20l%200,80%20M%2020,10%20l%2040,0%20l%2018,18%20l%200,25%20l%20-33,0'%20/%3e%3cpath%20fill='%234093da'%20stroke-width='6'%20d='M%2061,10%20l%2017,17%20l%20-17,0%20l%200,-17'%20/%3e%3c/g%3e%3c/svg%3e",cWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20100%20100'%20version='1.1'%20id='svg4'%20sodipodi:docname='favicon.svg'%20inkscape:version='1.4.4%20(dcaf3e7,%202026-05-05)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview4'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='true'%20inkscape:zoom='8.2236519'%20inkscape:cx='34.534536'%20inkscape:cy='45.174577'%20inkscape:window-width='1881'%20inkscape:window-height='1382'%20inkscape:window-x='1512'%20inkscape:window-y='30'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg4'%3e%3cinkscape:grid%20type='axonomgrid'%20id='grid4'%20units='px'%20originx='0'%20originy='0'%20spacingx='3.7795276'%20spacingy='3.7795276'%20empcolor='%230099e5'%20empopacity='0.30196078'%20color='%230099e5'%20opacity='0.14901961'%20empspacing='0'%20dotted='false'%20gridanglex='40'%20gridanglez='40'%20enabled='true'%20visible='true'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs1'%3e%3cfilter%20id='shadow'%20x='0'%20y='0'%20width='1'%20height='1'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='3'%20flood-color='rgba(50,%2050,%2093,%200.18)'%20/%3e%3c/filter%3e%3c/defs%3e%3crect%20x='4'%20y='4'%20width='92'%20height='92'%20rx='22.08'%20fill='%23e8efff'%20filter='url(%23shadow)'%20id='rect1'%20transform='matrix(1.0869565,0,0,1.0869565,-4.347826,-4.347826)'%20style='stroke-width:0.92'%20ry='22.08'%20/%3e%3cpath%20style='fill:%230a2540;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,6.535431%204.9573423,44.330708%2049.999999,82.125984%2092.790523,46.220471%2095.042656,44.330708%20Z'%20id='path1'%20/%3e%3cpath%20style='fill:%23425466;fill-opacity:1;stroke-width:1.88976'%20d='M%204.9573423,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20V%2082.125984%20Z'%20id='path2'%20/%3e%3cpath%20style='fill:%231a3550;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,82.125984%2095.042656,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20Z'%20id='path3'%20/%3e%3cpath%20style='fill:%234ade80;stroke:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill-opacity:1'%20d='m%2045.042657,30.236221%209.008531,-7.559055%2022.521328,18.897638%20-9.008531,7.559056%20z'%20id='path5'%20/%3e%3cpath%20style='fill:none;fill-opacity:1;stroke:%234ade80;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1'%20d='M%2027.025594,49.133859%2047.29479,47.244096%2045.042657,64.25197'%20id='path6'%20/%3e%3c/svg%3e",uWt="data:image/svg+xml,%3csvg%20fill='%23261230'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAstral%3c/title%3e%3cpath%20d='M1.44%200C.6422%200%200%20.6422%200%201.44v21.12C0%2023.3578.6422%2024%201.44%2024h21.12c.7978%200%201.44-.6422%201.44-1.44V1.44C24%20.6422%2023.3578%200%2022.56%200Zm4.7998%204.8h11.5199c.7953%200%201.44.6447%201.44%201.44V19.2h-6.624v-4.32h-1.152v4.32H4.8V6.24c0-.7953.6446-1.44%201.4398-1.44m4.032%205.472v1.152h3.456v-1.152z'/%3e%3c/svg%3e",dWt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1.34em'%20height='1em'%20viewBox='0%200%20256%20192'%3e%3cpath%20fill='%232d4552'%20d='M84.38%20108.352c-9.556%202.712-15.826%207.467-19.956%2012.218c3.956-3.461%209.255-6.639%2016.402-8.665c7.311-2.072%2013.548-2.057%2018.702-1.062v-4.03c-4.397-.402-9.437-.082-15.148%201.539M63.987%2074.475l-35.49%209.35s.646.914%201.844%202.133l30.092-7.93s-.427%205.495-4.13%2010.41c7.005-5.299%207.684-13.963%207.684-13.963m29.709%2083.41c-49.946%2013.452-76.37-44.43-84.37-74.472c-3.696-13.868-5.31-24.37-5.74-31.148a11.5%2011.5%200%200%201%20.025-1.84C1.021%2050.58-.22%2051.927.032%2055.82c.43%206.773%202.044%2017.275%205.74%2031.147c7.997%2030.038%2034.424%2087.92%2084.37%2074.468c10.871-2.929%2019.038-8.263%2025.17-15.073c-5.652%205.104-12.724%209.123-21.616%2011.523M103.08%2039.05v3.555h19.59c-.401-1.259-.806-2.393-1.208-3.555z'/%3e%3cpath%20fill='%232d4552'%20d='M127.05%2068.325c8.81%202.503%2013.47%208.68%2015.933%2014.146l9.824%202.79s-1.34-19.132-18.645-24.047c-16.189-4.6-26.151%208.995-27.363%2010.754c4.71-3.355%2011.586-6.102%2020.251-3.643m78.197%2014.234c-16.204-4.62-26.162%209.003-27.356%2010.737c4.713-3.351%2011.586-6.099%2020.247-3.629c8.797%202.506%2013.452%208.676%2015.923%2014.146l9.837%202.8s-1.361-19.135-18.651-24.054m-9.76%2050.443l-81.718-22.845s.885%204.485%204.279%2010.293l68.803%2019.234c5.664-3.277%208.636-6.682%208.636-6.682m-56.655%2049.174C74.127%20164.828%2081.949%2082.386%2092.419%2043.32c4.311-16.1%208.743-28.066%2012.419-36.088c-2.193-.451-4.01.704-5.804%204.354C95.13%2019.5%2090.14%2032.387%2085.312%2050.427c-10.467%2039.066-18.29%20121.506%2046.412%20138.854c30.497%208.17%2054.256-4.247%2071.966-23.749c-16.81%2015.226-38.274%2023.763-64.858%2016.644'/%3e%3cpath%20fill='%23e2574c'%20d='M103.081%20138.565v-16.637l-46.223%2013.108s3.415-19.846%2027.522-26.684c7.311-2.072%2013.549-2.058%2018.701-1.063V39.05h23.145c-2.52-7.787-4.958-13.782-7.006-17.948c-3.387-6.895-6.859-2.324-14.741%204.269c-5.552%204.638-19.583%2014.533-40.698%2020.222c-21.114%205.694-38.185%204.184-45.307%202.95c-10.097-1.742-15.378-3.96-14.884%203.721c.43%206.774%202.043%2017.277%205.74%2031.148c7.996%2030.039%2034.424%2087.92%2084.37%2074.468c13.046-3.515%2022.254-10.464%2028.637-19.32h-19.256zm-74.588-54.74l35.494-9.35s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.812-21.154-7.812'/%3e%3cpath%20fill='%232ead33'%20d='M236.664%2039.84c-9.226%201.617-31.361%203.632-58.716-3.7c-27.363-7.328-45.517-20.144-52.71-26.168c-10.197-8.54-14.682-14.476-19.096-5.498c-3.902%207.918-8.893%2020.805-13.723%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.853c64.687%2017.333%2099.126-57.978%20109.593-97.047c4.83-18.037%206.948-31.695%207.53-40.502c.665-9.976-6.187-7.08-19.29-4.784M106.668%2072.161s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046zm42.215%2071.163c-30.419-8.91-35.11-33.167-35.11-33.167l81.714%2022.846c0-.004-16.494%2019.12-46.604%2010.32m28.89-49.85s10.183-15.847%2027.474-10.918c17.29%204.923%2018.651%2024.054%2018.651%2024.054z'/%3e%3cpath%20fill='%23d65348'%20d='m86.928%20126.51l-30.07%208.522s3.266-18.609%2025.418-25.983L65.25%2045.147l-1.471.447c-21.115%205.694-38.185%204.184-45.307%202.95c-10.097-1.741-15.379-3.96-14.885%203.722c.43%206.774%202.044%2017.276%205.74%2031.147c7.997%2030.039%2034.425%2087.92%2084.37%2074.468l1.471-.462zM28.493%2083.825l35.494-9.351s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.811-21.154-7.811'/%3e%3cpath%20fill='%231d8d22'%20d='m150.255%20143.658l-1.376-.335c-30.419-8.91-35.11-33.166-35.11-33.166l42.137%2011.778l22.308-85.724l-.27-.07c-27.362-7.329-45.516-20.145-52.71-26.17c-10.196-8.54-14.682-14.475-19.096-5.497c-3.898%207.918-8.889%2020.805-13.719%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.852l1.326.3zM106.668%2072.16s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046z'/%3e%3cpath%20fill='%23c04b41'%20d='m88.46%20126.072l-8.064%202.289c1.906%2010.74%205.264%2021.047%2010.534%2030.152c.918-.202%201.828-.376%202.762-.632c2.449-.66%204.72-1.479%206.906-2.371c-5.89-8.74-9.785-18.804-12.137-29.438m-3.148-75.644c-4.144%2015.467-7.852%2037.73-6.831%2060.06c1.826-.793%203.756-1.532%205.9-2.14l1.492-.334c-1.82-23.852%202.114-48.157%206.546-64.694a323%20323%200%200%201%203.373-11.704a105%20105%200%200%201-5.974%203.547a307%20307%200%200%200-4.506%2015.265'/%3e%3c/svg%3e",fWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='512'%20height='512'%20version='1.1'%20viewBox='0%200%20135.47%20135.47'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m67.733%2067.733%2029.33%2016.933-29.33%2050.8c37.408%200%2067.733-30.325%2067.733-67.733%200-12.341-3.3168-23.901-9.0837-33.867h-58.65z'%20fill='%23afccf9'/%3e%3cpath%20d='m67.733-1e-6c-25.07%200-46.942%2013.63-58.654%2033.875l29.324%2050.792%2029.33-16.933v-33.867h58.65c-11.714-20.24-33.583-33.867-58.65-33.867z'%20fill='%231767d1'/%3e%3cpath%20d='m0%2067.733c0%2037.408%2030.324%2067.733%2067.733%2067.733l29.33-50.8-29.33-16.933-29.33%2016.933-29.324-50.792c-5.7637%209.9632-9.0794%2021.519-9.0794%2033.858'%20fill='%23679ef5'/%3e%3cpath%20d='m101.6%2067.733c0%2018.704-15.163%2033.867-33.867%2033.867-18.704%200-33.867-15.163-33.867-33.867s15.163-33.867%2033.867-33.867c18.704%200%2033.867%2015.163%2033.867%2033.867'%20fill='%23fff'/%3e%3cpath%20d='m95.25%2067.733c0%2015.197-12.32%2027.517-27.517%2027.517-15.197%200-27.517-12.32-27.517-27.517%200-15.197%2012.32-27.517%2027.517-27.517%2015.197%200%2027.517%2012.32%2027.517%2027.517'%20fill='%231a74e7'/%3e%3c/svg%3e",hWt="data:image/svg+xml,%3csvg%20fill='%23F03C2E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e",pWt="data:image/svg+xml,%3csvg%20fill='%23073551'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ecurl%3c/title%3e%3cpath%20d='M.803%2014.8169c0-.5342.433-.9665.9665-.9665.5335%200%20.9665.4323.9665.9665%200%20.5335-.433.9657-.9665.9657-.5335%200-.9666-.4322-.9666-.9657m2.736%200c0-.1963-.0532-.376-.1119-.5525-.2344-.7024-.876-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0708C.6149%2013.2865%200%2013.9646%200%2014.817c0%20.9764.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.793%201.7694-1.7694m-1.7694-7.149c.5335%200%20.9665.433.9665.9665%200%20.5335-.433.9665-.9665.9665-.5343%200-.9666-.433-.9666-.9665%200-.5335.4323-.9665.9666-.9665m0%202.7359c.9772%200%201.7694-.7923%201.7694-1.7694%200-.1956-.0532-.376-.1119-.5525-.2344-.7024-.8767-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0716C.6149%207.104%200%207.782%200%208.6344c0%20.9771.7923%201.7694%201.7695%201.7694m13.221-5.694c-.5342%200-.9665-.433-.9665-.9664a.966.966%200%2001.9666-.9665c.5335%200%20.9658.4322.9658.9665%200%20.5334-.4323.9664-.9658.9664m-9.6%2016.5133c-.5335%200-.9666-.433-.9666-.9665%200-.5342.433-.9665.9666-.9665a.966.966%200%2001.9665.9665c0%20.5335-.4323.9665-.9665.9665m9.6-19.2491c-.978%200-1.7695.7922-1.7695%201.7694%200%20.2085.0525.4025.1187.5882L5.039%2018.5581c-.803.1681-1.4179.8462-1.4179%201.6985%200%20.9772.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.7922%201.7694-1.7694%200-.1963-.0525-.3759-.111-.5525l8.3427-14.2728c.7778-.1865%201.3683-.8531%201.3683-1.688%200-.977-.793-1.7693-1.7694-1.7693m7.24%202.7359c-.5343%200-.9666-.433-.9666-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9666.4322.9666.9665%200%20.5334-.433.9665-.9666.9665M12.6313%2021.223c-.5343%200-.9665-.433-.9665-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9658.4323.9658.9665%200%20.5335-.4323.9665-.9658.9665M22.2305%201.974c-.9772%200-1.7694.7922-1.7694%201.7694%200%20.2085.0525.4025.1187.5882l-8.3009%2014.2265c-.8021.1681-1.417.8462-1.417%201.6985%200%20.9772.7922%201.7694%201.7694%201.7694.9764%200%201.7687-.7922%201.7687-1.7694%200-.1963-.0525-.3759-.1111-.5525l8.3427-14.2728C23.4094%205.2448%2024%204.5782%2024%203.7433c0-.977-.7923-1.7693-1.7695-1.7693'/%3e%3c/svg%3e",mWt="data:image/svg+xml,%3csvg%20fill='%23007808'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eFFmpeg%3c/title%3e%3cpath%20d='M21.72%2017.91V6.5l-.53-.49L9.05%2018.52l-1.29-.06L24%201.53l-.33-.95-11.93%201-5.75%206.6v-.23l4.7-5.39-1.38-.77-9.11.77v2.85l1.91.46v.01l.19-.01-.56.66v10.6c.609-.126%201.22-.241%201.83-.36L14.12%205.22l.83-.04L0%2021.44l9.67.82%201.35-.77%206.82-6.74v2.15l-5.72%205.57%2011.26.95.35-.94v-3.16l-3.29-.18c.434-.403.858-.816%201.28-1.23z'/%3e%3c/svg%3e",gWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%201080%201080'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.3.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.3%20Build%20182)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23ff0;%20}%20.st1%20{%20fill:%20%23333;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M660.52,419.49l-195.15-52.98c-15.84-4.3-19.16-25.29-5.43-34.28l169.23-110.7-9.91-201.97c-.8-16.39,18.13-26.04,30.92-15.76l157.57,126.74,189.03-71.84c15.34-5.83,30.37,9.2,24.54,24.54l-71.84,189.03,126.74,157.57c10.29,12.79.64,31.73-15.76,30.92l-201.97-9.91-110.7,169.23c-8.98,13.73-29.98,10.41-34.28-5.43l-52.98-195.15h-.01Z'/%3e%3cpath%20class='st1'%20d='M603.34,476.66l32.94,121.68,4.45,16.23-429.11,429.11c-48.45,48.45-126.85,48.45-175.3,0C12.16,1019.51,0,987.89,0,956.15s12.02-63.48,36.31-87.77l429.11-429.11,16.35,4.33,121.56,33.06h0Z'/%3e%3c/svg%3e";function VH(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}sl.registerLanguage("bash",Hz);const bWt=48;function yWt(e,t=bWt){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function vWt(e){return sl.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function xWt({status:e}){return e==="succeeded"?a.jsx(Md,{"aria-hidden":!0}):e==="failed"?a.jsx(Z6,{"aria-hidden":!0}):e==="running"?a.jsx(Ei,{className:"studio-build-progress__spinner","aria-hidden":!0}):a.jsx(Wnt,{"aria-hidden":!0})}function Ese(e,t){if(!e)return"";const n=Date.parse(e);return Number.isNaN(n)?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(n)}function wWt({steps:e,log:t,logError:n="",logTruncated:i=!1,logUpdatedAt:r,loading:s=!1}){const{t:o,i18n:l}=Ae("ui"),c=p.useRef(null),u=p.useRef(!0),[d,f]=p.useState(!1),h=p.useMemo(()=>vWt(t),[t]);p.useEffect(()=>{const g=c.current;g&&t&&u.current&&(g.scrollTop=g.scrollHeight)},[t]);const m=async()=>{try{await navigator.clipboard.writeText(t),f(!0),window.setTimeout(()=>f(!1),1500)}catch{f(!1)}};return a.jsxs("div",{className:"studio-build-progress",children:[a.jsx("ol",{className:"studio-build-progress__steps","aria-label":o("studioBuildProgress.steps"),children:e.map(g=>a.jsxs("li",{className:`is-${g.status}`,children:[a.jsx("span",{className:"studio-build-progress__step-icon",children:a.jsx(xWt,{status:g.status})}),a.jsx("span",{children:g.label})]},g.key))}),a.jsxs("section",{className:"studio-build-progress__log","aria-label":o("studioBuildProgress.log"),children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("strong",{children:o("studioBuildProgress.log")}),a.jsxs("span",{children:[o(s?"studioBuildProgress.syncing":n?"studioBuildProgress.loadFailed":"studioBuildProgress.synced"),i?o("studioBuildProgress.recentOnly"):"",Ese(r,l.resolvedLanguage??l.language)?` · ${Ese(r,l.resolvedLanguage??l.language)}`:""]})]}),a.jsxs(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void m(),"aria-label":o(d?"studioBuildProgress.copiedLog":"studioBuildProgress.copyLog"),children:[d?a.jsx(Md,{"aria-hidden":!0}):a.jsx(JI,{"aria-hidden":!0}),o(d?"studioBuildProgress.copied":"studioBuildProgress.copy")]})]}),t?a.jsx("pre",{ref:c,tabIndex:0,"aria-label":o("studioBuildProgress.logContent"),onScroll:g=>{u.current=yWt(g.currentTarget)},children:a.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:h}})}):a.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||o(s?"studioBuildProgress.waiting":"studioBuildProgress.empty")})]})]})}function Cse({name:e,description:t,icon:n,selected:i,disabled:r=!1,onChange:s,className:o=""}){return a.jsxs("button",{type:"button",className:`studio-package-option${i?" is-selected":""}${o?` ${o}`:""}`,"aria-pressed":i,disabled:r,onClick:()=>s(!i),children:[a.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),a.jsxs("span",{className:"studio-package-option__content",children:[a.jsx("strong",{children:e}),t?a.jsx("span",{children:t}):null]}),a.jsx("span",{className:"studio-package-option__action","aria-hidden":"true",children:i?a.jsx(Tnt,{}):a.jsx(jnt,{})})]})}function sb(e,t){return e[t]|e[t+1]<<8}function q0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function OWt(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function R6e(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(q0(e,u)===101010256){i=u;break}if(i<0)throw new Error(Kt("helpers.zip.invalid"));const r=sb(e,i+10);if(t.maxEntries!==void 0&&r>t.maxEntries)throw new Error(Kt("helpers.zip.tooManyFiles",{count:t.maxEntries}));let s=q0(e,i+16);const o=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error(Kt("helpers.zip.tooLarge"));const x=sb(e,v+26),w=sb(e,v+28),O=v+30+x+w,S=e.subarray(O,O+f);let k;if(d===0)k=S;else if(d===8)k=await OWt(S);else{s+=46+m+g+b;continue}l.push({name:y,text:o.decode(k)}),s+=46+m+g+b}return l}const BB=/(^|\/)skill\.md$/i;function kWt(e){const t=(e??"").replace(/\r\n?/g,` +`),x=(e==null?void 0:e.pendingMessage)||s;if(p.useEffect(()=>{e&&f(u)},[e==null?void 0:e.status,u]),p.useEffect(()=>{if(!d||!g)return;const E=c.current;E&&(E.scrollTop=E.scrollHeight)},[d,g,y]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const w=bqt(e.updatedAt,l.resolvedLanguage??l.language),O=e.status==="complete"?o("agentWorkspace.logStatus.synced"):e.status==="error"?o("agentWorkspace.logStatus.failed"):o("agentWorkspace.logStatus.syncing"),S=e.omittedEarly?o("agentWorkspace.logStatus.earlyOmitted"):e.snapshotTruncated?o("agentWorkspace.logStatus.recentOnly"):e.truncated?o("agentWorkspace.logStatus.partiallyOmitted"):"",k=[O,e.lineCount?o("agentWorkspace.logLines",{count:e.lineCount}):"",S,w].filter(Boolean).join(" · ");async function C(){try{await navigator.clipboard.writeText(b),m(!0),window.setTimeout(()=>m(!1),1500)}catch{m(!1)}}return a.jsxs("section",{className:`aw-deploy-log is-${e.status}${d?"":" is-collapsed"}`,"aria-label":i,children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("strong",{children:n}),a.jsx("span",{children:k})]}),a.jsxs("div",{className:"aw-deploy-log-actions",children:[g&&a.jsx("button",{type:"button",onClick:()=>f(E=>!E),children:o(d?"common.collapse":"common.expand")}),g&&a.jsxs("button",{type:"button",onClick:()=>void C(),"aria-label":h?o("agentWorkspace.copiedLabel",{label:r}):o("agentWorkspace.copyLabel",{label:r}),title:h?o("agentWorkspace.copied"):o("agentWorkspace.copyLabel",{label:r}),children:[h?a.jsx(Md,{"aria-hidden":!0}):a.jsx(JI,{"aria-hidden":!0}),a.jsx("span",{children:o(h?"agentWorkspace.copied":"agentWorkspace.copy")})]})]})]}),d&&(g?a.jsx("pre",{ref:c,children:y}):a.jsx("div",{className:"aw-deploy-log-empty",children:x}))]})}function yqt({task:e}){var n;const{t}=Ae("ui");return a.jsx(_6e,{log:e.buildLog,autoExpand:((n=e.buildLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&A6e(e,t)===1,title:t("agentWorkspace.buildLog"),ariaLabel:t("agentWorkspace.buildLog"),copyLabel:t("agentWorkspace.buildLog"),defaultPendingMessage:t("agentWorkspace.waitingBuildLog")})}function vqt({task:e}){var n;const{t}=Ae("ui");return a.jsx(_6e,{log:e.githubLog,autoExpand:((n=e.githubLog)==null?void 0:n.status)!=="complete"&&(e.status==="running"||e.status==="error")&&e.phase==="github",title:t("agentWorkspace.githubMountLog"),ariaLabel:t("agentWorkspace.githubDeliveryMountLog"),copyLabel:t("agentWorkspace.githubMountLog"),defaultPendingMessage:t("agentWorkspace.waitingGithubMountLog")})}function xqt({task:e,onReturnToEdit:t}){const{t:n}=Ae("ui"),i=T6e(e,n),r=A6e(e,n),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),o=e.status==="running"&&e.statusUnconfirmed?n("agentWorkspace.deployStatus.unconfirmed"):e.status==="running"?n("agentWorkspace.deployStatus.running"):e.status==="success"?n("agentWorkspace.deployStatus.success"):e.status==="error"?n("agentWorkspace.deployStatus.error"):n("agentWorkspace.deployStatus.cancelled");return a.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[a.jsxs("div",{className:"aw-deploy-progress-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"&&e.statusUnconfirmed?a.jsx(N_,{}):e.status==="running"?a.jsx(Ei,{className:"spin"}):e.status==="success"?a.jsx(Knt,{}):e.status==="error"?a.jsx(N_,{}):a.jsx(Z6,{})}),a.jsxs("div",{children:[a.jsx("h3",{children:o}),a.jsx("p",{children:e.runtimeName})]})]}),a.jsx("strong",{children:e.status==="running"&&!e.statusUnconfirmed?`${Math.round(s)}%`:e.label})]}),a.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":n("agentWorkspace.deploymentProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:a.jsx("span",{style:{width:`${s}%`}})}),a.jsx("ol",{className:"aw-deploy-steps",children:i.map((l,c)=>{const u=e.status==="success"||cnew Set),[mt,_n]=p.useState(()=>new Set),[Vt,Ai]=p.useState(!1),[jn,Hn]=p.useState(""),[En,vi]=p.useState(null),[Fn,di]=p.useState([]),[wr,mr]=p.useState([]),[ir,ze]=p.useState(!1),[kt,nn]=p.useState(""),[Nn,re]=p.useState(""),[xi,is]=p.useState(0),[$r,qn]=p.useState([]),[oi,Vi]=p.useState(!1),[Fr,ea]=p.useState(""),[za,Hr]=p.useState(0),[vo,Bs]=p.useState(null),[Js,js]=p.useState(1),[Us,xo]=p.useState(!1),[Oa,_i]=p.useState(""),[yi,Ll]=p.useState(0),[wo,Li]=p.useState(!1),[ul,$o]=p.useState(()=>new Set),[Ns,gc]=p.useState(!1),[ta,or]=p.useState(""),[Oo,rs]=p.useState(""),[Va,Qn]=p.useState(()=>new Set),Qs=p.useRef(!1),vs=p.useRef(""),ss=p.useRef(null),zs=p.useRef(0),qr=p.useRef(0),ji=p.useRef(0),[Fo,eo]=p.useState(ZHt),[pu,dl]=p.useState("");p.useEffect(()=>{e.length!==0&&eo(de=>de.map((Ue,tt)=>tt===0&&Ue.agentIds.length===0?{...Ue,agentIds:e.slice(0,2).map(nt=>nt.id)}:Ue))},[e]);const ka=p.useMemo(()=>{const de=new Map;for(const Ue of e)Ue.runtimeId&&de.set(Ue.runtimeId,Ue);return de},[e]),Bo=p.useMemo(()=>{var Ue;const de=new Map;for(const tt of t){const nt=(Ue=tt.deploymentTarget)==null?void 0:Ue.runtimeId;if(!nt||!ka.has(nt))continue;const kn=de.get(nt);(!kn||tt.updatedAt>kn.updatedAt)&&de.set(nt,tt)}return de},[ka,t]),Wr=p.useMemo(()=>{const de=new Map;for(const Ue of f){if(!Ue.runtimeId)continue;const tt=de.get(Ue.runtimeId);(!tt||Ue.startedAt>tt.startedAt)&&de.set(Ue.runtimeId,Ue)}return de},[f]),id=p.useMemo(()=>{const de=Me.trim().toLowerCase();return de?e.filter(Ue=>{const tt=Ue.runtimeId?Bo.get(Ue.runtimeId):void 0,nt=Ue.runtimeId?Wr.get(Ue.runtimeId):void 0;return[Ue.label,Ue.app,Ue.host??"",(tt==null?void 0:tt.draft.name)??"",(tt==null?void 0:tt.draft.description)??"",(nt==null?void 0:nt.runtimeName)??""].join(" ").toLowerCase().includes(de)}):e},[e,Wr,Me,Bo]),xs=p.useMemo(()=>{const de=Me.trim().toLowerCase();return t.filter(Ue=>{var nt;const tt=(nt=Ue.deploymentTarget)==null?void 0:nt.runtimeId;return tt&&ka.has(tt)?!1:de?`${Ue.draft.name} ${Ue.draft.description}`.toLowerCase().includes(de):!0})},[ka,t,Me]),bc=p.useMemo(()=>t.filter(de=>{var tt;const Ue=(tt=de.deploymentTarget)==null?void 0:tt.runtimeId;return!Ue||!ka.has(Ue)}).length,[ka,t]),mu=p.useMemo(()=>{const de=Me.trim().toLowerCase();return de?Fo.filter(Ue=>Ue.name.toLowerCase().includes(de)):Fo},[Fo,Me]),we=e.find(de=>de.id===I),ai=t.find(de=>de.id===K),Yi=h?f.find(de=>de.id===h):void 0,na=we!=null&&we.runtimeId?Bo.get(we.runtimeId):void 0,gi=y?It:I&&r===I?i:null,Zi=(gi==null?void 0:gi.appName)||(we==null?void 0:we.runtimeApp)||(we==null?void 0:we.app)||"",Ha=(c&&(we!=null&&we.runtimeId)?hse:hse.filter(de=>de!=="usage")).map(de=>({id:de,label:A(`agentWorkspace.sections.${de}`)})),Uo=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"cn-beijing",Zi,Js]),os=(vo==null?void 0:vo.requestKey)===Uo?vo.value:null,ia=`${(we==null?void 0:we.region)??"cn-beijing"}:${(we==null?void 0:we.runtimeId)??""}`,$l=(Ne==null?void 0:Ne.requestKey)===ia?Ne.value:"",gr=(X==null?void 0:X.requestKey)===ia?X:null,Qo=!!((Jn=gr==null?void 0:gr.apiApps)!=null&&Jn.length),qa=!!(gr!=null&&gr.a2a),ra=((Jf=gr==null?void 0:gr.apiApps)==null?void 0:Jf[0])??Zi,Mn=(W==null?void 0:W.endpoint)??"",Wa=nqt(((S1=gr==null?void 0:gr.a2a)==null?void 0:S1.endpoint)??"",Mn),sa=(we==null?void 0:we.runtimeApp)||"",Ka=JSON.stringify([(we==null?void 0:we.runtimeId)??"",(we==null?void 0:we.region)??"",(we==null?void 0:we.currentVersion)??null,sa]),_e=l&&(we!=null&&we.runtimeId)&&we.region&&ln===0?L6({runtimeId:we.runtimeId,region:we.region,appName:sa,currentVersion:we.currentVersion}):null,Je=(ue==null?void 0:ue.requestKey)===Ka?ue.value:_e,Mt=Je!=null&&Je.reason?Fu(Je.reason,P.resolvedLanguage||P.language):"",Tn=(Je==null?void 0:Je.warnings.filter(de=>Fu(de,P.resolvedLanguage||P.language)))??[];p.useEffect(()=>{const de=zs.current+1;zs.current=de,xe(null),At("");const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"";if(!l||!Ue||!tt){qe(!1);return}const nt=ln===0?L6({runtimeId:Ue,region:tt,appName:sa,currentVersion:we==null?void 0:we.currentVersion}):null;if(nt){xe({requestKey:Ka,value:nt}),qe(!1);return}const kn=new AbortController;let ct,wi=0;const io=60;qe(!0);const Oi=Vs=>{DI({runtimeId:Ue,region:tt,appName:sa,currentVersion:we==null?void 0:we.currentVersion,signal:kn.signal,force:Vs&&ln>0}).then(ml=>{var b0,xT;if(de!==zs.current)return;const Pp=ml.recoveryStatus==="preparing";if(ml.runtime.runtimeId!==Ue||ml.runtime.region!==tt||!Pp&&sa&&((b0=ml.agent)==null?void 0:b0.appName)!==sa||ml.canUpdate&&!((xT=ml.agent)!=null&&xT.appName)){At(A("agentWorkspace.errors.updateCapabilityMismatch"));return}if(xe({requestKey:Ka,value:ml}),qe(!1),!!Pp){if(wi+=1,wi>=io){At(A("agentWorkspace.errors.updateConfigRestoring"));return}ct=window.setTimeout(()=>Oi(!1),1e3)}}).catch(()=>{de!==zs.current||kn.signal.aborted||At(A("agentWorkspace.errors.checkUpdateCapability"))}).finally(()=>{de===zs.current&&!kn.signal.aborted&&qe(!1)})};return Oi(!0),()=>{kn.abort(),ct!=null&&window.clearTimeout(ct)}},[l,sa,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId,Ka]);const on=p.useMemo(()=>{const de=new Map(e.map((tt,nt)=>[tt.id,nt])),Ue=new Map(n.map((tt,nt)=>[tt,nt]));return[...id].sort((tt,nt)=>{const kn=tt.runtimeId?Wr.get(tt.runtimeId):void 0,ct=nt.runtimeId?Wr.get(nt.runtimeId):void 0,wi=(kn==null?void 0:kn.status)==="running"?kn.startedAt:0,io=(ct==null?void 0:ct.status)==="running"?ct.startedAt:0;if(wi!==io)return io-wi;const Oi=Ue.get(tt.id),Vs=Ue.get(nt.id);return Oi!=null&&Vs!=null?Oi-Vs:Oi!=null?-1:Vs!=null?1:(de.get(tt.id)??0)-(de.get(nt.id)??0)})},[n,e,id,Wr]),bn=(we==null?void 0:we.label)||(gi==null?void 0:gi.name)||(ai==null?void 0:ai.draft.name)||(Yi==null?void 0:Yi.agentName)||((g0=Yi==null?void 0:Yi.agentDraft)==null?void 0:g0.name)||A("agentWorkspace.noAgentSelected"),On=Fo.find(de=>de.id===pu),ae=on.filter(de=>de.canDelete===!0),Pe=on.filter(de=>vn.has(de.id)&&de.canDelete===!0),et=xs.filter(de=>mt.has(de.id)),ht=ae.length+xs.length,Yt=Pe.length+et.length,un=p.useMemo(()=>{var Ue;if(Yi!=null&&Yi.agentDraft)return Yi.agentDraft;if(ai!=null&&ai.draft)return ai.draft;const de=(Ue=we==null?void 0:we.region)!=null&&Ue.startsWith("ap-")?"byteplus":"volcengine";return Je!=null&&Je.agent&&(Je.recoveryStatus==="complete"||Je.recoveryStatus==="draft-only")?bz(Je.agent,de,Je.runtime.configuredEnvKeys):aqt(gi,Zi||(we==null?void 0:we.label)||"agent",de)},[gi,Zi,we==null?void 0:we.label,we==null?void 0:we.region,ai==null?void 0:ai.draft,Yi==null?void 0:Yi.agentDraft,Je]),Kr=((vT=gi==null?void 0:gi.draft)==null?void 0:vT.harnessSidecar)??Dvt(W==null?void 0:W.envs),zo=Kr?Yw.filter(de=>Kr.componentOverrides[de]):[],fl=ai?o?"":A("agentWorkspace.errors.noCreatePermission"):l?we!=null&&we.runtimeId?we.region?Te?A("agentWorkspace.errors.checkingUpdateConfig"):De||(Je?Je.recoveryStatus!=="complete"&&Je.recoveryStatus!=="draft-only"?Mt||A("agentWorkspace.errors.originalConfigUnavailable"):Je.canUpdate?(gu=Je.agent)!=null&&gu.appName?"":A("agentWorkspace.errors.agentInfoMissing"):Mt||A("agentWorkspace.errors.updateUnsupported"):A("agentWorkspace.errors.updateCapabilityPending")):A("agentWorkspace.errors.runtimeRegionMissing"):A("agentWorkspace.errors.cloudOnlyUpdate"):A("agentWorkspace.errors.noManagePermission"),hl="aw-update-disabled-reason",Xf=p.useMemo(()=>{if(gi)return gi.tools;const de=(un.builtinTools??[]).map(Ue=>{var tt;return((tt=Xw.find(nt=>nt.id===Ue))==null?void 0:tt.label)??Ue});return Array.from(new Set([...un.tools,...de,...(un.customTools??[]).map(Ue=>Ue.name),...(un.mcpTools??[]).map(Ue=>Ue.name)].filter(Boolean)))},[un,gi]),Hi=p.useMemo(()=>gi?gi.skillsPreviewSupported?gi.skills.map(de=>de.name):null:Array.from(new Set([...(un.selectedSkills??[]).map(de=>de.name),...un.skills].filter(Boolean))),[un,gi]),qi=p.useMemo(()=>{if(Yi)return Yi;if(ai){const de=f.filter(Ue=>Ue.draftId===ai.id).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0];return de||f.filter(Ue=>{var tt,nt;return((tt=Ue.agentDraft)==null?void 0:tt.name)===ai.draft.name||Ue.agentName===ai.draft.name||!!((nt=ai.deploymentTarget)!=null&&nt.runtimeId)&&Ue.runtimeId===ai.deploymentTarget.runtimeId}).sort((Ue,tt)=>tt.startedAt-Ue.startedAt)[0]}if(we)return f.filter(de=>!!we.runtimeId&&de.runtimeId===we.runtimeId||de.agentName===we.label).sort((de,Ue)=>Ue.startedAt-de.startedAt)[0]},[f,we,ai,Yi]),Tt=!!(h&&qi&&qi.id===h),fi=!!(qi&&(qi.status!=="success"||Tt)),ee=(qi==null?void 0:qi.status)==="running",Fe=qi!=null&&qi.draftId?t.find(de=>de.id===qi.draftId)??(qi.agentDraft?{id:qi.draftId,draft:qi.agentDraft,updatedAt:qi.startedAt}:void 0):void 0,pt=p.useMemo(()=>pqt(un),[un]),qt=(we==null?void 0:we.currentVersion)??(W==null?void 0:W.currentVersion)??null,xn=qt??(Yi==null?void 0:Yi.startedAt)??"unknown",Zn=gi?`runtime:${(we==null?void 0:we.runtimeId)??gi.name}:v${xn}:${pt}`:`draft:${(Yi==null?void 0:Yi.id)??(ai==null?void 0:ai.id)??(we==null?void 0:we.id)??bn}:${pt}`;p.useEffect(()=>{L==="usage"&&!c&&U("basic")},[c,L]),p.useEffect(()=>{if(!h)return;const de=f.find(tt=>tt.id===h),Ue=de!=null&&de.runtimeId?ka.get(de.runtimeId):void 0;if(Ue){F(""),H(Ue.id),U("basic");return}H(""),F(""),U("basic")},[ka,f,h]),p.useEffect(()=>{if(!m){vs.current="";return}const de=`${m}:${g}:${b}:${c}`;vs.current!==de&&e.some(Ue=>Ue.id===m)&&(vs.current=de,F(""),H(m),U(g==="usage"&&!c?"basic":g),g==="evaluations"&&(st(b),ft("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const de of on.slice(0,8)){if(!de.runtimeId)continue;const Ue=de.region??"cn-beijing";xCe(de.runtimeId,Ue),yEe(de.runtimeId,Ue,de.runtimeApp??"")}},[on]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=(we==null?void 0:we.runtimeApp)??"",kn=Ue?bEe(Ue,tt,nt):null;if(lt(kn),yt(""),vt(!1),Ct(!!kn||!y||!Ue),!(!y||!Ue))return hU(Ue,tt,nt,{force:!0}).then(ct=>{de||lt(ct)}).catch(ct=>{!de&&!kn&<(null),de||(vt(ct instanceof co&&ct.unsupported),yt(A("agentWorkspace.errors.loadAgentInfo")))}).finally(()=>{de||Ct(!0)}),()=>{de=!0}},[y,ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeApp,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing";if(qn([]),ea(""),L!=="optimizations"||!Ue){Vi(!1);return}if(y&&!Zi){Vi(!Ot);return}return Vi(!0),aEe({runtimeId:Ue,region:tt,appName:Zi}).then(nt=>{de||qn(nt.groups)}).catch(()=>{de||ea(A("agentWorkspace.errors.loadOptimizations"))}).finally(()=>{de||Vi(!1)}),()=>{de=!0}},[Ot,y,za,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{js(1)},[we==null?void 0:we.runtimeId,Zi]),p.useEffect(()=>{const de=ji.current+1;ji.current=de;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Zi;if(_i(""),L!=="usage"||!Ue){xo(!1);return}if(!nt){xo(y&&!Ot);return}const kn=new AbortController;return xo(!0),oCe({runtimeId:Ue,region:tt,appName:nt,page:Js,pageSize:eqt,signal:kn.signal}).then(ct=>{if(de===ji.current){if(ct.runtimeId!==Ue||ct.appName!==nt||ct.page!==Js){_i(A("agentWorkspace.errors.usageMismatch"));return}Bs({requestKey:Uo,value:ct})}}).catch(()=>{de!==ji.current||kn.signal.aborted||_i(A("agentWorkspace.errors.loadUsage"))}).finally(()=>{de===ji.current&&xo(!1)}),()=>{kn.abort()}},[Js,yi,Uo,Ot,y,L,Zi,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{qr.current+=1,pe(null),se(!1),Le(!1),Ve(""),ye("api-server")},[ia,L]);function Gr(){qr.current+=1,pe(null),se(!1),Le(!1),Ve("")}function Or(de){de!==te&&(Gr(),ye(de))}async function Tr(){if(me){Gr();return}const de=(we==null?void 0:we.runtimeId)??"",Ue=(we==null?void 0:we.region)??"cn-beijing";if(!de)return;const tt=qr.current+1;qr.current=tt,Le(!0),Ve("");try{const nt=await gCe(de,Ue);if(tt!==qr.current)return;pe({requestKey:ia,value:nt}),se(!0)}catch(nt){if(tt!==qr.current)return;pe(null),se(!1),Ve(nt instanceof Error?nt.message:A("agentWorkspace.errors.loadApiKey"))}finally{tt===qr.current&&Le(!1)}}p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue?vCe(Ue,tt):null;if(V(nt),Nt(""),!!Ue)return xU(Ue,tt,{force:!0}).then(kn=>{de||V(kn)}).catch(()=>{!de&&!nt&&V(null),de||Nt(A("agentWorkspace.errors.loadRuntimeDetails"))}),()=>{de=!0}},[ln,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"";if(ke(""),L!=="versions"||!Ue){ge(!1),Ue||Re(null);return}return ge(!0),C_(Ue).then(tt=>{de||Re(tt)}).catch(()=>{de||(Re(null),ke(A("agentWorkspace.errors.loadGithubVersions")))}).finally(()=>{de||ge(!1)}),()=>{de=!0}},[L,we==null?void 0:we.currentVersion,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=`${tt}:${Ue}`;if(Ee(""),L!=="integrations"||!Ue){Z(!1),Ue||ie(null);return}Z(!0);const kn=Vx(Ue,tt,{retryProbe:!0}).catch(ct=>{if(ct instanceof co&&ct.unsupported)return null;throw ct});return Promise.all([kn,mCe(Ue,tt,{retryProbe:!0})]).then(([ct,wi])=>{de||ie({requestKey:nt,apiApps:ct,a2a:wi})}).catch(()=>{de||(ie(null),Ee(A("agentWorkspace.errors.probeIntegration")))}).finally(()=>{de||Z(!1)}),()=>{de=!0}},[Y,L,we==null?void 0:we.currentVersion,we==null?void 0:we.region,we==null?void 0:we.runtimeId]),p.useEffect(()=>{let de=!1;const Ue=(we==null?void 0:we.runtimeId)??"",tt=(we==null?void 0:we.region)??"cn-beijing",nt=Ue&&Zi?lEe({runtimeId:Ue,region:tt,appName:Zi,pageSize:100}):null;if(di(nt?yse(nt,A):[]),mr((nt==null?void 0:nt.sets)??[]),nn(""),re((nt==null?void 0:nt.unsupportedMessage)??""),L!=="evaluations"||!Ue){ze(!1);return}if(y&&!Zi){ze(!Ot);return}return ze(!nt),RI({runtimeId:Ue,region:tt,appName:Zi,pageSize:100},{force:!0}).then(kn=>{de||(mr(kn.sets),di(yse(kn,A)),re(kn.unsupportedMessage??""))}).catch(()=>{de||(nn(A("agentWorkspace.errors.loadEvaluations")),re(""))}).finally(()=>{de||ze(!1)}),()=>{de=!0}},[Ot,y,xi,L,Zi,gi==null?void 0:gi.appName,we==null?void 0:we.region,we==null?void 0:we.runtimeId,A]);async function kr(de){const Ue=(we==null?void 0:we.runtimeId)??"",tt=de.commitSha??"";if(!(!Ue||!tt||Ke)){it(tt),ke("");try{await YEe({runtimeId:Ue,targetCommitSha:tt});const nt=await C_(Ue);Re(nt)}catch(nt){ke(nt instanceof Error?nt.message:A("agentWorkspace.errors.rollbackVersion"))}finally{it("")}}}p.useEffect(()=>{const de=new Set(Fn.map(Ue=>Ue.id));$o(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt}),Qn(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt}),Oo&&!de.has(Oo)&&rs("")},[Fn,Oo]),p.useEffect(()=>{Li(!1),$o(new Set),Qn(new Set),or(""),rs("")},[we==null?void 0:we.runtimeId]),p.useEffect(()=>{const de=new Set(on.filter(Ue=>Ue.canDelete===!0).map(Ue=>Ue.id));Ye(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt})},[on]),p.useEffect(()=>{const de=new Set(xs.map(Ue=>Ue.id));_n(Ue=>{const tt=new Set([...Ue].filter(nt=>de.has(nt)));return tt.size===Ue.size?Ue:tt})},[xs]);const Xr=p.useMemo(()=>!v||!(we!=null&&we.runtimeId)||v.runtimeId!==we.runtimeId||Zi&&v.agentName&&v.agentName!==Zi?null:{...v,tag:A(v.kind==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},[v,we==null?void 0:we.runtimeId,Zi,A]),pl=p.useMemo(()=>YHt(A),[A]),to=p.useMemo(()=>we!=null&&we.runtimeId?Xr?[Xr,...Fn.filter(de=>de.id!==Xr.id&&(!de.messageId||de.messageId!==Xr.messageId))]:Fn:pl,[pl,Fn,Xr,we==null?void 0:we.runtimeId]),Ar=to.filter(de=>{if(de.kind!==gt||(de.source==="auto"?"auto":"user")!==Ht)return!1;const tt=xt.trim().toLowerCase();return tt?[de.input,de.output,de.referenceOutput,de.comment,de.tag??"",de.sessionId,de.messageId,de.userId,de.evaluationSetName].join(" ").toLowerCase().includes(tt):!0}),ws=Ar.filter(de=>ul.has(de.id)),no=!!(we!=null&&we.runtimeId),Hd=de=>{st(de),ft(""),or("");const Ue=to.find(tt=>tt.kind===de);rs((Ue==null?void 0:Ue.id)??""),window.setTimeout(()=>{var tt;(tt=ss.current)==null||tt.scrollIntoView({behavior:"smooth",block:"start"})},0)},Fg=de=>{or(""),$o(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt})},d0=()=>{or(""),$o(new Set(Ar.map(de=>de.id)))},f0=()=>{or(""),$o(new Set),Li(!1)},h0=de=>{Qn(Ue=>{const tt=new Set(Ue);return tt.has(de)?tt.delete(de):tt.add(de),tt})},p0=de=>{rs(de.id),or(""),!(!de.sessionId||!de.messageId)&&(R==null||R(de))},Bg=async de=>{if(!(we!=null&&we.runtimeId)||!Zi||Ns||de.length===0)return;const Ue=de.length===1?A("agentWorkspace.deleteOneCaseConfirm"):A("agentWorkspace.deleteCasesConfirm",{count:de.length});if(!window.confirm(Ue))return;const tt=de.map(kn=>kn.id),nt=new Set(tt);gc(!0),or("");try{await dEe({runtimeId:we.runtimeId,region:we.region??"cn-beijing",appName:Zi,itemIds:tt});const kn=new Map;for(const ct of de)kn.set(ct.kind,(kn.get(ct.kind)??0)+1);di(ct=>ct.filter(wi=>!nt.has(wi.id))),mr(ct=>ct.map(wi=>({...wi,itemCount:Math.max(0,wi.itemCount-(kn.get(wi.kind)??0))}))),$o(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Qn(ct=>new Set([...ct].filter(wi=>!nt.has(wi)))),Oo&&nt.has(Oo)&&rs(""),de.length>1&&Li(!1),_==null||_(de)}catch(kn){or(kn instanceof Error?kn.message:String(kn))}finally{gc(!1)}},$i=de=>{eo(Ue=>Ue.map(tt=>tt.id===de.id?de:tt))},yc=()=>{const de=new Set(e.map(nt=>nt.id)),Ue=n.filter(nt=>de.has(nt)),tt=new Set(Ue);return[...Ue,...e.filter(nt=>!tt.has(nt.id)).map(nt=>nt.id)]},Ug=(de,Ue,tt)=>{if(!O||de===Ue)return;const nt=yc().filter(wi=>wi!==de),kn=nt.indexOf(Ue),ct=kn<0?nt.length:tt==="after"?kn+1:kn;nt.splice(ct,0,de),O(nt)},Yf=(de,Ue)=>{if(!hn||hn===Ue)return;const tt=de.currentTarget.getBoundingClientRect();St(Ue),Rt(de.clientY>tt.top+tt.height/2?"after":"before")},Rp=(de,Ue)=>{if(!O)return;const tt=yc(),nt=tt.indexOf(de),kn=Math.max(0,Math.min(tt.length-1,nt+Ue));nt<0||nt===kn||(tt.splice(nt,1),tt.splice(kn,0,de),O(tt))},Ip=de=>{de.canDelete===!0&&(Hn(""),Ye(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt}))},Zf=de=>{Hn(""),_n(Ue=>{const tt=new Set(Ue);return tt.has(de.id)?tt.delete(de.id):tt.add(de.id),tt})},qd=()=>{Hn(""),Ye(new Set(ae.map(de=>de.id))),_n(new Set(xs.map(de=>de.id)))},rd=()=>{Hn(""),Ye(new Set),_n(new Set),ot(!1)},Qg=()=>{if(Yt===0||Vt)return;const de=Pe.length,Ue=et.length;Hn(""),vi({kind:"selection",title:A(de===1&&Ue===0?"agentWorkspace.deleteAgentTitle":de===0&&Ue===1?"myAgents.deleteDraftTitle":"agentWorkspace.deleteSelectedTitle"),description:de===1&&Ue===0?A("agentWorkspace.deleteAgentDescription",{name:Pe[0].label}):de===0&&Ue===1?A("agentWorkspace.deleteDraftDescription",{name:et[0].draft.name||A("agentSelector.unnamedAgent")}):A("agentWorkspace.deleteSelectionDescription",{count:Yt,warning:de>0?A("agentWorkspace.runtimeDeletionWarning",{count:de}):A("agentWorkspace.draftDeletionWarning")}),confirmLabel:A(de===0&&Ue===1?"myAgents.deleteDraft":"agentWorkspace.deleteSelected"),agents:Pe,drafts:et})},zg=async()=>{if(!(!En||Vt)){Ai(!0),Hn("");try{if(En.kind==="selection"){const{agents:de,drafts:Ue}=En;if(de.length>0){if(!S)throw new Error(A("agentWorkspace.errors.deleteDeployedUnsupported"));await S(de)}Ue.length>0&&(k==null||k(Ue)),Ye(new Set),_n(new Set),ot(!1),de.some(tt=>tt.id===I)&&H(""),Ue.some(tt=>tt.id===K)&&F("")}else if(En.kind==="agent"){if(!S)throw new Error(A("agentWorkspace.errors.deleteDeployedUnsupported"));await S([En.agent]),I===En.agent.id&&H("")}else{if(!k)throw new Error(A("agentWorkspace.errors.deleteDraftUnsupported"));k([En.draft]),K===En.draft.id&&F("")}vi(null)}catch(de){Hn(de instanceof Error?de.message:String(de))}finally{Ai(!1)}}},Ft=de=>{!S||de.canDelete!==!0||Vt||(Hn(""),vi({kind:"agent",title:A("agentWorkspace.deleteAgentTitle"),description:A("agentWorkspace.deleteAgentDescription",{name:de.label}),confirmLabel:A("agentWorkspace.deleteAgent"),agent:de}))},_r=de=>{if(!k||Vt)return;const Ue=de.draft.name||A("agentSelector.unnamedAgent");Hn(""),vi({kind:"draft",title:A("myAgents.deleteDraftTitle"),description:A("agentWorkspace.deleteDraftDescription",{name:Ue}),confirmLabel:A("myAgents.deleteDraft"),draft:de})},sd=()=>{const de=`eval-${Date.now()}`,Ue={id:de,name:A("agentWorkspace.newEvaluationGroupName",{count:Fo.length+1}),agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};eo(tt=>[Ue,...tt]),dl(de)},m0=de=>{$i({...de,history:[{id:`run-${Date.now()}`,createdAt:A("agentWorkspace.evaluationDefaults.justNow"),score:86+de.history.length%7,status:"completed"},...de.history]})};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[a.jsxs("nav",{className:"aw-view-tabs","aria-label":A("agentWorkspace.workspace"),children:[a.jsx("button",{type:"button",className:D==="library"?"is-active":"","aria-pressed":D==="library",onClick:()=>{M("library"),We("")},children:A("agentWorkspace.library")}),a.jsx("button",{type:"button",className:D==="evaluation"?"is-active":"","aria-pressed":D==="evaluation",onClick:()=>{M("evaluation"),We("")},children:A("agentWorkspace.evaluation")})]}),a.jsxs("div",{className:"aw-workspace-frame",children:[a.jsxs("div",{className:"aw-workspace","aria-hidden":D==="evaluation"||void 0,ref:de=>{de==null||de.toggleAttribute("inert",D==="evaluation")},children:[a.jsxs("aside",{className:"aw-sidebar","aria-label":A(D==="library"?"agentWorkspace.agentList":"agentWorkspace.evaluationGroupList"),children:[a.jsxs("label",{className:"aw-search",children:[a.jsx(vN,{"aria-hidden":!0}),a.jsx("input",{value:Me,onChange:de=>We(de.currentTarget.value),placeholder:A(D==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups"),"aria-label":A(D==="library"?"myAgents.searchAgents":"agentWorkspace.searchEvaluationGroups")})]}),a.jsxs("button",{type:"button",className:"aw-create-card",onClick:D==="library"?j:sd,disabled:D==="library"&&!o,children:[a.jsx(Tl,{"aria-hidden":!0}),a.jsx("span",{children:A(D==="library"?"agentWorkspace.newAgent":"agentWorkspace.newEvaluationGroup")})]}),D==="library"&&(S||k)&&a.jsx("div",{className:`aw-selection-toolbar${$e?" is-active":""}`,children:$e?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-selection-count",children:A("agentWorkspace.selectedCount",{count:Yt})}),a.jsx("button",{type:"button",onClick:qd,disabled:ht===0||Vt,children:A("agentWorkspace.selectAll")}),a.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Qg(),disabled:Yt===0||Vt,children:A(Vt?"common.deleting":"agentWorkspace.deleteSelected")}),a.jsx("button",{type:"button",onClick:rd,disabled:Vt,children:A("common.cancel")})]}):a.jsx("button",{type:"button",onClick:()=>{Hn(""),ot(!0)},disabled:ht===0,children:A("common.select")})}),D==="library"&&jn&&a.jsx("div",{className:"aw-delete-error",role:"alert",children:jn}),a.jsx("div",{className:"aw-agent-list",children:D==="evaluation"?mu.length===0?a.jsx("div",{className:"aw-list-empty",children:A("agentWorkspace.noMatchingEvaluationGroups")}):mu.map(de=>a.jsxs("button",{type:"button",className:`aw-agent-item${de.id===pu?" is-active":""}`,onClick:()=>dl(de.id),children:[a.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[a.jsx("strong",{children:ok(de.name,A)}),a.jsx("small",{children:A("agentWorkspace.groupStats",{agents:de.agentIds.length,runs:de.history.length})})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)):u&&on.length===0&&xs.length===0?a.jsx("div",{className:"aw-list-empty",children:A("agentWorkspace.loadingCloudAgents")}):d&&on.length===0&&xs.length===0?a.jsxs("div",{className:"aw-list-empty aw-list-error",children:[a.jsx("span",{children:d}),w&&a.jsx("button",{type:"button",onClick:w,children:A("common.retry")})]}):on.length===0&&xs.length===0?a.jsx("div",{className:"aw-list-empty",children:A("myAgents.noMatchingAgents")}):a.jsxs(a.Fragment,{children:[xs.map(de=>{const tt=f.filter(kn=>kn.draftId===de.id).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0]??f.filter(kn=>{var ct,wi;return((ct=kn.agentDraft)==null?void 0:ct.name)===de.draft.name||kn.agentName===de.draft.name||!!((wi=de.deploymentTarget)!=null&&wi.runtimeId)&&kn.runtimeId===de.deploymentTarget.runtimeId}).sort((kn,ct)=>ct.startedAt-kn.startedAt)[0],nt=mt.has(de.id);return a.jsxs("button",{type:"button",className:["aw-agent-item",$e?"is-selecting":"",nt?"is-selected-for-delete":"",de.id===K?"is-active":""].filter(Boolean).join(" "),"aria-pressed":$e?nt:void 0,onClick:()=>{if($e){Zf(de);return}H(""),F(de.id),U("basic")},children:[$e&&a.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),a.jsxs("span",{className:"aw-agent-copy",children:[a.jsxs("span",{className:"aw-agent-name-row",children:[a.jsx("strong",{children:de.draft.name||A("agentSelector.unnamedAgent")}),a.jsx("span",{className:`aw-draft-badge${(tt==null?void 0:tt.status)==="running"?" is-deploying":""}`,children:(tt==null?void 0:tt.status)==="running"?A("myAgents.deploying"):A("myAgents.draft")})]}),a.jsx("small",{children:de.deploymentTarget?A("agentWorkspace.updatePending"):A("agentWorkspace.notPublished")})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)}),on.map(de=>{const Ue=de.runtimeId?Wr.get(de.runtimeId):void 0,tt=de.runtimeId?Bo.get(de.runtimeId):void 0,nt=vn.has(de.id),kn=de.canDelete===!0,ct=(Ue==null?void 0:Ue.status)==="running"?{label:A("myAgents.deploying"),className:" is-deploying"}:(Ue==null?void 0:Ue.status)==="error"?{label:A("agentWorkspace.failed"),className:" is-error"}:(Ue==null?void 0:Ue.status)==="cancelled"?{label:A("agentWorkspace.cancelled"),className:" is-muted"}:tt?{label:A("agentWorkspace.updatePending"),className:""}:null,wi=(Ue==null?void 0:Ue.status)==="running"?A("agentWorkspace.updatingDeployment"):tt?A("agentWorkspace.updatePending"):de.remote?de.host||A("agentWorkspace.remoteAgent"):A("agentWorkspace.localAgent"),io=["aw-agent-item","aw-agent-item--sortable",de.id===I?"is-active":"",$e?"is-selecting":"",nt?"is-selected-for-delete":"",$e&&!kn?"is-selection-disabled":"",de.id===hn?"is-dragging":"",de.id===bt&&de.id!==hn?`is-drop-target is-drop-${dn}`:""].filter(Boolean).join(" ");return a.jsxs("button",{type:"button",draggable:!!O&&!$e,className:io,"aria-pressed":$e?nt:void 0,"aria-keyshortcuts":O?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Oi=>{O&&(Qs.current=!0,Ge(de.id),Oi.dataTransfer.effectAllowed="move",Oi.dataTransfer.setData("text/plain",de.id))},onDragEnter:Oi=>{Yf(Oi,de.id)},onDragOver:Oi=>{!hn||hn===de.id||(Oi.preventDefault(),Oi.dataTransfer.dropEffect="move",Yf(Oi,de.id))},onDragLeave:Oi=>{const Vs=Oi.relatedTarget;Vs instanceof Node&&Oi.currentTarget.contains(Vs)||bt===de.id&&St("")},onDrop:Oi=>{Oi.preventDefault();const Vs=Oi.dataTransfer.getData("text/plain")||hn;Ug(Vs,de.id,dn),Ge(""),St(""),Rt("before")},onDragEnd:()=>{Ge(""),St(""),Rt("before"),window.setTimeout(()=>{Qs.current=!1},0)},onKeyDown:Oi=>{Oi.altKey&&(Oi.key==="ArrowUp"?(Oi.preventDefault(),Rp(de.id,-1)):Oi.key==="ArrowDown"&&(Oi.preventDefault(),Rp(de.id,1)))},onClick:Oi=>{if($e){Oi.preventDefault(),Ip(de);return}if(Qs.current){Oi.preventDefault(),Qs.current=!1;return}F(""),H(de.id),U("basic"),C(de.id)},children:[$e&&a.jsx("span",{className:`aw-select-marker${nt?" is-checked":""}`,"aria-hidden":"true"}),a.jsxs("span",{className:"aw-agent-copy",children:[a.jsxs("span",{className:"aw-agent-name-row",children:[a.jsx("strong",{children:de.label}),de.currentVersion!=null&&a.jsxs("span",{className:"aw-version-badge",children:["v",de.currentVersion]}),ct&&a.jsx("span",{className:`aw-draft-badge${ct.className}`,children:ct.label})]}),a.jsx("small",{children:wi})]}),a.jsx(Lk,{"aria-hidden":!0})]},de.id)})]})}),a.jsx("div",{className:"aw-list-count",children:A("agentWorkspace.totalCount",{count:D==="library"?e.length+bc:Fo.length})})]}),D==="evaluation"&&On?a.jsx(Eqt,{group:On,agents:e,cases:to,onChange:$i,onRun:m0}):D==="evaluation"?a.jsx("main",{className:"aw-main aw-empty-selection",children:a.jsx("p",{children:A("agentWorkspace.noEvaluationGroupSelected")})}):!we&&!ai&&!Yi?a.jsx("main",{className:"aw-main aw-empty-selection",children:a.jsx("p",{children:A("agentWorkspace.noAgentSelected")})}):a.jsxs("main",{className:`aw-main${ee?" is-deploying":""}${y?" resource-page":""}`,children:[we&&!gi&&s&&a.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"aw-detail-loading-card",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsxs("span",{children:[a.jsx("strong",{children:A("agentWorkspace.loadingAgent")}),a.jsx("small",{children:A("agentWorkspace.loadingAgentDescription")})]})]})}),L==="integrations"&&Q&&a.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"aw-detail-loading-card",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsxs("span",{children:[a.jsx("strong",{children:A("agentWorkspace.probingIntegration")}),a.jsx("small",{children:A("agentWorkspace.probingIntegrationDescription")})]})]})}),a.jsx(LC,{className:"aw-agent-detail",title:bn,description:un.description||A(s||y&&!Ot?"agentWorkspace.loadingAgentInfo":"common.noDescription"),identitySeed:bn,backLabel:A("agentWorkspace.backToAgentList"),onBack:y?x:void 0,meta:a.jsxs(a.Fragment,{children:[qt!=null&&a.jsxs("span",{className:"aw-agent-meta",children:["v",qt]}),ai&&a.jsx("span",{className:"aw-agent-meta",children:A("myAgents.draft")}),na&&a.jsx("span",{className:"aw-agent-meta",children:A("agentWorkspace.updatePending")}),!we&&!ai&&Yi&&a.jsx("span",{className:"aw-agent-meta",children:Yi.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:ai||na||we!=null&&we.canDelete?a.jsxs(a.Fragment,{children:[(ai||na)&&a.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const de=ai??na;de&&_r(de)},disabled:Vt,"aria-label":A("myAgents.deleteDraft"),title:A("myAgents.deleteDraft"),children:[a.jsx(rg,{"aria-hidden":!0}),a.jsx("span",{children:A("myAgents.deleteDraft")})]}),(we==null?void 0:we.canDelete)&&a.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void Ft(we),disabled:Vt,"aria-label":A("agentWorkspace.deleteAgent"),title:A("agentWorkspace.deleteAgent"),children:[a.jsx(rg,{"aria-hidden":!0}),a.jsx("span",{children:A(Vt?"common.deleting":"agentWorkspace.deleteAgent")})]})]}):void 0,sections:Ha.map(de=>{var Ue,tt,nt,kn;return{key:de.id,label:de.label,disabled:ee,content:de.id===L?a.jsxs(a.Fragment,{children:[qi&&fi&&a.jsx("div",{className:`aw-detail-deployment${ee?" is-running":""}`,children:a.jsx(xqt,{task:qi,onReturnToEdit:Fe&&N?()=>N(Fe):void 0})}),a.jsxs("div",{className:"aw-content",children:[L==="basic"&&a.jsxs("div",{className:"aw-basic-stack",children:[Ie&&a.jsx(Oy,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:A("agentWorkspace.partialInfoUnavailable"),description:A("agentWorkspace.upgradeRuntimeForDetails")}),(dt&&!Ie||jt)&&a.jsx(Oy,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:A("agentWorkspace.detailLoadFailed"),description:A("agentWorkspace.detailLoadFailedDescription"),actions:a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>He(ct=>ct+1),children:A("common.retry")})}),we&&Je&&!Je.canUpdate&&a.jsxs("div",{className:"aw-update-recovery-notice",role:Je.recoveryStatus==="preparing"?"status":"alert",children:[a.jsx("strong",{children:Je.recoveryStatus==="preparing"?A("agentWorkspace.restoringUpdateConfig"):A("agentWorkspace.updateConfigUnavailable")}),Mt&&a.jsx("span",{children:Mt}),Tn.map(ct=>a.jsx("span",{children:ct},ct))]}),a.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:A("agentWorkspace.deploymentConfig")}),a.jsx("p",{children:A("agentWorkspace.deploymentConfigDescription")})]})}),a.jsxs("dl",{className:"aw-readonly-config",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.runtimeStatus")}),a.jsxs("dd",{className:(W==null?void 0:W.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(W==null?void 0:W.status.toLowerCase())==="ready"&&a.jsx("span",{className:"aw-status-dot"}),(W==null?void 0:W.status)||A("agentWorkspace.loading")]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.deploymentRegion")}),a.jsx("dd",{children:(W==null?void 0:W.region)||(we==null?void 0:we.region)||(qi==null?void 0:qi.region)||A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.networkAccess")}),a.jsx("dd",{children:W!=null&&W.networkTypes.length?W.networkTypes.join(" / "):A("agentWorkspace.notAvailable")})]})]})]}),a.jsxs("section",{className:"aw-canvas-card",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:A("agentWorkspace.executionFlow")})}),a.jsx("div",{className:"aw-canvas",children:a.jsx(rE,{draft:un,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Zn)})]}),a.jsxs("section",{className:"aw-details-card",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:A("agentWorkspace.details")})}),a.jsxs("dl",{className:"aw-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.model")}),a.jsx("dd",{children:gz(gi==null?void 0:gi.model)||un.modelName||A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.agentCountLabel")}),a.jsx("dd",{children:gi!=null&&gi.graph?E6e(gi.graph):C6e(un)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.tools")}),a.jsx("dd",{className:"aw-fact-badges",children:Xf.length?Xf.map(ct=>a.jsx("span",{children:ct},ct)):A("agentWorkspace.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.skills")}),a.jsx("dd",{className:"aw-fact-badges",children:Hi===null?A("agentSelector.previewUnsupported"):Hi.length?Hi.map(ct=>a.jsx("span",{children:ct},ct)):A("agentWorkspace.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("systemInfo.currentVersion")}),a.jsx("dd",{children:qt!=null?`v${qt}`:A("agentWorkspace.notAvailable")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentSelector.status")}),a.jsx("dd",{children:ai?A("myAgents.draft"):(qi==null?void 0:qi.status)==="error"?A("agentWorkspace.deploymentFailed"):(qi==null?void 0:qi.status)==="cancelled"?A("agentWorkspace.cancelled"):na?A("agentWorkspace.updatePending"):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-status-dot"}),A("skillCenter.status.available")]})})]})]})]}),a.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":A("agentWorkspace.selectedOptimizations"),children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:A("agentWorkspace.selectedOptimizations")}),a.jsx("p",{children:A("agentWorkspace.selectedOptimizationsDescription")})]})}),a.jsxs("dl",{className:"aw-readonly-config",children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.configurationStatus")}),a.jsx("dd",{className:Kr!=null&&Kr.enabled?"is-ready":void 0,children:Kr?Kr.enabled?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-status-dot"}),A("skillCenter.status.enabled")]}):A("skillCenter.status.inactive"):A("agentWorkspace.notRecorded")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.optimizationProfile")}),a.jsx("dd",{children:Kr?Ivt(Kr.profile):A("agentWorkspace.legacyConfigMissing")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.selectedOptimizations")}),a.jsx("dd",{className:"aw-fact-badges",children:Kr?zo.length?zo.map(ct=>a.jsx("span",{children:z_(ct)},ct)):A("agentWorkspace.noneSelected"):A("agentWorkspace.legacyConfigMissing")})]})]})]})]}),L==="usage"&&(we==null?void 0:we.runtimeId)&&a.jsxs("section",{className:"aw-usage","aria-busy":Us,children:[a.jsx("div",{className:"aw-usage-intro",children:a.jsx("h3",{children:A("agentWorkspace.usageOverview")})}),Us&&!os&&a.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:A("agentWorkspace.loadingUsage")})}),Oa&&a.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[a.jsx("span",{children:Oa}),a.jsx("button",{type:"button",onClick:()=>Ll(ct=>ct+1),children:A("common.retry")})]}),!Us&&!Oa&&!os&&!Zi&&a.jsx("div",{className:"aw-usage-state",children:A("agentWorkspace.usageUnavailable")}),os&&a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"aw-usage-summary","aria-label":A("agentWorkspace.usageSummary"),children:[a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.totalCalls")}),a.jsx("dd",{children:os.totalInvocations.toLocaleString(P.resolvedLanguage??P.language)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:A("agentWorkspace.userCount")}),a.jsx("dd",{children:os.totalUsers.toLocaleString(P.resolvedLanguage??P.language)})]})]}),a.jsxs("div",{className:"aw-usage-users-head",children:[a.jsx("h3",{children:A("agentWorkspace.userDetails")}),Us&&a.jsx(yn,{as:"span",role:"status","aria-live":"polite",children:A("agentWorkspace.refreshing")})]}),os.users.length===0?a.jsx("div",{className:"aw-usage-state",children:A("agentWorkspace.noUsage")}):a.jsx("div",{className:"aw-usage-table-wrap",children:a.jsxs("table",{className:"aw-usage-table",children:[a.jsx("caption",{children:A("agentWorkspace.usageUserList")}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:A("agentWorkspace.user")}),a.jsx("th",{scope:"col",children:A("agentWorkspace.callCount")}),a.jsx("th",{scope:"col",children:A("agentWorkspace.lastUsed")})]})}),a.jsx("tbody",{children:os.users.map(ct=>a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:ct.displayName||ct.userId||A("agentWorkspace.unknownUser")}),ct.displayName&&ct.userId&&a.jsx("small",{title:ct.userId,children:ct.userId})]}),a.jsx("td",{children:ct.invocationCount.toLocaleString(P.resolvedLanguage??P.language)}),a.jsx("td",{children:a.jsx("time",{dateTime:ct.lastUsedAt,children:tqt(ct.lastUsedAt,P.resolvedLanguage??P.language,A)})})]},ct.userId))})]})}),os.totalPages>1&&a.jsxs("nav",{className:"aw-usage-pagination","aria-label":A("agentWorkspace.usagePagination"),children:[a.jsx("button",{type:"button",disabled:Us||os.page<=1,onClick:()=>js(ct=>Math.max(1,ct-1)),children:A("common.previousPage")}),a.jsx("span",{"aria-live":"polite",children:A("agentWorkspace.pageOf",{page:os.page,total:os.totalPages})}),a.jsx("button",{type:"button",disabled:Us||os.page>=os.totalPages,onClick:()=>js(ct=>ct+1),children:A("common.nextPage")})]})]})]}),L==="versions"&&a.jsxs("section",{className:"aw-version-stack",children:[a.jsxs("div",{className:"aw-integration-intro",children:[a.jsx("h3",{children:A("agentWorkspace.githubVersions")}),a.jsx("p",{children:(Ue=ve==null?void 0:ve.cicd)!=null&&Ue.enabled?A("agentWorkspace.githubVersionsDescription"):A("agentWorkspace.currentVersionOnly")})]}),ne&&a.jsx("div",{className:"aw-case-empty",children:A("agentWorkspace.loadingVersions")}),Ce&&a.jsxs("div",{className:"aw-integration-error",role:"alert",children:[a.jsx("span",{children:Ce}),(we==null?void 0:we.runtimeId)&&a.jsx("button",{type:"button",onClick:()=>void C_(we.runtimeId??"").then(Re),children:A("common.retry")})]}),!ne&&!Ce&&a.jsxs("div",{className:"aw-version-list",children:[(ve==null?void 0:ve.githubSyncError)&&a.jsx("div",{className:"aw-integration-error",role:"alert",children:a.jsx("span",{children:ve.githubSyncError})}),(ve==null?void 0:ve.latestSourceRuntimeStatus)&&ve.latestSourceRuntimeStatus!=="published"&&((tt=ve.versions[0])==null?void 0:tt.commitSha)&&ve.versions[0].commitSha!==ve.currentCommitSha&&a.jsx("div",{className:"aw-integration-notice",role:"status",children:a.jsxs("span",{children:[A("agentWorkspace.sourceMergedRuntimeStill"),mse(ve.latestSourceRuntimeStatus,A),A("agentWorkspace.currentProductionVersionHint")]})}),ve!=null&&ve.versions.length?ve.versions.map(ct=>{var ml;const wi=ct.commitSha??"",io=ct.runtimeStatus??ct.status,Oi=ct.changeType==="rollback",Vs=!!((ml=ve.cicd)!=null&&ml.enabled)&&!!wi&&!Oi&&wi!==ve.currentCommitSha;return a.jsxs("article",{className:"aw-version-row",children:[a.jsxs("div",{children:[a.jsx("strong",{children:iqt(ct,A)}),a.jsx("small",{children:ct.createdAt||A("agentWorkspace.noTime")})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.prLink")}),ct.pullRequestUrl?a.jsx("a",{href:ct.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:A("agentWorkspace.viewPr")}):a.jsx("em",{children:A("agentWorkspace.noPr")})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.author")}),a.jsx("em",{children:ct.author||"Studio"})]}),a.jsxs("div",{children:[a.jsx("span",{children:A("agentWorkspace.publishStatus")}),a.jsx("em",{children:mse(io,A)})]}),a.jsxs("div",{className:"aw-version-actions",children:[a.jsx("button",{type:"button",disabled:!Vs||Ke===wi,onClick:()=>void kr(ct),children:A(Ke===wi?"agentWorkspace.rollingBack":"agentWorkspace.rollbackToVersion")}),ct.workflowRunUrl&&a.jsx("a",{href:ct.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:A("agentWorkspace.viewRelease")})]})]},`${ct.version}-${wi||ct.createdAt}`)}):a.jsxs("article",{className:"aw-version-row",children:[a.jsxs("div",{children:[a.jsx("strong",{children:qt!=null?`v${qt}`:A("agentWorkspace.noVersion")}),a.jsx("small",{children:(W==null?void 0:W.updatedAt)||A("agentWorkspace.noTime")})]}),a.jsx("p",{children:A("agentWorkspace.currentVersionOnly")})]})]})]}),L==="integrations"&&a.jsxs("div",{className:"aw-integration-stack",children:[a.jsxs("div",{className:"aw-integration-intro",children:[a.jsx("h3",{children:A("agentWorkspace.integrationMethods")}),a.jsx("p",{children:A("agentWorkspace.integrationDescription")})]}),ce&&a.jsxs("div",{className:"aw-integration-error",role:"alert",children:[a.jsx("span",{children:ce}),a.jsx("button",{type:"button",onClick:()=>G(ct=>ct+1),children:A("common.retry")})]}),!ce&&a.jsxs("div",{className:"aw-integration-body",children:[a.jsxs("div",{className:`aw-integration-protocol-tabs${te==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":A("agentWorkspace.integrationProtocol"),children:[a.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),wO.map((ct,wi)=>a.jsx("button",{type:"button",id:`integration-${ct.id}-tab`,role:"tab","aria-selected":te===ct.id,"aria-controls":`integration-${ct.id}-panel`,tabIndex:te===ct.id?0:-1,onClick:()=>Or(ct.id),onKeyDown:io=>{var ml;if(!["ArrowLeft","ArrowRight","Home","End"].includes(io.key))return;io.preventDefault();const Oi=io.key==="Home"?0:io.key==="End"?wO.length-1:(wi+(io.key==="ArrowRight"?1:-1)+wO.length)%wO.length,Vs=wO[Oi];Or(Vs.id),(ml=document.getElementById(`integration-${Vs.id}-tab`))==null||ml.focus()},children:ct.label},ct.id))]}),te==="api-server"?a.jsx(bse,{protocol:"api-server",title:"API Server",available:Qo,fields:[{label:"Agent",value:Qo?((nt=gr==null?void 0:gr.apiApps)==null?void 0:nt.join("、"))??"":""},{label:A("agentWorkspace.discoveryEndpoint"),value:Qo?a4(Mn,"/list-apps"):""},{label:A("agentWorkspace.invocationEndpoint"),value:Qo?a4(Mn,"/run_sse"):""},{label:A("agentWorkspace.authentication"),value:Qo?pse(W==null?void 0:W.authType,A):""},{label:"API Key",value:a.jsx(gse,{available:Qo,authType:W==null?void 0:W.authType,value:$l,visible:me&&!!$l,loading:Se,error:be,onToggle:()=>void Tr()})}],example:Qo?rqt(Mn,ra,W==null?void 0:W.authType):""}):a.jsx(bse,{protocol:"a2a",title:"A2A",available:qa,fields:[{label:"Agent",value:((kn=gr==null?void 0:gr.a2a)==null?void 0:kn.name)??""},{label:"Agent Card",value:qa?a4(Mn,"/.well-known/agent-card.json"):""},{label:A("agentWorkspace.invocationUrl"),value:Wa},{label:A("agentWorkspace.authentication"),value:qa?pse(W==null?void 0:W.authType,A):""},{label:"API Key",value:a.jsx(gse,{available:qa,authType:W==null?void 0:W.authType,value:$l,visible:me&&!!$l,loading:Se,error:be,onToggle:()=>void Tr()})}],example:qa?sqt(Wa,W==null?void 0:W.authType):""})]})]}),L==="evaluations"&&a.jsxs("section",{className:"aw-cases",children:[(we==null?void 0:we.runtimeId)&&a.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(ct=>{const wi=hqt(wr,ct),io=to.filter(Vs=>Vs.kind===ct).length,Oi=Xr?io:(wi==null?void 0:wi.itemCount)??io;return a.jsxs("button",{type:"button",onClick:()=>Hd(ct),children:[a.jsx("strong",{children:Oi}),a.jsx("span",{children:A(ct==="good"?"agentWorkspace.goodCases":"agentWorkspace.badCases")})]},ct)})}),a.jsxs("div",{className:"aw-case-filter-bar",children:[a.jsxs("div",{className:"aw-case-filter-stack",children:[a.jsx("div",{className:"aw-case-filters","aria-label":A("agentWorkspace.caseResultFilter"),children:["good","bad"].map(ct=>a.jsx("button",{type:"button",className:gt===ct?"is-active":"","aria-pressed":gt===ct,onClick:()=>st(ct),children:A(ct==="good"?"agentWorkspace.goodCase":"agentWorkspace.badCase")},ct))}),a.jsx("div",{className:"aw-case-source-filters","aria-label":A("agentWorkspace.feedbackSourceFilter"),children:["auto","user"].map(ct=>a.jsx("button",{type:"button",className:Ht===ct?"is-active":"","aria-pressed":Ht===ct,onClick:()=>cn(ct),children:A(ct==="auto"?"agentWorkspace.automaticFeedback":"agentWorkspace.manualFeedback")},ct))})]}),a.jsxs("label",{className:"aw-case-search",children:[a.jsx(vN,{"aria-hidden":!0}),a.jsx("input",{type:"search",value:xt,onChange:ct=>ft(ct.currentTarget.value),placeholder:A("agentWorkspace.searchCasesPlaceholder"),"aria-label":A("agentWorkspace.searchCases")})]})]}),no&&a.jsx("div",{className:`aw-case-toolbar${wo?" is-active":""}`,children:wo?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"aw-selection-count",children:A("agentWorkspace.selectedCaseCount",{count:ws.length})}),a.jsx("button",{type:"button",onClick:d0,disabled:Ar.length===0||Ns,children:A("agentWorkspace.selectAllVisible")}),a.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Bg(ws),disabled:ws.length===0||Ns,children:A(Ns?"common.deleting":"agentWorkspace.deleteSelected")}),a.jsx("button",{type:"button",onClick:f0,disabled:Ns,children:A("common.cancel")})]}):a.jsx("button",{type:"button",onClick:()=>{or(""),Li(!0)},disabled:Ar.length===0||Ns,children:A("agentWorkspace.selectCases")})}),ta&&a.jsx("div",{className:"aw-delete-error",role:"alert",children:ta}),a.jsx("div",{ref:ss,children:a.jsx(Sqt,{cases:Ar,loading:ir&&Ar.length===0,error:kt,notice:Nn,runtimeBacked:!!(we!=null&&we.runtimeId),selectionMode:wo,selectedCaseIds:ul,focusedCaseId:Oo,expandedCaseIds:Va,deleting:Ns,canDelete:no,onOpenCase:p0,onToggleCase:Fg,onToggleExpanded:h0,onDeleteCase:ct=>void Bg([ct]),onRetry:()=>is(ct=>ct+1)})})]}),L==="optimizations"&&a.jsxs("section",{className:"aw-optimizations",children:[a.jsxs("div",{className:"aw-optimization-intro",children:[a.jsx("h3",{children:A("agentWorkspace.optimizations")}),a.jsx("p",{children:A("agentWorkspace.optimizationsDescription")})]}),oi?a.jsxs("div",{className:"aw-optimization-state",role:"status",children:[a.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),a.jsx("span",{children:A("agentWorkspace.loadingOptimizations")})]}):Fr?a.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[a.jsx("span",{children:Fr}),a.jsx("button",{type:"button",onClick:()=>Hr(ct=>ct+1),children:A("common.retry")})]}):$r.length>0?a.jsx(Oqt,{groups:$r}):a.jsx("div",{className:"aw-optimization-state",children:A("agentWorkspace.noOptimizations")})]})]}),L==="basic"&&(we||ai)&&a.jsxs("div",{className:"aw-basic-actions",children:[we&&a.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>E==null?void 0:E(we),children:[a.jsx(dit,{"aria-hidden":!0}),a.jsx("span",{children:A("agentWorkspace.chat")})]}),a.jsxs("span",{className:`aw-update-wrap${fl?" is-disabled":""}`,tabIndex:fl?0:void 0,"aria-describedby":fl?hl:void 0,children:[a.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!fl,"aria-busy":Te||void 0,"aria-describedby":fl?hl:void 0,onClick:()=>ai?N==null?void 0:N(ai):Je?T(Je):void 0,children:Te?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),a.jsx("span",{children:A("agentWorkspace.preparing")})]}):A(ai||na?"agentWorkspace.continueEditing":"agentWorkspace.update")}),fl&&a.jsx("span",{id:hl,className:"aw-update-disabled-reason",role:"tooltip",children:fl})]})]})]}):null}}),activeSectionKey:L,navigationLabel:A("agentWorkspace.agentDetails"),onSectionChange:U})]})]}),D==="evaluation"&&a.jsx("div",{className:"aw-evaluation-glass",role:"status",children:a.jsx("span",{children:A("agentWorkspace.comingSoon")})})]})]}),En&&a.jsx(Gu,{variant:"danger",title:En.title,description:En.description,confirmLabel:Vt?A("common.deleting"):En.confirmLabel,closeLabel:A("agentWorkspace.closeDeleteConfirmation"),busy:Vt,onCancel:()=>vi(null),onConfirm:()=>void zg()})]})}function Oqt({groups:e}){const{t}=Ae("ui");return a.jsx("div",{className:"aw-optimization-table-wrap",children:a.jsxs("table",{className:"aw-optimization-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:t("agentWorkspace.fixPriority")}),a.jsx("th",{scope:"col",children:t("agentWorkspace.suggestedModule")}),a.jsx("th",{scope:"col",children:t("agentWorkspace.suggestionAndReason")})]})}),a.jsx("tbody",{children:e.map(n=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`aw-priority is-${n.priority}`,children:uqt(n.priority,t)})}),a.jsx("td",{children:a.jsx("span",{className:"aw-optimization-module",children:fqt(n,t)})}),a.jsx("td",{children:a.jsx("ul",{className:"aw-optimization-list",children:n.items.map(i=>a.jsxs("li",{children:[a.jsx("strong",{children:i.suggestion}),a.jsx("p",{children:i.reason})]},`${i.suggestion}:${i.reason}`))})})]},`${n.priority}:${n.module}:${n.customModule??""}`))})]})})}function kqt(){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M4.5 7h15"}),a.jsx("path",{d:"M9 7V4.8h6V7"}),a.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),a.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function Sqt({cases:e,loading:t=!1,error:n="",notice:i="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:o,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:m,onDeleteCase:g,onRetry:b}){const{t:v,i18n:y}=Ae("ui");return a.jsxs("div",{className:"aw-case-table",children:[a.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[a.jsx("span",{children:v("agentWorkspace.userInput")}),a.jsx("span",{children:v("agentWorkspace.agentOutput")}),a.jsx("span",{children:v("agentWorkspace.score")}),a.jsx("span",{children:v("agentWorkspace.scoreReason")}),a.jsx("span",{className:"aw-case-action-head",children:v("skillCenter.actions")})]}),t?a.jsx("div",{className:"aw-case-empty",children:v("agentWorkspace.loadingEvaluationSet")}):n?a.jsxs("div",{className:"aw-case-empty aw-case-error",children:[a.jsx("span",{children:n}),b&&a.jsx("button",{type:"button",onClick:b,children:v("common.retry")})]}):i?a.jsx("div",{className:"aw-case-empty",children:i}):e.length===0?a.jsx("div",{className:"aw-case-empty",children:v(r?"agentWorkspace.noFeedbackCases":"agentWorkspace.noMatchingCases")}):e.map(x=>{var _,j;const w=x.id.startsWith("local:"),O=(o==null?void 0:o.has(x.id))??!1,S=(c==null?void 0:c.has(x.id))??!1,C=x.output.length+x.referenceOutput.length>220||(((_=x.reason)==null?void 0:_.length)??0)>120,E=d&&!w,R=!!(x.comment&&x.comment.trim()!==((j=x.reason)==null?void 0:j.trim()));return a.jsxs("div",{className:["aw-case-row",l===x.id?"is-focused":"",s?"is-selecting":"",O?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?O:void 0,onClick:()=>{if(s){E&&(h==null||h(x));return}f==null||f(x)},onKeyDown:T=>{T.target===T.currentTarget&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),s?E&&(h==null||h(x)):f==null||f(x)))},children:[a.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":v("agentWorkspace.userInput"),children:[a.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&a.jsx("span",{className:`aw-select-marker${O?" is-checked":""}`,"aria-hidden":"true"}),a.jsx("strong",{title:x.input,children:x.input||v("agentWorkspace.noUserInput")})]}),R&&a.jsxs("small",{title:x.comment,children:[v("agentWorkspace.note"),x.comment]}),a.jsx("small",{className:"aw-case-time",children:lqt(x.createdAt,y.resolvedLanguage??y.language,v)}),(x.userId||x.sessionId)&&a.jsx("small",{title:[x.userId,x.sessionId].filter(Boolean).join(" · "),children:[x.userId,x.sessionId].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:`aw-case-output aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.agentOutput"),children:[a.jsx("p",{className:"aw-case-output-preview",title:x.output,children:x.output||v("agentWorkspace.noVisibleResponse")}),x.referenceOutput&&a.jsxs("small",{className:"aw-case-output-preview",title:x.referenceOutput,children:[v("agentWorkspace.reference"),": ",x.referenceOutput]}),C&&a.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),m==null||m(x.id)},children:v(S?"common.collapse":"common.expand")})]}),a.jsx("div",{className:"aw-case-score aw-case-cell","data-label":v("agentWorkspace.score"),children:cqt(x,v)}),a.jsx("div",{className:`aw-case-reason aw-case-cell${S?" is-expanded":""}`,"data-label":v("agentWorkspace.scoreReason"),children:a.jsx("p",{title:x.reason||void 0,children:x.reason||"—"})}),a.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":v("skillCenter.actions"),children:E&&a.jsx("button",{type:"button",className:"aw-case-delete",onClick:T=>{T.stopPropagation(),g==null||g(x)},disabled:u,title:v("agentWorkspace.deleteFeedbackCase"),"aria-label":v("agentWorkspace.deleteFeedbackCase"),children:a.jsx(kqt,{})})})]},x.id)})]})}function Eqt({group:e,agents:t,cases:n,onChange:i,onRun:r}){const{t:s}=Ae("ui"),[o,l]=p.useState("config"),c=e.agentIds.map(h=>t.find(m=>m.id===h)).filter(h=>!!h),u=["回答质量","事实准确性","工具调用","响应效率"];p.useEffect(()=>l("config"),[e.id]);const d=h=>{i({...e,agentIds:e.agentIds.includes(h)?e.agentIds.filter(m=>m!==h):[...e.agentIds,h]})},f=h=>{i({...e,metrics:e.metrics.includes(h)?e.metrics.filter(m=>m!==h):[...e.metrics,h]})};return a.jsxs("main",{className:"aw-main",children:[a.jsxs("div",{className:"aw-eval-head",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"aw-agent-title-row",children:[a.jsx("h2",{children:ok(e.name,s)}),a.jsx("span",{children:s("agentWorkspace.evaluationGroup")})]}),a.jsx("p",{children:s("agentWorkspace.evaluationGroupStats",{agents:c.length,caseSet:ok(e.caseSet,s),runs:e.history.length})})]}),a.jsxs("button",{type:"button",className:"aw-run",onClick:()=>r(e),disabled:!0,children:[a.jsx(rit,{"aria-hidden":!0}),s("agentWorkspace.startEvaluation")]})]}),a.jsxs("nav",{className:"aw-agent-tabs","aria-label":s("agentWorkspace.evaluationGroupDetails"),children:[a.jsx("button",{type:"button",className:o==="config"?"is-active":"","aria-pressed":o==="config",onClick:()=>l("config"),disabled:!0,children:s("agentWorkspace.evaluationConfig")}),a.jsx("button",{type:"button",className:o==="history"?"is-active":"","aria-pressed":o==="history",onClick:()=>l("history"),disabled:!0,children:s("agentWorkspace.historyResults")})]}),a.jsx("div",{className:"aw-content",children:o==="config"?a.jsxs("div",{className:"aw-eval-setup",children:[a.jsxs("section",{className:"aw-eval-block",children:[a.jsxs("div",{className:"aw-card-head",children:[a.jsx("strong",{children:s("agentWorkspace.participatingAgents")}),a.jsx("span",{children:s("agentWorkspace.selectedCount",{count:c.length})})]}),a.jsx("div",{className:"aw-eval-agent-grid",children:t.map(h=>a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:e.agentIds.includes(h.id),onChange:()=>d(h.id)}),a.jsxs("span",{children:[a.jsx("strong",{children:h.label}),a.jsx("small",{children:h.remote?s("agentWorkspace.remote"):s("agentWorkspace.local")})]})]},h.id))})]}),a.jsxs("div",{className:"aw-eval-setting-grid",children:[a.jsxs("section",{className:"aw-eval-block",children:[a.jsx("div",{className:"aw-card-head",children:a.jsx("strong",{children:s("agentWorkspace.evaluationResources")})}),a.jsxs("div",{className:"aw-eval-fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.evaluationSet")}),a.jsxs("select",{value:e.caseSet,onChange:h=>i({...e,caseSet:h.currentTarget.value}),children:[a.jsx("option",{value:"核心回归集",children:s("agentWorkspace.evaluationDefaults.coreSet")}),a.jsx("option",{value:"安全边界集",children:s("agentWorkspace.evaluationDefaults.safetySet")}),a.jsx("option",{value:"工具调用集",children:s("agentWorkspace.evaluationDefaults.toolSet")})]}),a.jsx("small",{children:s("agentWorkspace.caseCount",{count:n.length})})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.evaluator")}),a.jsxs("select",{value:e.evaluator,onChange:h=>i({...e,evaluator:h.currentTarget.value}),children:[a.jsx("option",{value:"综合质量评估器",children:s("agentWorkspace.evaluationDefaults.qualityEvaluator")}),a.jsx("option",{value:"事实一致性评估器",children:s("agentWorkspace.evaluationDefaults.factualEvaluator")}),a.jsx("option",{value:"工具调用评估器",children:s("agentWorkspace.evaluationDefaults.toolEvaluator")})]})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("agentWorkspace.concurrency")}),a.jsxs("select",{value:e.concurrency,onChange:h=>i({...e,concurrency:h.currentTarget.value}),children:[a.jsx("option",{value:"2",children:"2"}),a.jsx("option",{value:"4",children:"4"}),a.jsx("option",{value:"8",children:"8"})]})]})]})]}),a.jsxs("section",{className:"aw-eval-block",children:[a.jsxs("div",{className:"aw-card-head",children:[a.jsx("strong",{children:s("agentWorkspace.evaluationMetrics")}),a.jsx("span",{children:s("agentWorkspace.selectedMetricCount",{count:e.metrics.length})})]}),a.jsx("div",{className:"aw-metric-list",children:u.map(h=>a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:e.metrics.includes(h),onChange:()=>f(h)}),a.jsx("span",{children:ok(h,s)})]},h))})]})]})]}):a.jsxs("section",{className:"aw-eval-history",children:[a.jsx("div",{className:"aw-section-head",children:a.jsxs("div",{children:[a.jsx("h3",{children:s("agentWorkspace.historyResults")}),a.jsx("p",{children:s("agentWorkspace.historyDescription")})]})}),e.history.length===0?a.jsxs("div",{className:"aw-results-empty",children:[a.jsx("strong",{children:s("agentWorkspace.noHistory")}),a.jsx("span",{children:s("agentWorkspace.noHistoryDescription")})]}):a.jsx("div",{className:"aw-history-list",children:e.history.map((h,m)=>a.jsxs("button",{type:"button",children:[a.jsxs("span",{children:[a.jsx("strong",{children:s("agentWorkspace.evaluationRun",{index:e.history.length-m})}),a.jsx("small",{children:s("agentWorkspace.evaluationRunMeta",{time:ok(h.createdAt,s),agents:c.length})})]}),a.jsxs("span",{className:"aw-history-score",children:[a.jsx("strong",{children:h.score}),a.jsx("small",{children:s("agentWorkspace.overallScore")})]}),a.jsxs("span",{className:"aw-complete",children:[a.jsx(Md,{}),s("agentWorkspace.completed")]}),a.jsx(Lk,{"aria-hidden":!0})]},h.id))})]})})]})}async function QH(e,t={}){const n=await fetch(Zo(`/web/agent-reviews${e}`),{...t,headers:Pl(uu({"Content-Type":"application/json"})),signal:Ua(t.signal??void 0,6e4)});if(!n.ok)throw new Error(await n.text());return n.json()}function Cqt(e,t){return QH(`?${new URLSearchParams({region:e})}`,{signal:t})}function Tqt(e,t,n){return QH(`/${encodeURIComponent(e)}?${new URLSearchParams({region:t})}`,{signal:n})}function Aqt(e,t,n){return QH(`/${encodeURIComponent(e)}/${t}`,{method:"POST",body:JSON.stringify(n)})}const _qt=20,vse=256;function l4({label:e,value:t,onChange:n,limit:i,disabled:r,required:s=!1}){const{t:o}=Ae("agentReviews");return a.jsxs("label",{children:[e,a.jsx("textarea",{"aria-label":e,value:t,onChange:l=>n(Array.from(l.target.value).slice(0,i).join("")),maxLength:i*2,disabled:r,required:s,rows:3}),a.jsx("span",{className:"agent-review-text-count",children:o("textCount",{count:Array.from(t).length,limit:i})})]})}function LR({person:e}){return a.jsxs("span",{className:"agent-review-person",title:e.email||e.name,children:[e.avatarUrl?a.jsx("img",{src:e.avatarUrl,alt:"",referrerPolicy:"no-referrer",onError:t=>{t.currentTarget.hidden=!0}}):null,a.jsx("span",{children:e.name||e.id})]})}function j6e({runtimeId:e,region:t,name:n,canPublish:i,onClose:r,onChanged:s}){const{t:o,i18n:l}=Ae("agentReviews"),[c,u]=p.useState(null),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(""),[v,y]=p.useState(""),[x,w]=p.useState(""),[O,S]=p.useState(""),[k,C]=p.useState(0),[E,R]=p.useState(!1),[_,j]=p.useState(null);p.useEffect(()=>{const M=new AbortController;return f(!0),b(""),Tqt(e,t,M.signal).then(L=>{M.signal.aborted||u(L.application)}).catch(L=>{M.signal.aborted||b(L instanceof Error?L.message:String(L))}).finally(()=>{M.signal.aborted||f(!1)}),()=>M.abort()},[e,t,k]);async function T(M,L){if(!h){m(!0),b("");try{const U=await Aqt(e,M,{region:t,...M==="submit"?{message:v}:{},...M==="publish"||M==="decision"?{comment:x}:{},...M==="decision"?{applicationId:c==null?void 0:c.id,decision:L,reason:O}:{}});u(U),w(""),S(""),R(!1),j(null),s()}catch(U){b(U instanceof Error?U.message:String(U))}finally{m(!1)}}}const N=(c==null?void 0:c.status)==="pending",A=!!(c!=null&&c.published),P=!N&&!A,D=M=>new Date(M).toLocaleString(l.language);return a.jsx(DD,{open:!0,onOpenChange:M=>{!M&&!h&&r()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"agent-review-backdrop"}),a.jsxs(ID,{className:"agent-review-dialog",children:[a.jsxs("header",{className:"agent-review-dialog-header",children:[a.jsxs("div",{children:[a.jsx(MD,{children:n}),a.jsx(RD,{children:o("dialogDescription")})]}),a.jsx(MH,{className:"agent-review-close",disabled:h,"aria-label":o("close"),children:a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m6 6 12 12M6 18 18 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"agent-review-dialog-body",children:[d?a.jsx(Fa,{}):null,g?a.jsxs("div",{className:"agent-review-error",role:"alert",children:[a.jsx("p",{children:g}),a.jsx("button",{type:"button",disabled:h||d,onClick:()=>C(M=>M+1),children:o("refresh")})]}):null,!d&&c?a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"agent-review-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:o("statusTitle")}),a.jsxs("dd",{children:[o(`status.${c.status}`),c.status==="approved"&&!A?` · ${o("private")}`:""]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("submitter")}),a.jsx("dd",{children:a.jsx(LR,{person:c.submitter})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("submittedAt")}),a.jsx("dd",{children:D(c.submittedAt)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("version")}),a.jsx("dd",{children:c.agent.version??"—"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("model")}),a.jsx("dd",{children:c.agent.model||"—"})]}),c.reviewer?a.jsxs("div",{children:[a.jsx("dt",{children:o(c.status==="returned"?"returnedBy":"approvedBy")}),a.jsx("dd",{children:a.jsx(LR,{person:c.reviewer})})]}):null,c.reviewedAt?a.jsxs("div",{children:[a.jsx("dt",{children:o("reviewedAt")}),a.jsx("dd",{children:D(c.reviewedAt)})]}):null]}),a.jsxs("section",{children:[a.jsx("h3",{children:o("description")}),a.jsx("p",{children:c.agent.description||"—"})]}),c.message?a.jsxs("section",{children:[a.jsx("h3",{children:o("message")}),a.jsx("p",{children:c.message})]}):null,c.reason?a.jsxs("section",{children:[a.jsx("h3",{children:o("reason")}),a.jsx("p",{children:c.reason})]}):null,c.comment?a.jsxs("section",{children:[a.jsx("h3",{children:o("comment")}),a.jsx("p",{children:c.comment})]}):null,c.contentChanged?a.jsx("p",{role:"alert",className:"agent-review-warning",children:o("contentChanged")}):null]}):null,!d&&!g&&P&&!i?a.jsx(l4,{label:o("message"),value:v,onChange:y,limit:_qt,disabled:h}):null,!d&&!g&&i&&(N||P)?a.jsx(l4,{label:o("comment"),value:x,onChange:w,limit:vse,disabled:h}):null,E?a.jsx(l4,{label:o("reasonRequired"),value:O,onChange:S,limit:vse,disabled:h,required:!0}):null,_?a.jsx("p",{role:"status",children:o(`${_}Confirm`)}):null]}),a.jsxs("footer",{className:"agent-review-dialog-footer",children:[h?a.jsx("span",{role:"status",children:o("saving")}):null,!d&&(!g||c)?_?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>j(null),children:o("cancel")}),a.jsx("button",{type:"button",disabled:h,onClick:()=>void T(_),children:o("confirm")})]}):E?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>R(!1),children:o("cancel")}),a.jsx("button",{type:"button",disabled:h||!O.trim(),onClick:()=>void T("decision","returned"),children:o("return")})]}):a.jsxs(a.Fragment,{children:[A?a.jsx("button",{type:"button",disabled:h,onClick:()=>j("unpublish"),children:o("unpublish")}):null,N?a.jsx("button",{type:"button",disabled:h,onClick:()=>j("withdraw"),children:o("withdraw")}):null,N&&i?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:h,onClick:()=>R(!0),children:o("return")}),a.jsx("button",{type:"button",className:"is-primary",disabled:h||(c==null?void 0:c.contentChanged),onClick:()=>void T("decision","approved"),children:o("approve")})]}):null,P?a.jsx("button",{type:"button",className:"is-primary",disabled:h,onClick:()=>void T(i?"publish":"submit"),children:o(i?"publish":"submit")}):null]}):null]})]})]})})}const jqt=5e3,Nqt=4;let c4=0;const xse=[];function wse(e){return e instanceof Error&&e.name==="AbortError"}function Rqt(e){return e instanceof Error&&e.name==="TimeoutError"}function Iqt(e){return Rqt(e)||e instanceof vU&&[500,502,503,504].includes(e.status)}function Pqt(e,t){return t!=null&&t.aborted?Promise.reject(t.reason??new DOMException("Request aborted","AbortError")):new Promise((n,i)=>{const r=()=>{globalThis.clearTimeout(s),i((t==null?void 0:t.reason)??new DOMException("Request aborted","AbortError"))},s=globalThis.setTimeout(()=>{t==null||t.removeEventListener("abort",r),n()},e);t==null||t.addEventListener("abort",r,{once:!0})})}async function Dqt(e={},t={}){const n=t.request??Fw,i=t.wait??Pqt;try{return await n(e)}catch(r){if(!Iqt(r))throw r;return await i(jqt,e.signal),n(e)}}async function N6e(e){var t;c4>=Nqt&&await new Promise(n=>xse.push(n)),c4+=1;try{return await e()}finally{c4-=1,(t=xse.shift())==null||t()}}async function Mqt(e,t){await Promise.allSettled(e.map(n=>N6e(()=>t(n))))}function Ab(e,t,n){const i=e instanceof Error?`${e.name}: ${e.message}`:String(e||z("common.unknownError"));return[z("requestError.actionFailed",{action:t}),z("requestError.detail",{detail:i}),n?z("requestError.request",{request:n}):""].filter(Boolean).join(` +`)}function Bh({className:e="icon"}){return a.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),a.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),a.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function Lqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),a.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function $qt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),a.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),a.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),a.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function Fqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),a.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),a.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),a.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function Bqt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),a.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),a.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),a.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function UE({kind:e,...t}){return e==="codex"?a.jsx(Lqt,{...t}):e==="deepseek-harness"?a.jsx(Bqt,{...t}):e==="openclaw"?a.jsx($qt,{...t}):a.jsx(Fqt,{...t})}const Uqt=["general","codex","deepseek-harness","openclaw","hermes"],Qqt=24,zqt=3e4,Vqt=7e3,Hqt=2e4,qqt=6,Wqt=2,Kqt=250,jm=new Map,kx=new Map,Gqt=new Set;function rb(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function Ose(e,t){const n=e instanceof Error&&e.message.trim()?e.message.trim():t("myAgents.compatibility.unknownError");return{status:e instanceof co&&e.unsupported?"unsupported":"error",message:n}}function wb(e){if(!e){jm.clear(),kx.clear(),F6();return}const t=new Set(e);if(t.size!==0){for(const[n,i]of kx)i.page.runtimes.some(r=>t.has(r.runtimeId))&&kx.delete(n);for(const n of t)F6(n);jm.clear()}}function Xqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function Yqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8.313 3.646a.5.5 0 0 1 .707 0l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 1 1-.707-.708L11.46 8.5H3.333a.5.5 0 0 1 0-1h8.127L8.313 4.354a.5.5 0 0 1 0-.708Z",fill:"currentColor"})})}function Zqt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M2.75 5.25h8.75m0 0-2-2m2 2-2 2M13.25 10.75H4.5m0 0 2 2m-2-2 2-2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jqt({type:e}){return e==="general"?a.jsx(Bh,{}):a.jsx(UE,{kind:e})}function eWt(e,t=Date.now(),n){const i=Date.parse(e);if(!Number.isFinite(i)||i-t<6e4)return n("myAgents.expiringSoon");const r=Math.ceil((i-t)/6e4),s=Math.floor(r/60),o=r%60;return n("myAgents.sandboxRemaining",{hours:s,minutes:o})}function kse(e,t){var n;return{id:e.runtimeId,name:e.name,description:((n=e.description)==null?void 0:n.trim())||t("common.noDescription"),createdAt:e.createdAt??"",specificationLabel:t("myAgents.creator"),specification:$De(e.author),isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete,canManage:e.canManage,canPublish:e.canPublish,visibility:e.visibility,reviewStatus:e.reviewStatus}}}function tWt(e,t){const n=MI(e.status);return{id:e.id,name:e.displayName||t("myAgents.namedAgent",{name:e.toolName}),description:t(`myAgents.sandboxStatus.${n}`,{defaultValue:t("myAgents.sandboxStatus.unknown")}),createdAt:e.createdAt,specificationLabel:t("myAgents.creator"),specification:$De(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function nWt(e,t){var n,i;return{id:e.id,name:e.draft.name||t("agentSelector.unnamedAgent"),description:((n=e.draft.description)==null?void 0:n.trim())||t("common.noDescription"),createdAt:new Date(e.updatedAt).toISOString(),specificationLabel:t("myAgents.storageLocation"),specification:t("myAgents.currentBrowser"),isMine:!0,region:(i=e.deploymentTarget)==null?void 0:i.region,draft:e}}function iWt(e,t,n){if(!e.draft)return e;const i=e.draft.deploymentTarget;return i?t.find(r=>{var s;return((s=r.runtime)==null?void 0:s.runtimeId)===i.runtimeId&&r.runtime.region===i.region})??{id:i.runtimeId,appName:i.appName,name:i.name||e.name,description:e.description,createdAt:e.createdAt,specificationLabel:n("myAgents.region"),specification:i.region,isMine:!0,runtime:{runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion,canDelete:!1}}:null}function rWt(e,t){return e.trim()||Ki(t)}async function sWt(e,t,n,i,r,s){const o=`${e}:${t}:${n}`,l=kx.get(o);if(l&&l.expiresAt>Date.now())return i(l.page.runtimes.map(d=>kse(d,r))),l.page.nextToken;l&&kx.delete(o);let c=jm.get(o);c||(c=Dqt({scope:e,region:t,pageSize:Qqt,nextToken:n,signal:s}),jm.set(o,c),c.then(()=>jm.delete(o),()=>jm.delete(o)));const u=await c;return kx.set(o,{page:u,expiresAt:Date.now()+zqt}),i(u.runtimes.map(d=>kse(d,r))),u.nextToken}function oWt({agent:e,onReview:t,onUse:n,onViewDetails:i,onPrepareUpdate:r,compatibility:s,onRetryCompatibility:o,connecting:l,connectError:c,connected:u,deploymentTask:d,nowMs:f,onViewDeploymentTask:h,onEditDraft:m,onDeleteDraft:g}){var j,T,N,A;const{t:b,i18n:v}=Ae("ui"),y=(j=e.sandbox)==null?void 0:j.status.toLowerCase(),x=((T=e.sandbox)==null?void 0:T.resourceType)==="snapshot",w=!!(e.runtime||y==="ready"||y==="wakeable"),O=(s==null?void 0:s.status)==="checking",S=(s==null?void 0:s.status)==="unsupported",k=(s==null?void 0:s.status)==="error",C=((N=e.sandbox)==null?void 0:N.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(A=e.sandbox)==null?void 0:A.id,E=()=>{if(e.draft){d?h==null||h(d):i==null||i(e);return}!w&&!e.sandbox||(d?h==null||h(d):i==null||i(e))},R=(e.draft||w||!!e.sandbox)&&!!(d?h:i),_=e.draft?d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.viewRuntimeDetails",{name:e.name}):d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.viewDetails",{name:e.name});return a.jsxs(Sz,{className:`my-agent-card${l?" is-connecting":""}${e.runtime?" has-review":""}`,activateLabel:R?_:void 0,onActivate:R?E:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:a.jsxs("div",{className:"my-agent-card-footer",children:[a.jsx(qRe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:b("myAgents.time"),value:LD(e.createdAt,f,v.resolvedLanguage??v.language),hideLabel:!0,className:"my-agent-created-at"},...e.sandbox?[{label:b("myAgents.remainingTime"),value:e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?b("myAgents.neverExpires"):eWt(e.sandbox.expireAt,f,b),className:`my-agent-expiry${e.sandbox.resourceType==="snapshot"||e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),e.runtime?a.jsxs("div",{className:"agent-review-card-controls",children:[a.jsx("span",{className:"agent-review-card-status",children:b(e.runtime.visibility==="enterprise"?"enterprise":"private",{ns:"agentReviews"})}),e.runtime.canManage?a.jsxs(H_,{className:"agent-review-card-action",onClick:P=>{P.stopPropagation(),t==null||t(e)},children:[b(e.runtime.reviewStatus?"details":e.runtime.canPublish?"publish":"submit",{ns:"agentReviews"}),e.runtime.reviewStatus?` · ${b(`status.${e.runtime.reviewStatus}`,{ns:"agentReviews"})}`:""]}):null]}):null]}),actions:e.draft?a.jsxs(a.Fragment,{children:[a.jsx(H_,{"aria-label":d?b("myAgents.viewDeploymentProgress",{name:e.name}):b("myAgents.editDraftNamed",{name:e.name}),onClick:()=>d?h==null?void 0:h(d):m==null?void 0:m(e.draft),children:b(d?"myAgents.viewProgress":"common.edit")}),a.jsx(H_,{tone:"danger","aria-label":b("myAgents.deleteDraftNamed",{name:e.name}),onClick:()=>g==null?void 0:g(e.draft),children:b("common.delete")})]}):k||S?a.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":b("myAgents.recheckCompatibility",{name:e.name}),onClick:()=>o==null?void 0:o(e),children:[a.jsx(ZI,{}),b("common.retry")]}):a.jsx(KF,{className:u?"my-agent-use is-connected":"my-agent-use",disabled:!w||O||S||l||u,"aria-busy":l||void 0,label:u?b("myAgents.connectedNamed",{name:e.name}):x?b("myAgents.wakeAndChat",{name:e.name}):b("myAgents.chatWith",{name:e.name}),onClick:()=>void(n==null?void 0:n(e)),children:l?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),a.jsx("span",{className:"sr-only",children:b(x?"myAgents.waking":"agentSelector.connecting")})]}):a.jsx(Yqt,{})}),children:[a.jsx(Ez,{leading:a.jsx(ow,{seed:e.name}),title:e.name,subtitle:e.sandbox?a.jsx("span",{className:"my-agent-session-id",title:C,children:C}):void 0,status:e.draft?d?a.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):a.jsx("span",{className:"my-agent-draft-badge",children:b("myAgents.draft")}):e.sandbox?a.jsx("span",{className:"my-agent-status-label","data-ready":MI(e.sandbox.status)==="ready"||void 0,children:e.description}):e.runtime&&d?a.jsx("span",{className:"my-agent-deploying-badge",children:b("myAgents.deploying")}):O?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsxs(Io,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[a.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),a.jsx("span",{children:b("myAgents.checking")})]})})}):S?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsx(Io,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:b("myAgents.chatUnsupported")})})}):k?a.jsx(uo,{content:s==null?void 0:s.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:a.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:a.jsx(Io,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:b("myAgents.checkFailed")})})}):null}),c?a.jsx(uo,{content:c,contentClassName:"my-agent-error-tooltip",maxWidth:360,interactive:!0,children:a.jsx("p",{className:"my-agent-wake-note",role:"alert",tabIndex:0,children:c})}):null,x&&l?a.jsx("p",{className:"my-agent-wake-note",role:"status",children:a.jsx(yn,{children:b("myAgents.wakingHint")})}):null,e.sandbox?null:a.jsx(Cz,{children:e.description})]})}function aWt({cloudProvider:e,studioRegion:t,canCreateRuntimeAgents:n,canCreatePersonalAgents:i,canUpdate:r,runtimeScope:s,onCreateAgent:o,onOpenCodexProjectUpload:l,onUseAgent:c,onViewAgentDetails:u,onCreateSandboxAgent:d,onUseSandboxAgent:f,onViewSandboxAgentDetails:h,activeType:m,onActiveTypeChange:g,sandboxRefreshKey:b=0,connectedRuntimeId:v="",hiddenRuntimeIds:y=Gqt,drafts:x=[],deploymentTasks:w=[],draftDeploymentTaskIds:O={},onViewDeploymentTask:S,onEditDraft:k,onDeleteDraft:C}){const{t:E}=Ae("ui"),R=p.useRef(null),_=p.useRef(null),j=p.useRef(0),T=p.useRef(null),N=p.useRef(0),A=p.useRef(null),P=p.useRef(new Map),D=rWt(t,e),[M,L]=p.useState(null),[U,I]=p.useState(""),[H,K]=p.useState(s==="mine"?"mine":"all"),[F,W]=p.useState(D),[V,X]=p.useState([]),[ie,Q]=p.useState(""),[Z,ce]=p.useState(!0),[Ee,Y]=p.useState(""),[G,te]=p.useState([]),[ye,Ne]=p.useState(!1),[pe,me]=p.useState(""),[se,Se]=p.useState(""),[Le,be]=p.useState({}),[Ve,ve]=p.useState({}),[Re,ne]=p.useState(null),[ge,Ce]=p.useState(()=>Date.now()),ke=p.useMemo(()=>Uqt.map(Me=>({value:Me,label:E(`myAgents.agentTypes.${Me}`)})),[E]),Ke=p.useMemo(()=>{const Me=Jc(e);return Me.some(We=>We.value===D)?Me:[{value:D,label:D},...Me]},[e,D]);p.useEffect(()=>{s==="mine"&&K("mine")},[s]),p.useEffect(()=>{W(D)},[D]),p.useEffect(()=>{Ce(Date.now());const Me=window.setInterval(()=>Ce(Date.now()),1e3);return()=>window.clearInterval(Me)},[]);const it=p.useMemo(()=>x.map(Me=>nWt(Me,E)),[x,E]),ue=p.useMemo(()=>{const Me=new Map,We=new Map,gt=new Map;for(const st of w){if(st.status!=="running")continue;if(Me.set(st.id,st),st.draftId){const ft=We.get(st.draftId);(!ft||st.startedAt>ft.startedAt)&&We.set(st.draftId,st)}if(!st.runtimeId)continue;const xt=gt.get(st.runtimeId);(!xt||st.startedAt>xt.startedAt)&>.set(st.runtimeId,st)}return{byId:Me,byDraftId:We,byRuntimeId:gt}},[w]),xe=p.useCallback(Me=>{var gt;if(Me.draft){const st=O[Me.draft.id];return ue.byDraftId.get(Me.draft.id)??(st?ue.byId.get(st):void 0)}const We=(gt=Me.runtime)==null?void 0:gt.runtimeId;return We?ue.byRuntimeId.get(We):void 0},[ue,O]),Te=p.useCallback((Me,We)=>{var xt;(xt=T.current)==null||xt.abort(),jm.clear();const gt=new AbortController;T.current=gt;const st=++j.current;return ce(!0),Y(""),sWt(H,F,Me,ft=>{j.current===st&&X(Ht=>We?ft:[...Ht,...ft])},E,gt.signal).then(ft=>{j.current===st&&Q(ft)}).catch(ft=>{j.current===st&&(wse(ft)||Y(Ab(ft,E("myAgents.loadGeneralAgents"),"GET /web/runtimes")))}).finally(()=>{j.current===st&&ce(!1),T.current===gt&&(T.current=null)})},[H,F,E]);p.useEffect(()=>{if(m==="general")return X([]),Q(""),Te("",!0),()=>{var Me;(Me=T.current)==null||Me.abort(),T.current=null,jm.clear(),j.current+=1}},[m,Te]),p.useEffect(()=>{if(m!=="general"){for(const gt of P.current.values())gt.abort();P.current.clear();return}const Me=new Set(V.filter(gt=>{var st,xt;return((st=gt.runtime)==null?void 0:st.runtimeId)!==v&&((xt=gt.runtime)==null?void 0:xt.region)===F}).map(rb).filter(Boolean));for(const[gt,st]of P.current)Me.has(gt)||(st.abort(),P.current.delete(gt));const We=V.filter(gt=>{var Ht,cn,hn;const st=(Ht=gt.runtime)==null?void 0:Ht.runtimeId;if(!st||st===v||((cn=gt.runtime)==null?void 0:cn.region)!==F)return!1;const xt=rb(gt),ft=(hn=Ve[xt])==null?void 0:hn.status;return!P.current.has(xt)&&(!ft||ft==="checking")});for(const gt of We)P.current.set(rb(gt),new AbortController);ve(gt=>{var ft,Ht;let st=!1;const xt={...gt};for(const cn of V){const hn=rb(cn);if(!hn)continue;const Ge=((ft=cn.runtime)==null?void 0:ft.runtimeId)===v;Ge&&((Ht=xt[hn])==null?void 0:Ht.status)!=="compatible"?(xt[hn]={status:"compatible",message:E("myAgents.compatibility.supported")},st=!0):!Ge&&!xt[hn]&&(xt[hn]={status:"checking",message:E("myAgents.compatibility.checking")},st=!0)}return st?xt:gt}),Mqt(We,async gt=>{const st=gt.runtime;if(!st)return;const xt=rb(gt),ft=P.current.get(xt);if(ft)try{const Ht=await Vx(st.runtimeId,st.region,{signal:ft.signal,preferCached:!0,timeoutMs:Vqt,currentVersion:st.currentVersion});if(ft.signal.aborted)return;ve(cn=>({...cn,[xt]:Ht&&Ht.length>0?{status:"compatible",message:E("myAgents.compatibility.supported")}:{status:"unsupported",message:E("myAgents.compatibility.empty")}}))}catch(Ht){if(ft.signal.aborted||(Ht==null?void 0:Ht.name)==="AbortError")return;ve(cn=>({...cn,[xt]:Ose(Ht,E)}))}finally{P.current.get(xt)===ft&&P.current.delete(xt)}})},[m,v,F,V,E]),p.useEffect(()=>()=>{var Me;(Me=T.current)==null||Me.abort();for(const We of P.current.values())We.abort();P.current.clear()},[]);const qe=p.useCallback(async Me=>{var st;(st=A.current)==null||st.abort();const We=new AbortController;A.current=We;const gt=++N.current;Ne(!0),me(""),te([]);try{const xt=Me==="codex"?await Sr.listSessions({signal:We.signal,autoResumeSnapshots:!1}):await Sr.listAgentSessions(Me,{signal:We.signal,autoResumeSnapshots:!1});if(N.current!==gt)return;te(xt.map(ft=>tWt(ft,E)))}catch(xt){if((xt==null?void 0:xt.name)==="AbortError"||N.current!==gt)return;me(Ab(xt,E("myAgents.loadAgentType",{type:E(`myAgents.agentTypes.${Me}`)}),`GET /web/${Me==="codex"?"sandbox":Me}/sessions`))}finally{A.current===We&&(A.current=null),N.current===gt&&Ne(!1)}},[E]);function De(Me){var We;Me!==m&&(Me==="general"?(j.current+=1,X([]),Q(""),Y(""),ce(!0)):((We=A.current)==null||We.abort(),A.current=null,N.current+=1,te([]),me(""),Ne(!0)),g(Me))}function At(){m==="general"&&(j.current+=1,X([]),Q(""),Y(""),ce(!0))}function It(Me){Me!==H&&(At(),K(Me))}function lt(Me){Me!==F&&(At(),W(Me))}p.useEffect(()=>{var Me;if(m==="general"){(Me=A.current)==null||Me.abort(),A.current=null,N.current+=1;return}return qe(m),()=>{var We;(We=A.current)==null||We.abort(),A.current=null,N.current+=1}},[m,qe,b]),p.useEffect(()=>{const Me=_.current,We=R.current;if(!Me||!We||m!=="general"||!ie||Z)return;const gt=new IntersectionObserver(([st])=>{st.isIntersecting&&Te(ie,!1)},{root:We,rootMargin:"240px 0px",threshold:.01});return gt.observe(Me),()=>gt.disconnect()},[m,Te,Z,ie]);const Ot=p.useCallback(async Me=>{if(!se){Se(Me.id),be(We=>({...We,[Me.id]:""}));try{await new Promise(We=>requestAnimationFrame(()=>We())),Me.sandbox?await f(Me.sandbox):await c(Me)}catch(We){be(gt=>({...gt,[Me.id]:We instanceof Error?We.message:String(We)}))}finally{Se("")}}},[se,c,f]),Ct=p.useCallback(async Me=>{var xt;const We=Me.runtime;if(!We)return;const gt=rb(Me);ve(ft=>({...ft,[gt]:{status:"checking",message:E("myAgents.compatibility.checking")}})),(xt=P.current.get(gt))==null||xt.abort();const st=new AbortController;P.current.set(gt,st);try{const ft=await N6e(()=>Vx(We.runtimeId,We.region,{retryProbe:!0,signal:st.signal,timeoutMs:Hqt,currentVersion:We.currentVersion}));if(st.signal.aborted)return;ve(Ht=>({...Ht,[gt]:ft&&ft.length>0?{status:"compatible",message:E("myAgents.compatibility.supported")}:{status:"unsupported",message:E("myAgents.compatibility.empty")}}))}catch(ft){if(st.signal.aborted||wse(ft))return;ve(Ht=>({...Ht,[gt]:Ose(ft,E)}))}finally{P.current.get(gt)===st&&P.current.delete(gt)}},[E]),dt=p.useCallback(Me=>{const We=Me.runtime;!r||!We||xe(Me)||$6({runtimeId:We.runtimeId,region:We.region,appName:Me.appName,currentVersion:We.currentVersion})},[r,xe]),yt=p.useMemo(()=>{const Me=U.trim().toLocaleLowerCase(),We=m==="general"?[...it,...V]:G,st=(H==="mine"?We.filter(cn=>cn.isMine):We).filter(cn=>{var Ge;const hn=((Ge=cn.runtime)==null?void 0:Ge.region)??cn.region;return!hn||hn===F}),xt=Me?st.filter(cn=>cn.name.toLocaleLowerCase().includes(Me)):st;if(m!=="general")return xt;const ft=y.size>0?xt.filter(cn=>!cn.runtime||!y.has(cn.runtime.runtimeId)):xt,Ht=ft.findIndex(cn=>{var hn;return((hn=cn.runtime)==null?void 0:hn.runtimeId)===v});return Ht<=0?ft:[ft[Ht],...ft.slice(0,Ht),...ft.slice(Ht+1)]},[m,v,it,y,U,H,F,V,G]);p.useEffect(()=>{if(!r||m!=="general")return;const Me=yt.filter(ft=>!!ft.runtime).filter(ft=>!xe(ft)).slice(0,qqt);if(Me.length===0)return;let We=!1,gt=0;const st=async()=>{for(;!We;){const ft=Me[gt];if(gt+=1,!(ft!=null&&ft.runtime)||(await $6({runtimeId:ft.runtime.runtimeId,region:ft.runtime.region,appName:ft.appName,currentVersion:ft.runtime.currentVersion}),We))return}},xt=window.setTimeout(()=>{for(let ft=0;ft{We=!0,window.clearTimeout(xt)}},[m,r,xe,yt]);const Ie=E(`myAgents.agentTypes.${m}`,{defaultValue:E("myAgents.agent")}),vt=m==="general"?Z&&V.length===0&&it.length===0:ye&&G.length===0,jt=!vt&&yt.length===0,ln=(m==="general"?n:i)?m==="general"?()=>o(F):()=>d(m):void 0,He=m==="codex"&&i&&!!l;return a.jsxs(Df,{className:"my-agents-page","aria-label":E("myAgents.agent"),children:[a.jsx(Ky,{title:E("myAgents.agent"),className:"my-agents-header"}),a.jsxs(Gy,{className:"my-agent-toolbar",children:[a.jsx(Xy,{idPrefix:"my-agent-ownership",ariaLabel:E("myAgents.creatorFilter"),value:H,items:[{id:"all",label:E("common.all"),disabled:s==="mine"},{id:"mine",label:E("agentSelector.createdByMe")}],onChange:It}),a.jsxs("div",{className:"resource-toolbar__actions",children:[a.jsx(cg,{id:"my-agent-type-filter",ariaLabel:E("myAgents.agentType"),value:m,options:ke,onChange:De}),a.jsx(cg,{id:"my-agent-region-filter",ariaLabel:E("myAgents.region"),value:F,options:Ke,onChange:lt}),a.jsx(hp,{className:"my-agent-search","aria-label":E("myAgents.searchAgents"),value:U,onChange:Me=>I(Me.target.value),placeholder:E("common.search")}),He?a.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:l,children:[a.jsx(Zqt,{}),a.jsx("span",{children:E("myAgents.handoff")})]}):null]})]}),a.jsxs(Rg,{className:"my-agent-results",ref:R,"aria-label":E("myAgents.agentList",{type:Ie}),children:[vt?a.jsx(Fa,{}):(m==="general"?Ee:pe)&&yt.length===0?a.jsxs("div",{className:"my-agent-empty",role:"alert",children:[a.jsx("p",{children:m==="general"?Ee:pe}),a.jsx("button",{type:"button",onClick:()=>{m==="general"?Te("",!0):qe(m)},children:E("common.reload")})]}):jt&&!ln?U.trim()||H==="mine"||F!==D?a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Cnt,{})}),a.jsx(Pn.Title,{children:E("myAgents.noMatchingAgents")}),a.jsx(Pn.Description,{children:E("myAgents.adjustSearch")})]})}):m!=="general"?a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Jqt,{type:m})}),a.jsx(Pn.Title,{className:"my-agent-sandbox-empty-title",children:E("myAgents.noAgentType",{type:Ie})})]})}):a.jsx("div",{className:"my-agent-empty-message",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(Bh,{})}),a.jsx(Pn.Title,{children:E("myAgents.noGeneralAgents")}),a.jsx(Pn.Description,{children:E("myAgents.createGeneralAgentDescription")})]})}):a.jsxs(a.Fragment,{children:[m==="general"&&Ee?a.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[a.jsx("span",{children:Ee}),a.jsx("button",{type:"button",onClick:()=>void Te("",!0),children:E("common.reload")})]}):null,a.jsxs(Yy,{className:"my-agent-grid",children:[ln?a.jsx(ug,{className:"my-agent-create-card","aria-label":E("myAgents.createAgentType",{type:Ie}),onClick:ln,icon:a.jsx(Xqt,{}),children:E("myAgents.createAgent")}):null,yt.map(Me=>{var gt,st,xt,ft,Ht;const We=iWt(Me,V,E);return a.jsx(oWt,{agent:Me,onReview:L,deploymentTask:xe(Me),nowMs:ge,onViewDeploymentTask:S,onUse:Ot,compatibility:Me.runtime?Ve[rb(Me)]??{status:"checking",message:E("myAgents.compatibility.checking")}:void 0,onRetryCompatibility:Ct,onPrepareUpdate:((gt=Me.runtime)==null?void 0:gt.canManage)===!1||((st=Me.runtime)==null?void 0:st.visibility)==="enterprise"||((xt=Me.runtime)==null?void 0:xt.reviewStatus)==="pending"?void 0:dt,onViewDetails:We&&((ft=Me.runtime)==null?void 0:ft.canManage)!==!1?()=>{We.sandbox?h(We.sandbox):u(We)}:void 0,connecting:Me.id===se,connectError:Le[Me.id],connected:((Ht=Me.runtime)==null?void 0:Ht.runtimeId)===v,onEditDraft:k,onDeleteDraft:ne},Me.id)})]})]}),m==="general"&&!Ee&&!vt&&(yt.length>0||!!ie)&&a.jsx("div",{className:"my-agent-load-more",ref:_,"aria-live":"polite",children:Z?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),a.jsx("span",{children:E("myAgents.loadingMore")})]}):ie?a.jsx("span",{children:E("myAgents.scrollForMore")}):a.jsx("span",{children:E("myAgents.allLoaded")})})]}),M!=null&&M.runtime?a.jsx(j6e,{runtimeId:M.runtime.runtimeId,region:M.runtime.region,name:M.name,canPublish:M.runtime.canPublish===!0,onClose:()=>L(null),onChanged:()=>{wb(),Te("",!0)}},`${M.runtime.region}:${M.runtime.runtimeId}`):null,Re?a.jsx(Gu,{title:E("myAgents.deleteDraftTitle"),description:E("myAgents.deleteDraftDescription",{name:Re.draft.name||E("agentSelector.unnamedAgent")}),confirmLabel:E("myAgents.deleteDraft"),variant:"danger",onCancel:()=>ne(null),onConfirm:()=>{C==null||C(Re),ne(null)}}):null]})}function zH({section:e,onWorkspace:t,onEnvironment:n,onProjects:i,actions:r,children:s,className:o=""}){const{t:l}=Ae("ui"),c=l(e==="workspaces"?"workspace.title":e==="environments"?"common.environment":"workspace.codeProjects");return a.jsxs(Df,{className:`workspace-center ${o}`,"aria-label":c,children:[a.jsx(Ky,{title:c}),a.jsxs(Gy,{children:[(t||n)&&a.jsx(Xy,{items:[{id:"workspaces",label:l("workspace.title")},{id:"environments",label:l("common.environment")},...i?[{id:"projects",label:l("workspace.codeProjects")}]:[]],value:e,onChange:u=>{u==="workspaces"&&(t==null||t()),u==="environments"&&(n==null||n()),u==="projects"&&(i==null||i())},ariaLabel:l("workspace.resourceType"),idPrefix:"workspace-center"}),a.jsx("div",{className:"resource-toolbar__actions",children:r})]}),s]})}const lWt="_Container_13560_1",cWt="_Textarea_13560_174",Sse={Container:lWt,Textarea:cWt},Og=e=>{const t=p.useRef(null),i=`search-ui-input-${p.useId()}`,{id:r,name:s,variant:o="outline",size:l="md",gutterSize:c,className:u,autoComplete:d,disabled:f=!1,readOnly:h=!1,invalid:m=!1,allowAutofillExtensions:g=!!s,onFocus:b,onBlur:v,onAnimationStart:y,onAutofill:x,autoSelect:w,rows:O=3,maxRows:S,autoResize:k,ref:C,onChange:E,...R}=e,[_,j]=p.useState(!1),T=k?Math.max(S??10,O):O;p.useEffect(()=>{var P;w&&((P=t.current)==null||P.select())},[w]);const N=P=>{y==null||y(P),P.animationName==="native-autofill-in"&&(x==null||x())},A=p.useCallback(()=>{if(!k||!t.current||T===void 0)return;t.current.style.height="0px";const P=t.current.scrollHeight;t.current.style.height=P+"px"},[k,T]);return p.useEffect(()=>{A()},[e.value,O,A]),a.jsx("div",{className:Ti(Sse.Container,u),"data-variant":o,"data-size":l,"data-gutter-size":c,"data-focused":_,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:zy({"textarea-min-rows":`${O}`,"textarea-max-rows":`${T}`}),children:a.jsx("textarea",{...R,onChange:P=>{E==null||E(P),A()},ref:EC([t,C]),id:r||(g?void 0:i),className:Sse.Textarea,name:s,readOnly:h,disabled:f,rows:O,onFocus:P=>{j(!0),b==null||b(P)},onBlur:P=>{j(!1),v==null||v(P)},onAnimationStart:N,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},BD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",uWt="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20100%20100'%3e%3ctitle%3ePandoc%20Icon%3c/title%3e%3cdesc%20property='dc:creator'%3eAlbert%20Krewinkel%3c/desc%3e%3cmetadata%20id='license'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3ccc:license%20rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'%20/%3e%3c/cc:Work%3e%3ccc:License%20rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Reproduction'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Distribution'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Notice'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Attribution'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23DerivativeWorks'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23ShareAlike'%20/%3e%3c/cc:License%3e%3c/rdf:RDF%3e%3c/metadata%3e%3crect%20fill='%23fed'%20stroke='%23fed'%20width='100'%20height='100'/%3e%3cg%20fill='none'%20stroke='%234093da'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='8'%20transform='skewX(-6)%20translate(8%201)'%3e%3cpath%20d='M%2030,10%20l%200,80%20M%2045,10%20l%200,80%20M%2020,10%20l%2040,0%20l%2018,18%20l%200,25%20l%20-33,0'%20/%3e%3cpath%20fill='%234093da'%20stroke-width='6'%20d='M%2061,10%20l%2017,17%20l%20-17,0%20l%200,-17'%20/%3e%3c/g%3e%3c/svg%3e",dWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20100%20100'%20version='1.1'%20id='svg4'%20sodipodi:docname='favicon.svg'%20inkscape:version='1.4.4%20(dcaf3e7,%202026-05-05)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview4'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='true'%20inkscape:zoom='8.2236519'%20inkscape:cx='34.534536'%20inkscape:cy='45.174577'%20inkscape:window-width='1881'%20inkscape:window-height='1382'%20inkscape:window-x='1512'%20inkscape:window-y='30'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg4'%3e%3cinkscape:grid%20type='axonomgrid'%20id='grid4'%20units='px'%20originx='0'%20originy='0'%20spacingx='3.7795276'%20spacingy='3.7795276'%20empcolor='%230099e5'%20empopacity='0.30196078'%20color='%230099e5'%20opacity='0.14901961'%20empspacing='0'%20dotted='false'%20gridanglex='40'%20gridanglez='40'%20enabled='true'%20visible='true'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs1'%3e%3cfilter%20id='shadow'%20x='0'%20y='0'%20width='1'%20height='1'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='3'%20flood-color='rgba(50,%2050,%2093,%200.18)'%20/%3e%3c/filter%3e%3c/defs%3e%3crect%20x='4'%20y='4'%20width='92'%20height='92'%20rx='22.08'%20fill='%23e8efff'%20filter='url(%23shadow)'%20id='rect1'%20transform='matrix(1.0869565,0,0,1.0869565,-4.347826,-4.347826)'%20style='stroke-width:0.92'%20ry='22.08'%20/%3e%3cpath%20style='fill:%230a2540;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,6.535431%204.9573423,44.330708%2049.999999,82.125984%2092.790523,46.220471%2095.042656,44.330708%20Z'%20id='path1'%20/%3e%3cpath%20style='fill:%23425466;fill-opacity:1;stroke-width:1.88976'%20d='M%204.9573423,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20V%2082.125984%20Z'%20id='path2'%20/%3e%3cpath%20style='fill:%231a3550;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,82.125984%2095.042656,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20Z'%20id='path3'%20/%3e%3cpath%20style='fill:%234ade80;stroke:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill-opacity:1'%20d='m%2045.042657,30.236221%209.008531,-7.559055%2022.521328,18.897638%20-9.008531,7.559056%20z'%20id='path5'%20/%3e%3cpath%20style='fill:none;fill-opacity:1;stroke:%234ade80;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1'%20d='M%2027.025594,49.133859%2047.29479,47.244096%2045.042657,64.25197'%20id='path6'%20/%3e%3c/svg%3e",fWt="data:image/svg+xml,%3csvg%20fill='%23261230'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAstral%3c/title%3e%3cpath%20d='M1.44%200C.6422%200%200%20.6422%200%201.44v21.12C0%2023.3578.6422%2024%201.44%2024h21.12c.7978%200%201.44-.6422%201.44-1.44V1.44C24%20.6422%2023.3578%200%2022.56%200Zm4.7998%204.8h11.5199c.7953%200%201.44.6447%201.44%201.44V19.2h-6.624v-4.32h-1.152v4.32H4.8V6.24c0-.7953.6446-1.44%201.4398-1.44m4.032%205.472v1.152h3.456v-1.152z'/%3e%3c/svg%3e",hWt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1.34em'%20height='1em'%20viewBox='0%200%20256%20192'%3e%3cpath%20fill='%232d4552'%20d='M84.38%20108.352c-9.556%202.712-15.826%207.467-19.956%2012.218c3.956-3.461%209.255-6.639%2016.402-8.665c7.311-2.072%2013.548-2.057%2018.702-1.062v-4.03c-4.397-.402-9.437-.082-15.148%201.539M63.987%2074.475l-35.49%209.35s.646.914%201.844%202.133l30.092-7.93s-.427%205.495-4.13%2010.41c7.005-5.299%207.684-13.963%207.684-13.963m29.709%2083.41c-49.946%2013.452-76.37-44.43-84.37-74.472c-3.696-13.868-5.31-24.37-5.74-31.148a11.5%2011.5%200%200%201%20.025-1.84C1.021%2050.58-.22%2051.927.032%2055.82c.43%206.773%202.044%2017.275%205.74%2031.147c7.997%2030.038%2034.424%2087.92%2084.37%2074.468c10.871-2.929%2019.038-8.263%2025.17-15.073c-5.652%205.104-12.724%209.123-21.616%2011.523M103.08%2039.05v3.555h19.59c-.401-1.259-.806-2.393-1.208-3.555z'/%3e%3cpath%20fill='%232d4552'%20d='M127.05%2068.325c8.81%202.503%2013.47%208.68%2015.933%2014.146l9.824%202.79s-1.34-19.132-18.645-24.047c-16.189-4.6-26.151%208.995-27.363%2010.754c4.71-3.355%2011.586-6.102%2020.251-3.643m78.197%2014.234c-16.204-4.62-26.162%209.003-27.356%2010.737c4.713-3.351%2011.586-6.099%2020.247-3.629c8.797%202.506%2013.452%208.676%2015.923%2014.146l9.837%202.8s-1.361-19.135-18.651-24.054m-9.76%2050.443l-81.718-22.845s.885%204.485%204.279%2010.293l68.803%2019.234c5.664-3.277%208.636-6.682%208.636-6.682m-56.655%2049.174C74.127%20164.828%2081.949%2082.386%2092.419%2043.32c4.311-16.1%208.743-28.066%2012.419-36.088c-2.193-.451-4.01.704-5.804%204.354C95.13%2019.5%2090.14%2032.387%2085.312%2050.427c-10.467%2039.066-18.29%20121.506%2046.412%20138.854c30.497%208.17%2054.256-4.247%2071.966-23.749c-16.81%2015.226-38.274%2023.763-64.858%2016.644'/%3e%3cpath%20fill='%23e2574c'%20d='M103.081%20138.565v-16.637l-46.223%2013.108s3.415-19.846%2027.522-26.684c7.311-2.072%2013.549-2.058%2018.701-1.063V39.05h23.145c-2.52-7.787-4.958-13.782-7.006-17.948c-3.387-6.895-6.859-2.324-14.741%204.269c-5.552%204.638-19.583%2014.533-40.698%2020.222c-21.114%205.694-38.185%204.184-45.307%202.95c-10.097-1.742-15.378-3.96-14.884%203.721c.43%206.774%202.043%2017.277%205.74%2031.148c7.996%2030.039%2034.424%2087.92%2084.37%2074.468c13.046-3.515%2022.254-10.464%2028.637-19.32h-19.256zm-74.588-54.74l35.494-9.35s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.812-21.154-7.812'/%3e%3cpath%20fill='%232ead33'%20d='M236.664%2039.84c-9.226%201.617-31.361%203.632-58.716-3.7c-27.363-7.328-45.517-20.144-52.71-26.168c-10.197-8.54-14.682-14.476-19.096-5.498c-3.902%207.918-8.893%2020.805-13.723%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.853c64.687%2017.333%2099.126-57.978%20109.593-97.047c4.83-18.037%206.948-31.695%207.53-40.502c.665-9.976-6.187-7.08-19.29-4.784M106.668%2072.161s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046zm42.215%2071.163c-30.419-8.91-35.11-33.167-35.11-33.167l81.714%2022.846c0-.004-16.494%2019.12-46.604%2010.32m28.89-49.85s10.183-15.847%2027.474-10.918c17.29%204.923%2018.651%2024.054%2018.651%2024.054z'/%3e%3cpath%20fill='%23d65348'%20d='m86.928%20126.51l-30.07%208.522s3.266-18.609%2025.418-25.983L65.25%2045.147l-1.471.447c-21.115%205.694-38.185%204.184-45.307%202.95c-10.097-1.741-15.379-3.96-14.885%203.722c.43%206.774%202.044%2017.276%205.74%2031.147c7.997%2030.039%2034.425%2087.92%2084.37%2074.468l1.471-.462zM28.493%2083.825l35.494-9.351s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.811-21.154-7.811'/%3e%3cpath%20fill='%231d8d22'%20d='m150.255%20143.658l-1.376-.335c-30.419-8.91-35.11-33.166-35.11-33.166l42.137%2011.778l22.308-85.724l-.27-.07c-27.362-7.329-45.516-20.145-52.71-26.17c-10.196-8.54-14.682-14.475-19.096-5.497c-3.898%207.918-8.889%2020.805-13.719%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.852l1.326.3zM106.668%2072.16s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046z'/%3e%3cpath%20fill='%23c04b41'%20d='m88.46%20126.072l-8.064%202.289c1.906%2010.74%205.264%2021.047%2010.534%2030.152c.918-.202%201.828-.376%202.762-.632c2.449-.66%204.72-1.479%206.906-2.371c-5.89-8.74-9.785-18.804-12.137-29.438m-3.148-75.644c-4.144%2015.467-7.852%2037.73-6.831%2060.06c1.826-.793%203.756-1.532%205.9-2.14l1.492-.334c-1.82-23.852%202.114-48.157%206.546-64.694a323%20323%200%200%201%203.373-11.704a105%20105%200%200%201-5.974%203.547a307%20307%200%200%200-4.506%2015.265'/%3e%3c/svg%3e",pWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='512'%20height='512'%20version='1.1'%20viewBox='0%200%20135.47%20135.47'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m67.733%2067.733%2029.33%2016.933-29.33%2050.8c37.408%200%2067.733-30.325%2067.733-67.733%200-12.341-3.3168-23.901-9.0837-33.867h-58.65z'%20fill='%23afccf9'/%3e%3cpath%20d='m67.733-1e-6c-25.07%200-46.942%2013.63-58.654%2033.875l29.324%2050.792%2029.33-16.933v-33.867h58.65c-11.714-20.24-33.583-33.867-58.65-33.867z'%20fill='%231767d1'/%3e%3cpath%20d='m0%2067.733c0%2037.408%2030.324%2067.733%2067.733%2067.733l29.33-50.8-29.33-16.933-29.33%2016.933-29.324-50.792c-5.7637%209.9632-9.0794%2021.519-9.0794%2033.858'%20fill='%23679ef5'/%3e%3cpath%20d='m101.6%2067.733c0%2018.704-15.163%2033.867-33.867%2033.867-18.704%200-33.867-15.163-33.867-33.867s15.163-33.867%2033.867-33.867c18.704%200%2033.867%2015.163%2033.867%2033.867'%20fill='%23fff'/%3e%3cpath%20d='m95.25%2067.733c0%2015.197-12.32%2027.517-27.517%2027.517-15.197%200-27.517-12.32-27.517-27.517%200-15.197%2012.32-27.517%2027.517-27.517%2015.197%200%2027.517%2012.32%2027.517%2027.517'%20fill='%231a74e7'/%3e%3c/svg%3e",mWt="data:image/svg+xml,%3csvg%20fill='%23F03C2E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e",gWt="data:image/svg+xml,%3csvg%20fill='%23073551'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ecurl%3c/title%3e%3cpath%20d='M.803%2014.8169c0-.5342.433-.9665.9665-.9665.5335%200%20.9665.4323.9665.9665%200%20.5335-.433.9657-.9665.9657-.5335%200-.9666-.4322-.9666-.9657m2.736%200c0-.1963-.0532-.376-.1119-.5525-.2344-.7024-.876-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0708C.6149%2013.2865%200%2013.9646%200%2014.817c0%20.9764.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.793%201.7694-1.7694m-1.7694-7.149c.5335%200%20.9665.433.9665.9665%200%20.5335-.433.9665-.9665.9665-.5343%200-.9666-.433-.9666-.9665%200-.5335.4323-.9665.9666-.9665m0%202.7359c.9772%200%201.7694-.7923%201.7694-1.7694%200-.1956-.0532-.376-.1119-.5525-.2344-.7024-.8767-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0716C.6149%207.104%200%207.782%200%208.6344c0%20.9771.7923%201.7694%201.7695%201.7694m13.221-5.694c-.5342%200-.9665-.433-.9665-.9664a.966.966%200%2001.9666-.9665c.5335%200%20.9658.4322.9658.9665%200%20.5334-.4323.9664-.9658.9664m-9.6%2016.5133c-.5335%200-.9666-.433-.9666-.9665%200-.5342.433-.9665.9666-.9665a.966.966%200%2001.9665.9665c0%20.5335-.4323.9665-.9665.9665m9.6-19.2491c-.978%200-1.7695.7922-1.7695%201.7694%200%20.2085.0525.4025.1187.5882L5.039%2018.5581c-.803.1681-1.4179.8462-1.4179%201.6985%200%20.9772.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.7922%201.7694-1.7694%200-.1963-.0525-.3759-.111-.5525l8.3427-14.2728c.7778-.1865%201.3683-.8531%201.3683-1.688%200-.977-.793-1.7693-1.7694-1.7693m7.24%202.7359c-.5343%200-.9666-.433-.9666-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9666.4322.9666.9665%200%20.5334-.433.9665-.9666.9665M12.6313%2021.223c-.5343%200-.9665-.433-.9665-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9658.4323.9658.9665%200%20.5335-.4323.9665-.9658.9665M22.2305%201.974c-.9772%200-1.7694.7922-1.7694%201.7694%200%20.2085.0525.4025.1187.5882l-8.3009%2014.2265c-.8021.1681-1.417.8462-1.417%201.6985%200%20.9772.7922%201.7694%201.7694%201.7694.9764%200%201.7687-.7922%201.7687-1.7694%200-.1963-.0525-.3759-.1111-.5525l8.3427-14.2728C23.4094%205.2448%2024%204.5782%2024%203.7433c0-.977-.7923-1.7693-1.7695-1.7693'/%3e%3c/svg%3e",bWt="data:image/svg+xml,%3csvg%20fill='%23007808'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eFFmpeg%3c/title%3e%3cpath%20d='M21.72%2017.91V6.5l-.53-.49L9.05%2018.52l-1.29-.06L24%201.53l-.33-.95-11.93%201-5.75%206.6v-.23l4.7-5.39-1.38-.77-9.11.77v2.85l1.91.46v.01l.19-.01-.56.66v10.6c.609-.126%201.22-.241%201.83-.36L14.12%205.22l.83-.04L0%2021.44l9.67.82%201.35-.77%206.82-6.74v2.15l-5.72%205.57%2011.26.95.35-.94v-3.16l-3.29-.18c.434-.403.858-.816%201.28-1.23z'/%3e%3c/svg%3e",yWt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%201080%201080'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.3.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.3%20Build%20182)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23ff0;%20}%20.st1%20{%20fill:%20%23333;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M660.52,419.49l-195.15-52.98c-15.84-4.3-19.16-25.29-5.43-34.28l169.23-110.7-9.91-201.97c-.8-16.39,18.13-26.04,30.92-15.76l157.57,126.74,189.03-71.84c15.34-5.83,30.37,9.2,24.54,24.54l-71.84,189.03,126.74,157.57c10.29,12.79.64,31.73-15.76,30.92l-201.97-9.91-110.7,169.23c-8.98,13.73-29.98,10.41-34.28-5.43l-52.98-195.15h-.01Z'/%3e%3cpath%20class='st1'%20d='M603.34,476.66l32.94,121.68,4.45,16.23-429.11,429.11c-48.45,48.45-126.85,48.45-175.3,0C12.16,1019.51,0,987.89,0,956.15s12.02-63.48,36.31-87.77l429.11-429.11,16.35,4.33,121.56,33.06h0Z'/%3e%3c/svg%3e";function VH(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:a.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}sl.registerLanguage("bash",Hz);const vWt=48;function xWt(e,t=vWt){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function wWt(e){return sl.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function OWt({status:e}){return e==="succeeded"?a.jsx(Md,{"aria-hidden":!0}):e==="failed"?a.jsx(Z6,{"aria-hidden":!0}):e==="running"?a.jsx(Ei,{className:"studio-build-progress__spinner","aria-hidden":!0}):a.jsx(Gnt,{"aria-hidden":!0})}function Ese(e,t){if(!e)return"";const n=Date.parse(e);return Number.isNaN(n)?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(n)}function kWt({steps:e,log:t,logError:n="",logTruncated:i=!1,logUpdatedAt:r,loading:s=!1}){const{t:o,i18n:l}=Ae("ui"),c=p.useRef(null),u=p.useRef(!0),[d,f]=p.useState(!1),h=p.useMemo(()=>wWt(t),[t]);p.useEffect(()=>{const g=c.current;g&&t&&u.current&&(g.scrollTop=g.scrollHeight)},[t]);const m=async()=>{try{await navigator.clipboard.writeText(t),f(!0),window.setTimeout(()=>f(!1),1500)}catch{f(!1)}};return a.jsxs("div",{className:"studio-build-progress",children:[a.jsx("ol",{className:"studio-build-progress__steps","aria-label":o("studioBuildProgress.steps"),children:e.map(g=>a.jsxs("li",{className:`is-${g.status}`,children:[a.jsx("span",{className:"studio-build-progress__step-icon",children:a.jsx(OWt,{status:g.status})}),a.jsx("span",{children:g.label})]},g.key))}),a.jsxs("section",{className:"studio-build-progress__log","aria-label":o("studioBuildProgress.log"),children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("strong",{children:o("studioBuildProgress.log")}),a.jsxs("span",{children:[o(s?"studioBuildProgress.syncing":n?"studioBuildProgress.loadFailed":"studioBuildProgress.synced"),i?o("studioBuildProgress.recentOnly"):"",Ese(r,l.resolvedLanguage??l.language)?` · ${Ese(r,l.resolvedLanguage??l.language)}`:""]})]}),a.jsxs(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void m(),"aria-label":o(d?"studioBuildProgress.copiedLog":"studioBuildProgress.copyLog"),children:[d?a.jsx(Md,{"aria-hidden":!0}):a.jsx(JI,{"aria-hidden":!0}),o(d?"studioBuildProgress.copied":"studioBuildProgress.copy")]})]}),t?a.jsx("pre",{ref:c,tabIndex:0,"aria-label":o("studioBuildProgress.logContent"),onScroll:g=>{u.current=xWt(g.currentTarget)},children:a.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:h}})}):a.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||o(s?"studioBuildProgress.waiting":"studioBuildProgress.empty")})]})]})}function Cse({name:e,description:t,icon:n,selected:i,disabled:r=!1,onChange:s,className:o=""}){return a.jsxs("button",{type:"button",className:`studio-package-option${i?" is-selected":""}${o?` ${o}`:""}`,"aria-pressed":i,disabled:r,onClick:()=>s(!i),children:[a.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),a.jsxs("span",{className:"studio-package-option__content",children:[a.jsx("strong",{children:e}),t?a.jsx("span",{children:t}):null]}),a.jsx("span",{className:"studio-package-option__action","aria-hidden":"true",children:i?a.jsx(_nt,{}):a.jsx(Rnt,{})})]})}function sb(e,t){return e[t]|e[t+1]<<8}function q0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function SWt(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function R6e(e,t={}){let i=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(q0(e,u)===101010256){i=u;break}if(i<0)throw new Error(Kt("helpers.zip.invalid"));const r=sb(e,i+10);if(t.maxEntries!==void 0&&r>t.maxEntries)throw new Error(Kt("helpers.zip.tooManyFiles",{count:t.maxEntries}));let s=q0(e,i+16);const o=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error(Kt("helpers.zip.tooLarge"));const x=sb(e,v+26),w=sb(e,v+28),O=v+30+x+w,S=e.subarray(O,O+f);let k;if(d===0)k=S;else if(d===8)k=await SWt(S);else{s+=46+m+g+b;continue}l.push({name:y,text:o.decode(k)}),s+=46+m+g+b}return l}const BB=/(^|\/)skill\.md$/i;function EWt(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let r=1;r=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function EWt(...e){var t;for(const n of e){const i=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(i)return i.slice(0,64)}return"local-skill"}function CWt(e,t){return t.trim()||e}function I6e(e){const t=e.map(i=>({path:i.path.replace(/\\/g,"/").replace(/^\.\//,""),text:i.text})).filter(i=>i.path.length>0&&!i.path.endsWith("/")),n=new Set(t.map(i=>i.path.split("/")[0]));if(n.size===1&&t.every(i=>i.path.includes("/"))){const i=[...n][0]+"/";return t.map(r=>({path:r.path.slice(i.length),text:r.text}))}return t}function TWt(e){const t=new Map,n=new Set;for(const i of e)if(BB.test("/"+i.path)){const r=i.path.split("/");n.add(r.slice(0,-1).join("/"))}for(const i of e){const r=i.path.split("/");let s="";for(let u=r.length-1;u>=0;u--){const d=r.slice(0,u).join("/");if(n.has(d)){s=d;break}}const o=BB.test("/"+i.path);if(!s&&!o&&!n.has("")||!n.has(s)&&!o)continue;const l=s?i.path.slice(s.length+1):i.path,c=t.get(s)||[];c.push({path:l,text:i.text}),t.set(s,c)}return t}function AWt(e,t,n){const i=`${n}${e?"/"+e:""}`,r=t.find(c=>BB.test("/"+c.path));if(!r)return{hit:null,error:Kt("helpers.skills.missingManifest",{location:i})};const s=kWt(r.text),o=EWt(s.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:Kt("helpers.skills.invalidParentPath",{location:i,path:c.path})};const d=`skills/${o}/${c.path}`;if(!d.startsWith(`skills/${o}/`))return{hit:null,error:Kt("helpers.skills.invalidPath",{location:i,path:c.path})};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${o}:${t.length}`,name:CWt(o,s.name),description:s.description||Kt("helpers.skills.localDescription"),folder:o,localFiles:l},error:null}}async function _Wt(e){const t=new Uint8Array(await e.arrayBuffer()),i=(await R6e(t)).map(r=>({path:r.name,text:r.text}));return P6e(I6e(i),e.name)}async function jWt(e,t=new Map){const n=[];for(let i=0;ie.file(t,n))}async function RWt(e){const t=e.createReader(),n=[];for(;;){const i=await new Promise((r,s)=>t.readEntries(r,s));if(i.length===0)return n;n.push(...i)}}async function D6e(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await NWt(e),path:n}];if(!e.isDirectory)return[];const i=await RWt(e);return(await Promise.all(i.map(r=>D6e(r,n)))).flat()}function IWt({selected:e,onChange:t}){const{t:n}=Ae("create"),[i,r]=p.useState([]),[s,o]=p.useState([]),[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=p.useRef(0),h=O=>e.some(S=>S.source==="local"&&S.folder===O),m=O=>{O.localFiles&&(h(O.folder||O.name)?t(e.filter(S=>!(S.source==="local"&&S.folder===(O.folder||O.name)))):t([...e,{source:"local",folder:O.folder||O.name,name:O.name,description:O.description,localFiles:O.localFiles}]))},g=p.useRef([]),b=p.useRef(e);p.useEffect(()=>{g.current=s},[s]),p.useEffect(()=>{b.current=e},[e]);const v=O=>{const S=new Set([...g.current.map(R=>R.folder||R.name),...b.current.filter(R=>R.source==="local").map(R=>R.folder)]),k=[],C=[];for(const R of O.hits){const _=R.folder||R.name;if(S.has(_)){k.push(R.name);continue}S.add(_),C.push(R)}o(R=>[...R,...C]);const E=[...O.errors];if(k.length>0&&E.push(n("skills.local.duplicatesSkipped",{names:k.join(", ")})),r(E),C.length===1&&O.errors.length===0&&k.length===0){const R=C[0];R.localFiles&&t([...b.current,{source:"local",folder:R.folder||R.name,name:R.name,description:R.description,localFiles:R.localFiles}])}},y=O=>{O.preventDefault(),f.current+=1,d(!0)},x=O=>{O.preventDefault(),f.current=Math.max(0,f.current-1),f.current===0&&d(!1)},w=async O=>{if(O.preventDefault(),f.current=0,d(!1),l)return;const S=Array.from(O.dataTransfer.items).map(k=>{var C;return(C=k.webkitGetAsEntry)==null?void 0:C.call(k)}).filter(k=>k!==null);if(S.length===0){r([n("skills.local.invalidDrop")]);return}c(!0);try{const k=(await Promise.all(S.map(R=>D6e(R)))).flat(),C=S.some(R=>R.isDirectory);if(!C&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){v(await _Wt(k[0].file));return}if(!C){r([n("skills.local.invalidDrop")]);return}const E=new Map(k.map(({file:R,path:_})=>[R,_]));v(await jWt(k.map(({file:R})=>R),E))}catch(k){r([n("skills.local.readError",{detail:k instanceof Error?k.message:String(k)})])}finally{c(!1)}};return a.jsxs("div",{className:"cw-local",children:[a.jsxs("div",{className:`cw-local-dropzone ${u?"is-dragging":""}`,role:"group","aria-label":n("skills.local.dropLabel"),onDragEnter:y,onDragOver:O=>O.preventDefault(),onDragLeave:x,onDrop:O=>void w(O),children:[a.jsx(eQ,{className:"cw-local-drop-icon","aria-hidden":!0}),a.jsx("p",{className:"cw-local-drop-hint",children:n("skills.local.dropLabel")})]}),a.jsx("p",{className:"cw-local-hint",children:n("skills.local.hint")}),l&&a.jsx("p",{className:"cw-empty-line",children:n("skills.local.reading")}),i.length>0&&a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:i.join(";")})]}),s.length>0&&a.jsx("div",{className:"cw-skill-results",children:s.map(O=>{var k;const S=h(O.folder||O.name);return a.jsxs("button",{type:"button",className:`cw-skill-result ${S?"is-on":""}`,onClick:()=>m(O),"aria-pressed":S,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:S?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsx("span",{className:"cw-skill-result-name",children:O.name}),O.description&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(O.description)}),a.jsx("span",{className:"cw-skill-result-repo",children:n("skills.local.fileCount",{count:((k=O.localFiles)==null?void 0:k.length)??0})})]})]},O.id)})})]})}const PWt="/harness/skills/findskill";async function DWt(e,t="public"){const n=e.trim(),i=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),r=`${PWt}?${i.toString()}`,s=await fetch(r,{headers:{accept:"application/json"},signal:Ua(void 0,Ba)});if(!s.ok)throw new Error(Kt("helpers.skills.searchFailed",{status:s.status}));return((await s.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function MWt({selected:e,onChange:t}){const{t:n}=Ae("create"),[i,r]=p.useState(""),[s,o]=p.useState([]),[l,c]=p.useState(!1),[u,d]=p.useState(null),[f,h]=p.useState(!1),m=v=>e.some(y=>y.source==="skillhub"&&y.slug===v),g=v=>{v.slug&&(m(v.slug)?t(e.filter(y=>!(y.source==="skillhub"&&y.slug===v.slug))):t([...e,{source:"skillhub",slug:v.slug,name:v.name,folder:v.slug.split("/").pop()||v.name,namespace:v.namespace||"public",description:v.description}]))},b=async v=>{c(!0),d(null),h(!0);try{const y=await DWt(v);o(y)}catch(y){d(y instanceof Error?y.message:n("skills.hub.searchError")),o([])}finally{c(!1)}};return p.useEffect(()=>{const v=i.trim();if(!v){o([]),h(!1),d(null);return}const y=setTimeout(()=>b(v),300);return()=>clearTimeout(y)},[i,n]),a.jsxs("div",{className:"cw-skillhub",children:[a.jsxs("div",{className:"cw-skill-searchrow",children:[a.jsxs("div",{className:"cw-skill-searchbox",children:[a.jsx(vN,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),a.jsx("input",{className:"cw-input cw-skill-input",value:i,placeholder:n("skills.hub.searchPlaceholder"),onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),i.trim()&&b(i))}})]}),a.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>i.trim()&&b(i),disabled:!i.trim()||l,children:[l?a.jsx(Ei,{className:"cw-i cw-spin"}):a.jsx(vN,{className:"cw-i"}),n("skills.hub.search")]})]}),u&&a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:u})]}),l&&s.length===0?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",n("skills.hub.searching")]}):s.length>0?a.jsx("div",{className:"cw-skill-results",children:s.map(v=>{const y=m(v.slug||"");return a.jsxs("button",{type:"button",className:`cw-skill-result ${y?"is-on":""}`,onClick:()=>g(v),"aria-pressed":y,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:y?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsx("span",{className:"cw-skill-result-name",children:v.name}),v.description&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(v.description)}),v.sourceRepo&&a.jsx("span",{className:"cw-skill-result-repo",children:v.sourceRepo})]})]},v.id||v.slug)})}):f&&!u?a.jsx("p",{className:"cw-empty-line",children:n("skills.hub.noResults")}):!f&&a.jsx("p",{className:"cw-empty-line",children:n("skills.hub.hint")})]})}function LWt({selected:e,onChange:t,cloudProvider:n="volcengine"}){const{t:i}=Ae("create"),[r,s]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState(""),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(null);p.useEffect(()=>{let O=!1;return(async()=>{f(!0),b(null);try{const S=await XDe();O||(s(S),S.length>0&&u(S[0].id))}catch(S){O||b(S instanceof Error?S.message:i("skills.space.loadError"))}finally{O||f(!1)}})(),()=>{O=!0}},[i]),p.useEffect(()=>{if(!c){l([]);return}const O=r.find(k=>k.id===c);let S=!1;return(async()=>{m(!0),b(null);try{const k=await YDe(c,O==null?void 0:O.region);S||l(k)}catch(k){S||b(k instanceof Error?k.message:i("skills.space.loadError"))}finally{S||m(!1)}})(),()=>{S=!0}},[c,r,i]);const v=r.find(O=>O.id===c),y=v?NPt(v.id,v.region,n):"",x=(O,S)=>e.some(k=>k.source==="skillspace"&&k.skillId===O&&(k.version||"")===S),w=O=>{if(!v)return;const S=Db(O);if(x(S,O.version))t(e.filter(k=>!(k.source==="skillspace"&&k.skillId===S&&(k.version||"")===O.version)));else{const k=jPt(v,O);t([...e,{source:"skillspace",folder:k.folder||O.skillName,name:k.name,description:k.description,skillSpaceId:k.skillSpaceId,skillSpaceName:k.skillSpaceName,skillSpaceRegion:k.skillSpaceRegion,skillId:k.skillId,version:k.version}])}};return a.jsx("div",{className:"cw-skillspace",children:d?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSpaces")]}):g?a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:g})]}):r.length===0?a.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSpaces")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"cw-skillspace-header",children:[a.jsx("select",{className:"cw-input cw-skillspace-select",value:c,onChange:O=>u(O.target.value),"aria-label":i("skills.space.selectSpace"),children:r.map(O=>a.jsxs("option",{value:O.id,children:[rc(O)||O.id,O.description?` — ${QE(O.description)}`:""]},O.id))}),v&&a.jsxs(a.Fragment,{children:[v.region&&a.jsx("span",{className:"cw-skillspace-region-label",title:v.region,children:If(v.region,n)}),y&&a.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:i("skills.space.openConsole"),"aria-label":i("skills.space.openConsole"),children:a.jsx(my,{className:"cw-i cw-i-sm"})})]})]}),h?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSkills")]}):o.length===0?a.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSkills")}):a.jsx("div",{className:"cw-skill-results",children:o.map(O=>{const S=Db(O),k=x(S,O.version);return a.jsxs("button",{type:"button",className:`cw-skill-result ${k?"is-on":""}`,onClick:()=>w(O),"aria-pressed":k,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:k?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsxs("span",{className:"cw-skill-result-name",children:[O.skillName,O.version&&a.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",O.version]})]}),O.skillDescription&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(O.skillDescription)}),a.jsxs("span",{className:"cw-skill-result-repo",children:[a.jsx(Knt,{className:"cw-i cw-i-sm"})," ",rc(v)||c]})]})]},`${S}/${O.version}`)})})]})})}function M6e({className:e}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),a.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),a.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),a.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function u4(e){return e.source==="runtime"?`runtime:${e.folder}`:e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function $Wt(e){return e.source==="runtime"?"skillSourcePicker.sources.runtime":e.source==="local"?"skillSourcePicker.sources.local":e.source==="skillspace"?"skillSourcePicker.sources.skillspace":"skillSourcePicker.sources.skillhub"}function FWt({skill:e,onRemove:t,disabled:n}){const{t:i}=Ae("ui");let r=BS;e.source==="local"||e.source==="runtime"?r=eQ:e.source==="skillspace"&&(r=M6e);const s=`${i($Wt(e))}${e.description?` · ${QE(e.description)}`:""}`;return a.jsxs(dr.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[a.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":"true",children:a.jsx(r,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-selected-skill-meta",children:[a.jsx("span",{className:"cw-selected-skill-name",children:e.name}),a.jsx("span",{className:"cw-selected-skill-detail",tabIndex:0,title:s,children:s})]}),a.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,disabled:n,"aria-label":i("skillSourcePicker.remove",{name:e.name}),title:i("skillSourcePicker.remove",{name:e.name}),children:a.jsx(xa,{className:"cw-i cw-i-sm"})})]})}const d4=[{id:"local",labelKey:"skillSourcePicker.tabs.local",shortLabelKey:"skillSourcePicker.tabs.localShort",icon:eQ},{id:"skillspace",labelKey:"skillSourcePicker.tabs.skillspace",shortLabelKey:"skillSourcePicker.tabs.skillspaceShort",icon:M6e},{id:"skillhub",labelKey:"skillSourcePicker.tabs.skillhub",shortLabelKey:"skillSourcePicker.tabs.skillhubShort",icon:tP}];function HH({selected:e,onChange:t,cloudProvider:n,disabled:i=!1,addLabel:r,showSelectedCount:s=!0}){const{t:o}=Ae("ui"),[l,c]=p.useState("local"),[u,d]=p.useState(!1),f=p.useId(),h=p.useId(),m=p.useRef(null),g=d4.findIndex(x=>x.id===l),b=r??o("skillSourcePicker.addSkill");p.useEffect(()=>{var S;if(!u)return;const x=document.body.style.overflow,w=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(S=m.current)==null||S.focus();const O=k=>{k.key==="Escape"&&d(!1)};return window.addEventListener("keydown",O),()=>{document.body.style.overflow=x,window.removeEventListener("keydown",O),w!=null&&w.isConnected&&w.focus()}},[u]);const v=(x,w)=>{w.source==="runtime"&&!window.confirm(o("skillSourcePicker.confirmRemoveRuntime",{name:w.name}))||t(e.filter(O=>u4(O)!==x))},y=x=>{const w=new Set(x.filter(O=>O.source!=="runtime").map(O=>O.folder));t(x.filter(O=>O.source!=="runtime"||!w.has(O.folder)))};return a.jsxs("div",{className:"cw-skillspane",children:[a.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",disabled:i,onClick:()=>d(!0),children:[a.jsx("span",{className:"cw-skill-add-icon","aria-hidden":"true",children:a.jsx(Tl,{className:"cw-i"})}),a.jsx("span",{children:b})]}),e.length>0&&a.jsxs("div",{className:"cw-skill-selected",children:[s?a.jsx("span",{className:"cw-skill-selected-label",children:o("skillSourcePicker.selectedCount",{count:e.length})}):null,a.jsx("div",{className:"cw-selected-skill-list",children:a.jsx(Ed,{initial:!1,children:e.map(x=>a.jsx(FWt,{skill:x,disabled:i,onRemove:()=>v(u4(x),x)},u4(x)))})})]}),ri.createPortal(a.jsx(Ed,{children:u&&a.jsx(dr.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:x=>{x.target===x.currentTarget&&d(!1)},children:a.jsxs(dr.section,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":f,initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[a.jsxs("header",{className:"cw-skill-dialog-head",children:[a.jsx("h3",{id:f,children:b}),a.jsx("button",{ref:m,type:"button",className:"cw-skill-dialog-close","aria-label":o("skillSourcePicker.close",{label:b}),onClick:()=>d(!1),children:a.jsx(xa,{className:"cw-i"})})]}),a.jsxs("div",{className:"cw-skill-dialog-body",children:[a.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${d4.length})`,"--cw-active-skill-tab-offset":`calc(${g*100}% + ${g*4}px)`},children:[a.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":"true"}),d4.map(({id:x,labelKey:w,shortLabelKey:O,icon:S})=>a.jsxs("button",{type:"button",role:"tab",id:`${h}-${x}`,"aria-controls":h,"aria-selected":l===x,className:`cw-skill-pickertab ${l===x?"is-on":""}`,onClick:()=>c(x),children:[a.jsx(S,{className:"cw-i cw-i-sm"}),a.jsx("span",{className:"cw-skill-tab-label-full",children:o(w)}),a.jsx("span",{className:"cw-skill-tab-label-short",children:o(O)})]},x))]}),a.jsxs("div",{id:h,className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`${h}-${l}`,children:[l==="skillhub"&&a.jsx(MWt,{selected:e,onChange:y}),l==="local"&&a.jsx(IWt,{selected:e,onChange:y}),l==="skillspace"&&a.jsx(LWt,{selected:e,onChange:y,cloudProvider:n})]})]})]})})}),document.body)]})}const L6e=128*1024,BWt={baseImageRequired:"请填写基础镜像。",duplicateFrom:"基础镜像已固定在第一行,请删除 Dockerfile 正文中的 FROM 指令。",tooLarge:"Dockerfile 不能超过 128 KiB。",empty:"Dockerfile 内容不能为空。",missingFrom:"Dockerfile 缺少 FROM 指令。"};function Sx(e,t){return(t==null?void 0:t(`environmentCenter.dockerfileValidation.${e}`))??BWt[e]}function UD(e){return e.replace(/^\uFEFF/,"").replace(/\r\n?/g,` -`)}function $6e(e){return new TextEncoder().encode(e).byteLength}function UWt(e,t="ubuntu:22.04"){const n=UD(e).match(/^\s*FROM(?:\s+--platform=\S+)?\s+(\S+)/im);return(n==null?void 0:n[1])??t}function QWt(e){const t=UD(e).split(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let r=1;r=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function TWt(...e){var t;for(const n of e){const i=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(i)return i.slice(0,64)}return"local-skill"}function AWt(e,t){return t.trim()||e}function I6e(e){const t=e.map(i=>({path:i.path.replace(/\\/g,"/").replace(/^\.\//,""),text:i.text})).filter(i=>i.path.length>0&&!i.path.endsWith("/")),n=new Set(t.map(i=>i.path.split("/")[0]));if(n.size===1&&t.every(i=>i.path.includes("/"))){const i=[...n][0]+"/";return t.map(r=>({path:r.path.slice(i.length),text:r.text}))}return t}function _Wt(e){const t=new Map,n=new Set;for(const i of e)if(BB.test("/"+i.path)){const r=i.path.split("/");n.add(r.slice(0,-1).join("/"))}for(const i of e){const r=i.path.split("/");let s="";for(let u=r.length-1;u>=0;u--){const d=r.slice(0,u).join("/");if(n.has(d)){s=d;break}}const o=BB.test("/"+i.path);if(!s&&!o&&!n.has("")||!n.has(s)&&!o)continue;const l=s?i.path.slice(s.length+1):i.path,c=t.get(s)||[];c.push({path:l,text:i.text}),t.set(s,c)}return t}function jWt(e,t,n){const i=`${n}${e?"/"+e:""}`,r=t.find(c=>BB.test("/"+c.path));if(!r)return{hit:null,error:Kt("helpers.skills.missingManifest",{location:i})};const s=EWt(r.text),o=TWt(s.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:Kt("helpers.skills.invalidParentPath",{location:i,path:c.path})};const d=`skills/${o}/${c.path}`;if(!d.startsWith(`skills/${o}/`))return{hit:null,error:Kt("helpers.skills.invalidPath",{location:i,path:c.path})};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${o}:${t.length}`,name:AWt(o,s.name),description:s.description||Kt("helpers.skills.localDescription"),folder:o,localFiles:l},error:null}}async function NWt(e){const t=new Uint8Array(await e.arrayBuffer()),i=(await R6e(t)).map(r=>({path:r.name,text:r.text}));return P6e(I6e(i),e.name)}async function RWt(e,t=new Map){const n=[];for(let i=0;ie.file(t,n))}async function PWt(e){const t=e.createReader(),n=[];for(;;){const i=await new Promise((r,s)=>t.readEntries(r,s));if(i.length===0)return n;n.push(...i)}}async function D6e(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await IWt(e),path:n}];if(!e.isDirectory)return[];const i=await PWt(e);return(await Promise.all(i.map(r=>D6e(r,n)))).flat()}function DWt({selected:e,onChange:t}){const{t:n}=Ae("create"),[i,r]=p.useState([]),[s,o]=p.useState([]),[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=p.useRef(0),h=O=>e.some(S=>S.source==="local"&&S.folder===O),m=O=>{O.localFiles&&(h(O.folder||O.name)?t(e.filter(S=>!(S.source==="local"&&S.folder===(O.folder||O.name)))):t([...e,{source:"local",folder:O.folder||O.name,name:O.name,description:O.description,localFiles:O.localFiles}]))},g=p.useRef([]),b=p.useRef(e);p.useEffect(()=>{g.current=s},[s]),p.useEffect(()=>{b.current=e},[e]);const v=O=>{const S=new Set([...g.current.map(R=>R.folder||R.name),...b.current.filter(R=>R.source==="local").map(R=>R.folder)]),k=[],C=[];for(const R of O.hits){const _=R.folder||R.name;if(S.has(_)){k.push(R.name);continue}S.add(_),C.push(R)}o(R=>[...R,...C]);const E=[...O.errors];if(k.length>0&&E.push(n("skills.local.duplicatesSkipped",{names:k.join(", ")})),r(E),C.length===1&&O.errors.length===0&&k.length===0){const R=C[0];R.localFiles&&t([...b.current,{source:"local",folder:R.folder||R.name,name:R.name,description:R.description,localFiles:R.localFiles}])}},y=O=>{O.preventDefault(),f.current+=1,d(!0)},x=O=>{O.preventDefault(),f.current=Math.max(0,f.current-1),f.current===0&&d(!1)},w=async O=>{if(O.preventDefault(),f.current=0,d(!1),l)return;const S=Array.from(O.dataTransfer.items).map(k=>{var C;return(C=k.webkitGetAsEntry)==null?void 0:C.call(k)}).filter(k=>k!==null);if(S.length===0){r([n("skills.local.invalidDrop")]);return}c(!0);try{const k=(await Promise.all(S.map(R=>D6e(R)))).flat(),C=S.some(R=>R.isDirectory);if(!C&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){v(await NWt(k[0].file));return}if(!C){r([n("skills.local.invalidDrop")]);return}const E=new Map(k.map(({file:R,path:_})=>[R,_]));v(await RWt(k.map(({file:R})=>R),E))}catch(k){r([n("skills.local.readError",{detail:k instanceof Error?k.message:String(k)})])}finally{c(!1)}};return a.jsxs("div",{className:"cw-local",children:[a.jsxs("div",{className:`cw-local-dropzone ${u?"is-dragging":""}`,role:"group","aria-label":n("skills.local.dropLabel"),onDragEnter:y,onDragOver:O=>O.preventDefault(),onDragLeave:x,onDrop:O=>void w(O),children:[a.jsx(eQ,{className:"cw-local-drop-icon","aria-hidden":!0}),a.jsx("p",{className:"cw-local-drop-hint",children:n("skills.local.dropLabel")})]}),a.jsx("p",{className:"cw-local-hint",children:n("skills.local.hint")}),l&&a.jsx("p",{className:"cw-empty-line",children:n("skills.local.reading")}),i.length>0&&a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:i.join(";")})]}),s.length>0&&a.jsx("div",{className:"cw-skill-results",children:s.map(O=>{var k;const S=h(O.folder||O.name);return a.jsxs("button",{type:"button",className:`cw-skill-result ${S?"is-on":""}`,onClick:()=>m(O),"aria-pressed":S,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:S?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsx("span",{className:"cw-skill-result-name",children:O.name}),O.description&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(O.description)}),a.jsx("span",{className:"cw-skill-result-repo",children:n("skills.local.fileCount",{count:((k=O.localFiles)==null?void 0:k.length)??0})})]})]},O.id)})})]})}const MWt="/harness/skills/findskill";async function LWt(e,t="public"){const n=e.trim(),i=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),r=`${MWt}?${i.toString()}`,s=await fetch(r,{headers:{accept:"application/json"},signal:Ua(void 0,Ba)});if(!s.ok)throw new Error(Kt("helpers.skills.searchFailed",{status:s.status}));return((await s.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function $Wt({selected:e,onChange:t}){const{t:n}=Ae("create"),[i,r]=p.useState(""),[s,o]=p.useState([]),[l,c]=p.useState(!1),[u,d]=p.useState(null),[f,h]=p.useState(!1),m=v=>e.some(y=>y.source==="skillhub"&&y.slug===v),g=v=>{v.slug&&(m(v.slug)?t(e.filter(y=>!(y.source==="skillhub"&&y.slug===v.slug))):t([...e,{source:"skillhub",slug:v.slug,name:v.name,folder:v.slug.split("/").pop()||v.name,namespace:v.namespace||"public",description:v.description}]))},b=async v=>{c(!0),d(null),h(!0);try{const y=await LWt(v);o(y)}catch(y){d(y instanceof Error?y.message:n("skills.hub.searchError")),o([])}finally{c(!1)}};return p.useEffect(()=>{const v=i.trim();if(!v){o([]),h(!1),d(null);return}const y=setTimeout(()=>b(v),300);return()=>clearTimeout(y)},[i,n]),a.jsxs("div",{className:"cw-skillhub",children:[a.jsxs("div",{className:"cw-skill-searchrow",children:[a.jsxs("div",{className:"cw-skill-searchbox",children:[a.jsx(vN,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),a.jsx("input",{className:"cw-input cw-skill-input",value:i,placeholder:n("skills.hub.searchPlaceholder"),onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),i.trim()&&b(i))}})]}),a.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>i.trim()&&b(i),disabled:!i.trim()||l,children:[l?a.jsx(Ei,{className:"cw-i cw-spin"}):a.jsx(vN,{className:"cw-i"}),n("skills.hub.search")]})]}),u&&a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:u})]}),l&&s.length===0?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",n("skills.hub.searching")]}):s.length>0?a.jsx("div",{className:"cw-skill-results",children:s.map(v=>{const y=m(v.slug||"");return a.jsxs("button",{type:"button",className:`cw-skill-result ${y?"is-on":""}`,onClick:()=>g(v),"aria-pressed":y,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:y?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsx("span",{className:"cw-skill-result-name",children:v.name}),v.description&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(v.description)}),v.sourceRepo&&a.jsx("span",{className:"cw-skill-result-repo",children:v.sourceRepo})]})]},v.id||v.slug)})}):f&&!u?a.jsx("p",{className:"cw-empty-line",children:n("skills.hub.noResults")}):!f&&a.jsx("p",{className:"cw-empty-line",children:n("skills.hub.hint")})]})}function FWt({selected:e,onChange:t,cloudProvider:n="volcengine"}){const{t:i}=Ae("create"),[r,s]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState(""),[d,f]=p.useState(!0),[h,m]=p.useState(!1),[g,b]=p.useState(null);p.useEffect(()=>{let O=!1;return(async()=>{f(!0),b(null);try{const S=await XDe();O||(s(S),S.length>0&&u(S[0].id))}catch(S){O||b(S instanceof Error?S.message:i("skills.space.loadError"))}finally{O||f(!1)}})(),()=>{O=!0}},[i]),p.useEffect(()=>{if(!c){l([]);return}const O=r.find(k=>k.id===c);let S=!1;return(async()=>{m(!0),b(null);try{const k=await YDe(c,O==null?void 0:O.region);S||l(k)}catch(k){S||b(k instanceof Error?k.message:i("skills.space.loadError"))}finally{S||m(!1)}})(),()=>{S=!0}},[c,r,i]);const v=r.find(O=>O.id===c),y=v?IPt(v.id,v.region,n):"",x=(O,S)=>e.some(k=>k.source==="skillspace"&&k.skillId===O&&(k.version||"")===S),w=O=>{if(!v)return;const S=Db(O);if(x(S,O.version))t(e.filter(k=>!(k.source==="skillspace"&&k.skillId===S&&(k.version||"")===O.version)));else{const k=RPt(v,O);t([...e,{source:"skillspace",folder:k.folder||O.skillName,name:k.name,description:k.description,skillSpaceId:k.skillSpaceId,skillSpaceName:k.skillSpaceName,skillSpaceRegion:k.skillSpaceRegion,skillId:k.skillId,version:k.version}])}};return a.jsx("div",{className:"cw-skillspace",children:d?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSpaces")]}):g?a.jsxs("div",{className:"cw-banner",children:[a.jsx(Uf,{className:"cw-i"}),a.jsx("span",{children:g})]}):r.length===0?a.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSpaces")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"cw-skillspace-header",children:[a.jsx("select",{className:"cw-input cw-skillspace-select",value:c,onChange:O=>u(O.target.value),"aria-label":i("skills.space.selectSpace"),children:r.map(O=>a.jsxs("option",{value:O.id,children:[rc(O)||O.id,O.description?` — ${QE(O.description)}`:""]},O.id))}),v&&a.jsxs(a.Fragment,{children:[v.region&&a.jsx("span",{className:"cw-skillspace-region-label",title:v.region,children:If(v.region,n)}),y&&a.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:i("skills.space.openConsole"),"aria-label":i("skills.space.openConsole"),children:a.jsx(my,{className:"cw-i cw-i-sm"})})]})]}),h?a.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[a.jsx(Ei,{className:"cw-i cw-spin"})," ",i("skills.space.loadingSkills")]}):o.length===0?a.jsx("p",{className:"cw-empty-line",children:i("skills.space.noSkills")}):a.jsx("div",{className:"cw-skill-results",children:o.map(O=>{const S=Db(O),k=x(S,O.version);return a.jsxs("button",{type:"button",className:`cw-skill-result ${k?"is-on":""}`,onClick:()=>w(O),"aria-pressed":k,children:[a.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:k?a.jsx(Md,{className:"cw-i cw-i-sm"}):a.jsx(Tl,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-skill-result-meta",children:[a.jsxs("span",{className:"cw-skill-result-name",children:[O.skillName,O.version&&a.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",O.version]})]}),O.skillDescription&&a.jsx("span",{className:"cw-skill-result-desc",children:QE(O.skillDescription)}),a.jsxs("span",{className:"cw-skill-result-repo",children:[a.jsx(Xnt,{className:"cw-i cw-i-sm"})," ",rc(v)||c]})]})]},`${S}/${O.version}`)})})]})})}function M6e({className:e}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),a.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),a.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),a.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function u4(e){return e.source==="runtime"?`runtime:${e.folder}`:e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function BWt(e){return e.source==="runtime"?"skillSourcePicker.sources.runtime":e.source==="local"?"skillSourcePicker.sources.local":e.source==="skillspace"?"skillSourcePicker.sources.skillspace":"skillSourcePicker.sources.skillhub"}function UWt({skill:e,onRemove:t,disabled:n}){const{t:i}=Ae("ui");let r=BS;e.source==="local"||e.source==="runtime"?r=eQ:e.source==="skillspace"&&(r=M6e);const s=`${i(BWt(e))}${e.description?` · ${QE(e.description)}`:""}`;return a.jsxs(dr.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[a.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":"true",children:a.jsx(r,{className:"cw-i cw-i-sm"})}),a.jsxs("span",{className:"cw-selected-skill-meta",children:[a.jsx("span",{className:"cw-selected-skill-name",children:e.name}),a.jsx("span",{className:"cw-selected-skill-detail",tabIndex:0,title:s,children:s})]}),a.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,disabled:n,"aria-label":i("skillSourcePicker.remove",{name:e.name}),title:i("skillSourcePicker.remove",{name:e.name}),children:a.jsx(xa,{className:"cw-i cw-i-sm"})})]})}const d4=[{id:"local",labelKey:"skillSourcePicker.tabs.local",shortLabelKey:"skillSourcePicker.tabs.localShort",icon:eQ},{id:"skillspace",labelKey:"skillSourcePicker.tabs.skillspace",shortLabelKey:"skillSourcePicker.tabs.skillspaceShort",icon:M6e},{id:"skillhub",labelKey:"skillSourcePicker.tabs.skillhub",shortLabelKey:"skillSourcePicker.tabs.skillhubShort",icon:tP}];function HH({selected:e,onChange:t,cloudProvider:n,disabled:i=!1,addLabel:r,showSelectedCount:s=!0}){const{t:o}=Ae("ui"),[l,c]=p.useState("local"),[u,d]=p.useState(!1),f=p.useId(),h=p.useId(),m=p.useRef(null),g=d4.findIndex(x=>x.id===l),b=r??o("skillSourcePicker.addSkill");p.useEffect(()=>{var S;if(!u)return;const x=document.body.style.overflow,w=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(S=m.current)==null||S.focus();const O=k=>{k.key==="Escape"&&d(!1)};return window.addEventListener("keydown",O),()=>{document.body.style.overflow=x,window.removeEventListener("keydown",O),w!=null&&w.isConnected&&w.focus()}},[u]);const v=(x,w)=>{w.source==="runtime"&&!window.confirm(o("skillSourcePicker.confirmRemoveRuntime",{name:w.name}))||t(e.filter(O=>u4(O)!==x))},y=x=>{const w=new Set(x.filter(O=>O.source!=="runtime").map(O=>O.folder));t(x.filter(O=>O.source!=="runtime"||!w.has(O.folder)))};return a.jsxs("div",{className:"cw-skillspane",children:[a.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",disabled:i,onClick:()=>d(!0),children:[a.jsx("span",{className:"cw-skill-add-icon","aria-hidden":"true",children:a.jsx(Tl,{className:"cw-i"})}),a.jsx("span",{children:b})]}),e.length>0&&a.jsxs("div",{className:"cw-skill-selected",children:[s?a.jsx("span",{className:"cw-skill-selected-label",children:o("skillSourcePicker.selectedCount",{count:e.length})}):null,a.jsx("div",{className:"cw-selected-skill-list",children:a.jsx(Ed,{initial:!1,children:e.map(x=>a.jsx(UWt,{skill:x,disabled:i,onRemove:()=>v(u4(x),x)},u4(x)))})})]}),ri.createPortal(a.jsx(Ed,{children:u&&a.jsx(dr.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:x=>{x.target===x.currentTarget&&d(!1)},children:a.jsxs(dr.section,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":f,initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[a.jsxs("header",{className:"cw-skill-dialog-head",children:[a.jsx("h3",{id:f,children:b}),a.jsx("button",{ref:m,type:"button",className:"cw-skill-dialog-close","aria-label":o("skillSourcePicker.close",{label:b}),onClick:()=>d(!1),children:a.jsx(xa,{className:"cw-i"})})]}),a.jsxs("div",{className:"cw-skill-dialog-body",children:[a.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${d4.length})`,"--cw-active-skill-tab-offset":`calc(${g*100}% + ${g*4}px)`},children:[a.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":"true"}),d4.map(({id:x,labelKey:w,shortLabelKey:O,icon:S})=>a.jsxs("button",{type:"button",role:"tab",id:`${h}-${x}`,"aria-controls":h,"aria-selected":l===x,className:`cw-skill-pickertab ${l===x?"is-on":""}`,onClick:()=>c(x),children:[a.jsx(S,{className:"cw-i cw-i-sm"}),a.jsx("span",{className:"cw-skill-tab-label-full",children:o(w)}),a.jsx("span",{className:"cw-skill-tab-label-short",children:o(O)})]},x))]}),a.jsxs("div",{id:h,className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`${h}-${l}`,children:[l==="skillhub"&&a.jsx($Wt,{selected:e,onChange:y}),l==="local"&&a.jsx(DWt,{selected:e,onChange:y}),l==="skillspace"&&a.jsx(FWt,{selected:e,onChange:y,cloudProvider:n})]})]})]})})}),document.body)]})}const L6e=128*1024,QWt={baseImageRequired:"请填写基础镜像。",duplicateFrom:"基础镜像已固定在第一行,请删除 Dockerfile 正文中的 FROM 指令。",tooLarge:"Dockerfile 不能超过 128 KiB。",empty:"Dockerfile 内容不能为空。",missingFrom:"Dockerfile 缺少 FROM 指令。"};function Sx(e,t){return(t==null?void 0:t(`environmentCenter.dockerfileValidation.${e}`))??QWt[e]}function UD(e){return e.replace(/^\uFEFF/,"").replace(/\r\n?/g,` +`)}function $6e(e){return new TextEncoder().encode(e).byteLength}function zWt(e,t="ubuntu:22.04"){const n=UD(e).match(/^\s*FROM(?:\s+--platform=\S+)?\s+(\S+)/im);return(n==null?void 0:n[1])??t}function VWt(e){const t=UD(e).split(` `),n=t.findIndex(i=>/^\s*FROM(?:\s|$)/i.test(i));return(n>=0?t.slice(n+1):t).join(` `).replace(/^\n+/,"")}function gj(e,t){const n=`FROM ${e.trim()}`,i=UD(t).replace(/^\n+/,"");return i?`${n} -${i}`:n}function zWt(e,t,n){return t.trim()?/^\s*FROM(?:\s|$)/im.test(e)?Sx("duplicateFrom",n):qH(gj(t,e),void 0,n):Sx("baseImageRequired",n)}function qH(e,t=$6e(e),n){return t>L6e?Sx("tooLarge",n):e.trim()?/^\s*FROM\s+\S+/im.test(e)?"":Sx("missingFrom",n):Sx("empty",n)}async function VWt(e,t){if(e.size>L6e)return{content:"",error:Sx("tooLarge",t)};const n=UD(await e.text());return{content:n,error:qH(n,e.size,t)}}function HWt(e){return uD(e,{lineWidth:0})}function qWt(e){return[{value:"auto",label:e("deploymentResources.mode.auto"),description:e("deploymentResources.mode.autoDescription"),badge:e("deploymentResources.mode.recommended")},{value:"create",label:e("deploymentResources.mode.create"),description:e("deploymentResources.mode.createDescription")},{value:"existing",label:e("deploymentResources.mode.existing"),description:e("deploymentResources.mode.existingDescription")}]}const F6e={tos:{mode:"auto"},cr:{mode:"auto"},codePipeline:{mode:"auto"}};function Th(e){const[t,n]=p.useState([]),[i,r]=p.useState(""),[s,o]=p.useState(1),[l,c]=p.useState(0),[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,g]=p.useState(null),[b,v]=p.useState(""),[y,x]=p.useState(""),[w,O]=p.useState(""),[S,k]=p.useState(0),C=p.useRef(!1),E=p.useRef(null),R=e?JSON.stringify(e):"",_=e?JSON.stringify({...e,search:y}):"";p.useEffect(()=>{const P=window.setTimeout(()=>{x(b.trim())},250);return()=>window.clearTimeout(P)},[b]),p.useEffect(()=>{v(""),x("")},[R]);const j=p.useCallback((P,D)=>{var U;if(!_)return;(U=E.current)==null||U.abort();const M=new AbortController;E.current=M;const L=JSON.parse(_);D&&n([]),C.current=!0,h(!0),g(null),kEe({...L,pageNumber:P,pageSize:100},M.signal).then(I=>{n(H=>{if(D)return I.items;const K=new Set(H.map(F=>`${F.id}\0${F.name}`));return[...H,...I.items.filter(F=>!K.has(`${F.id}\0${F.name}`))]}),r(I.serviceRegion),o(I.pageNumber),c(I.totalCount),d(I.hasMore),O(_)}).catch(I=>{I instanceof DOMException&&I.name==="AbortError"||(O(_),g(I instanceof Error?I.message:String(I)))}).finally(()=>{E.current===M&&(E.current=null,C.current=!1,h(!1))})},[_]);p.useEffect(()=>{var P;if(!_){(P=E.current)==null||P.abort(),E.current=null,C.current=!1,n([]),r(""),o(1),c(0),d(!1),O(""),h(!1),g(null);return}return j(1,!0),()=>{var D;return(D=E.current)==null?void 0:D.abort()}},[j,_,S]);const T=!!_&&w===_&&b.trim()===y,N=p.useCallback(()=>{O(""),k(P=>P+1)},[]),A=p.useCallback(()=>{!T||C.current||!u||j(s+1,!1)},[u,j,s,T]);return{items:t,serviceRegion:i,totalCount:l,hasMore:T?u:!1,loading:!!_&&(!T||f),error:m,search:b,setSearch:v,reload:N,loadMore:A}}function WWt(e,t){return e.map(n=>({value:n[t],label:n.name,description:[n.status,n.region,n.id].filter(Boolean).join(" · ")}))}function Ah({ariaLabel:e,value:t,valueLabel:n,state:i,disabled:r,disabledMessage:s,valueField:o="id",onChange:l}){const{t:c}=Ae("ui"),u=p.useMemo(()=>WWt(i.items,o),[i.items,o]);return a.jsxs("div",{className:"pp-resource-picker",children:[a.jsx(Ag,{ariaLabel:e,value:t,valueLabel:n,placeholder:i.loading?c("common.loading"):c("deploymentResources.selectExisting"),options:u,disabled:r||!!i.error,searchValue:i.search,searchPlaceholder:c("deploymentResources.searchResource"),loading:i.loading,hasMore:i.hasMore,emptyMessage:i.search.trim()?c("deploymentResources.noMatch"):c("deploymentResources.noAvailable"),onSearchChange:i.setSearch,onLoadMore:i.loadMore,onChange:d=>{const f=i.items.find(h=>h[o]===d);f&&l(f)}}),s?a.jsx("span",{className:"pp-resource-status",children:s}):i.error?a.jsxs("div",{className:"pp-resource-error",role:"alert",children:[a.jsx("span",{children:i.error}),a.jsx("button",{type:"button",onClick:i.reload,children:c("common.retry")})]}):i.loading&&i.items.length===0?a.jsx("span",{className:"pp-resource-status","aria-live":"polite",children:i.search.trim()?c("deploymentResources.searching"):c("deploymentResources.loading")}):i.items.length===0?a.jsx("span",{className:"pp-resource-status",children:i.search.trim()?c("deploymentResources.noMatchSentence"):c("deploymentResources.noAvailableSentence")}):i.serviceRegion?a.jsx("span",{className:"pp-resource-status",children:c("deploymentResources.loadedSummary",{region:i.serviceRegion,loaded:i.items.length,total:i.totalCount>0?`/${i.totalCount}`:""})}):null]})}function B6e({region:e,value:t,disabled:n=!1,onChange:i}){const{t:r}=Ae("ui"),s=Th(e?{kind:"cr-registry",region:e}:null),o=Th(e&&(t!=null&&t.registry)?{kind:"cr-namespace",region:e,registry:t.registry}:null),l=Th(e&&(t!=null&&t.registry)&&t.namespace?{kind:"cr-repository",region:e,registry:t.registry,namespace:t.namespace}:null),c=t??{region:e,registry:"",namespace:"",repository:""};return a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three environment-repository-fields",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.registryInstance")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.registryAriaLabel"),value:c.registry,valueLabel:c.registry,state:s,disabled:n||!e,valueField:"name",onChange:u=>i({region:e,registry:u.name,namespace:"",repository:""})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.namespace")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.namespaceAriaLabel"),value:c.namespace,valueLabel:c.namespace,state:o,disabled:n||!c.registry,disabledMessage:c.registry?void 0:r("deploymentResources.selectRegistryFirst"),valueField:"name",onChange:u=>i({...c,region:e,namespace:u.name,repository:""})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.repository")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.existingRepository"),value:c.repository,valueLabel:c.repository,state:l,disabled:n||!c.registry||!c.namespace,disabledMessage:c.registry?c.namespace?void 0:r("deploymentResources.selectNamespaceFirst"):r("deploymentResources.selectRegistryFirst"),valueField:"name",onChange:u=>i({...c,region:e,repository:u.name})})]})]})}function f4({resource:e,value:t,disabled:n,onChange:i}){const{t:r}=Ae("ui");return a.jsxs("label",{className:"pp-resource-field pp-resource-mode",children:[a.jsx("span",{children:r("deploymentResources.configurationMode")}),a.jsx(Ag,{ariaLabel:r("deploymentResources.configurationModeAriaLabel",{resource:e}),value:t,placeholder:r("deploymentResources.selectConfigurationMode"),options:qWt(r),disabled:n,onChange:s=>i(s)})]})}function W0({label:e,value:t,placeholder:n,disabled:i,onChange:r}){return a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:e}),a.jsx("input",{value:t,placeholder:n,disabled:i,autoComplete:"off",onChange:s=>r(s.currentTarget.value)})]})}function h4({items:e,note:t}){const{t:n}=Ae("ui");return a.jsxs("div",{className:"pp-resource-auto-names",children:[a.jsx("span",{children:n("deploymentResources.automaticNames")}),a.jsx("dl",{children:e.map(i=>a.jsxs("div",{children:[a.jsx("dt",{children:i.label}),a.jsx("dd",{title:i.name,children:i.name})]},i.label))}),t&&a.jsx("small",{children:t})]})}function U6e(e){var t,n,i,r,s,o,l,c;return e.tos.mode!=="auto"&&!((t=e.tos.bucket)!=null&&t.trim())?mn.t("ui:deploymentResources.validation.tos"):e.cr.mode!=="auto"&&(!((n=e.cr.instance)!=null&&n.trim())||!((i=e.cr.namespace)!=null&&i.trim())||!((r=e.cr.repository)!=null&&r.trim()))?mn.t("ui:deploymentResources.validation.cr"):e.codePipeline.mode!=="auto"&&(!((s=e.codePipeline.workspaceName)!=null&&s.trim())||!((o=e.codePipeline.pipelineName)!=null&&o.trim()))?mn.t("ui:deploymentResources.validation.codePipeline"):e.codePipeline.mode==="existing"&&(!((l=e.codePipeline.workspaceId)!=null&&l.trim())||!((c=e.codePipeline.pipelineId)!=null&&c.trim()))?mn.t("ui:deploymentResources.validation.existingCodePipeline"):null}function Q6e({value:e,agentName:t,runtimeName:n,region:i,disabled:r,validationError:s,onChange:o}){const{t:l}=Ae("ui"),c=t.trim()||"agentkit-app",u=n.trim()||c,d=i&&i!=="cn-beijing"?l("deploymentResources.autoBucketWithRegion",{region:i.startsWith("cn-")?i.slice(3):i}):l("deploymentResources.autoBucket"),f=Th(e.tos.mode==="existing"?{kind:"tos-bucket",region:i}:null),h=Th(e.cr.mode==="existing"?{kind:"cr-registry",region:i}:null),m=Th(e.cr.mode==="existing"&&e.cr.instance?{kind:"cr-namespace",region:i,registry:e.cr.instance}:null),g=Th(e.cr.mode==="existing"&&e.cr.instance&&e.cr.namespace?{kind:"cr-repository",region:i,registry:e.cr.instance,namespace:e.cr.namespace}:null),b=Th(e.codePipeline.mode==="existing"?{kind:"cp-workspace",region:i}:null),v=Th(e.codePipeline.mode==="existing"&&e.codePipeline.workspaceId?{kind:"cp-pipeline",region:i,workspaceId:e.codePipeline.workspaceId}:null),y=x=>o({...e,...x});return a.jsxs("div",{className:"pp-resource-list",children:[a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:l("deploymentResources.tosBucket")}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:l("deploymentResources.tosBucket"),value:e.tos.mode,disabled:r,onChange:x=>y({tos:{mode:x}})}),e.tos.mode==="create"&&a.jsx(W0,{label:l("deploymentResources.bucketName"),value:e.tos.bucket??"",placeholder:l("deploymentResources.bucketNamePlaceholder"),disabled:r,onChange:x=>y({tos:{...e.tos,bucket:x}})}),e.tos.mode==="existing"&&a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.existingBucket")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingTosBucket"),value:e.tos.bucket??"",valueLabel:e.tos.bucket,state:f,disabled:r,onChange:x=>y({tos:{...e.tos,bucket:x.name}})})]}),e.tos.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.bucket"),name:d}],note:l("deploymentResources.accountIdResolved")})]})]}),a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:l("deploymentResources.containerRegistry")}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:"CR",value:e.cr.mode,disabled:r,onChange:x=>y({cr:{mode:x}})}),e.cr.mode==="create"&&a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[a.jsx(W0,{label:l("deploymentResources.instanceName"),value:e.cr.instance??"",placeholder:l("deploymentResources.crInstance"),disabled:r,onChange:x=>y({cr:{...e.cr,instance:x}})}),a.jsx(W0,{label:l("deploymentResources.namespace"),value:e.cr.namespace??"",placeholder:l("deploymentResources.namespace"),disabled:r,onChange:x=>y({cr:{...e.cr,namespace:x}})}),a.jsx(W0,{label:l("deploymentResources.repository"),value:e.cr.repository??"",placeholder:l("deploymentResources.repository"),disabled:r,onChange:x=>y({cr:{...e.cr,repository:x}})})]}),e.cr.mode==="existing"&&a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.crInstance")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrInstance"),value:e.cr.instance??"",valueLabel:e.cr.instance,state:h,disabled:r,valueField:"name",onChange:x=>y({cr:{mode:"existing",instance:x.name}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.namespace")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrNamespace"),value:e.cr.namespace??"",valueLabel:e.cr.namespace,state:m,disabled:r||!e.cr.instance,valueField:"name",onChange:x=>y({cr:{...e.cr,namespace:x.name,repository:void 0}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.repository")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrRepository"),value:e.cr.repository??"",valueLabel:e.cr.repository,state:g,disabled:r||!e.cr.namespace,valueField:"name",onChange:x=>y({cr:{...e.cr,repository:x.name}})})]})]}),e.cr.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.crInstance"),name:l("deploymentResources.autoRegistry")},{label:l("deploymentResources.namespace"),name:"agentkit"},{label:l("deploymentResources.repository"),name:l("deploymentResources.autoRepositoryName",{name:c})}],note:l("deploymentResources.registryNameNote")})]})]}),a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:"CodePipeline"}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:"CodePipeline",value:e.codePipeline.mode,disabled:r,onChange:x=>y({codePipeline:{mode:x}})}),e.codePipeline.mode==="create"&&a.jsxs("div",{className:"pp-resource-fields",children:[a.jsx(W0,{label:l("deploymentResources.workspaceName"),value:e.codePipeline.workspaceName??"",placeholder:l("deploymentResources.workspaceName"),disabled:r,onChange:x=>y({codePipeline:{...e.codePipeline,workspaceName:x}})}),a.jsx(W0,{label:l("deploymentResources.pipelineName"),value:e.codePipeline.pipelineName??"",placeholder:l("deploymentResources.pipelineName"),disabled:r,onChange:x=>y({codePipeline:{...e.codePipeline,pipelineName:x}})})]}),e.codePipeline.mode==="existing"&&a.jsxs("div",{className:"pp-resource-fields",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.workspace")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingWorkspace"),value:e.codePipeline.workspaceId??"",valueLabel:e.codePipeline.workspaceName,state:b,disabled:r,onChange:x=>y({codePipeline:{mode:"existing",workspaceId:x.id,workspaceName:x.name}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.compatiblePipeline")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingPipeline"),value:e.codePipeline.pipelineId??"",valueLabel:e.codePipeline.pipelineName,state:v,disabled:r||!e.codePipeline.workspaceId,onChange:x=>y({codePipeline:{...e.codePipeline,pipelineId:x.id,pipelineName:x.name}})})]})]}),e.codePipeline.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.workspace"),name:"agentkit-cli-workspace"},{label:l("deploymentResources.pipeline"),name:u}],note:l("deploymentResources.pipelineNameNote")})]})]}),s&&a.jsx("p",{className:"pp-resource-validation",role:"alert",children:s})]})}function KWt(e){return[{value:"custom",label:e("environmentCenter.creation.custom.label"),description:e("environmentCenter.creation.custom.description")},{value:"dockerfile",label:e("environmentCenter.creation.dockerfile.label"),description:e("environmentCenter.creation.dockerfile.description")},{value:"git",label:e("environmentCenter.creation.git.label"),description:e("environmentCenter.creation.git.description")},{value:"image",label:e("environmentCenter.creation.image.label"),description:e("environmentCenter.creation.image.description")}]}const GWt=CRe.map(e=>({value:e.id,label:e.label,description:e.description}));function XWt(e){return[{value:"none",label:e("common.none"),description:e("environmentCenter.presets.none")},{value:"aio-sandbox",label:"AIO Sandbox",description:e("environmentCenter.presets.aio")},{value:"codex-sandbox",label:"Codex Sandbox",description:e("environmentCenter.presets.codex")}]}function YWt(e){const t=UWt(e,"");return t===yz?"aio-sandbox":t.includes("/codexenv:")?"codex-sandbox":"none"}const ZWt=$N.map(e=>({value:e.id,label:e.label})),Tse=ARe.map(e=>({value:e.id,label:e.label}));function JWt(e){return[{value:"managed",label:e("environmentCenter.repository.managed")},{value:"existing",label:e("environmentCenter.repository.existing")}]}const UB=20,Ase=new Set;async function eKt(){var e;if(typeof navigator>"u"||!((e=navigator.permissions)!=null&&e.query))return!1;try{return(await navigator.permissions.query({name:"clipboard-read"})).state==="denied"}catch{return!1}}const tKt={opencli:cWt,uv:uWt,playwright:dWt,chromium:fWt,git:hWt,curl:pWt,ffmpeg:mWt,imagemagick:gWt};function nKt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function vd(){return a.jsx("span",{className:"environment-required-mark","aria-hidden":"true",children:"*"})}function iKt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4"}),a.jsx("path",{d:"M5 16v2.5A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V16"})]})}function QB(e,t){const n=e.trim();if(!n)return t("environmentCenter.errors.repositoryRequired");try{const i=new URL(n);if(i.protocol!=="https:"||!i.hostname)return t("environmentCenter.errors.repositoryHttps")}catch{return t("environmentCenter.errors.repositoryInvalid")}return""}function _se(e){return!!(e!=null&&e.region&&e.registry&&e.namespace&&e.repository)}function z6e(e,t){const n=e.trim();return n?/\s/.test(n)?t("environmentCenter.errors.imageReferenceWhitespace"):n.startsWith("sha256:")?/^sha256:[0-9a-fA-F]{64}$/.test(n)?"":t("environmentCenter.errors.imageDigestInvalid"):/[@/]/.test(n)?t("environmentCenter.errors.imageTagOnly"):"":""}function rKt(e){return(e instanceof Error?e.message:String(e)).split(` -原始响应:`,1)[0].trim()}function sKt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.5 10.5 16 5l10.5 5.5L16 16 5.5 10.5Z"}),a.jsx("path",{d:"M5.5 16 16 21.5 26.5 16M5.5 21.5 16 27l10.5-5.5"})]})}function oKt({label:e}){return a.jsx("span",{className:"environment-package-fallback",children:e.slice(0,1).toUpperCase()})}function aKt({option:e}){if(e.id==="lark-cli")return a.jsx("img",{src:BD,alt:""});if(e.id==="pandoc")return a.jsx("img",{src:lWt,alt:""});if(e.id==="github-cli")return a.jsx(VH,{});const t=tKt[e.id];return t?a.jsx("img",{src:t,alt:""}):a.jsx(oKt,{label:e.label})}function lKt(e,t){return e?{name:e.name,description:e.description,baseEnvironment:e.baseEnvironment,operatingSystem:e.operatingSystem,language:e.language,optionIds:[...e.optionIds],selectedSkills:[...e.selectedSkills],dockerfile:e.dockerfile===xz(e,t)?void 0:e.dockerfile,gitSource:e.gitSource,containerRepository:e.containerRepository,imageSource:e.imageSource}:{...k5,optionIds:[...k5.optionIds],selectedSkills:[...k5.selectedSkills]}}const Ub=new Set(["preparing","queued","building","scanning"]),jse=3e3,p4={preparing:"environmentCenter.buildStatus.preparing",queued:"environmentCenter.buildStatus.queued",building:"environmentCenter.buildStatus.building",scanning:"environmentCenter.buildStatus.scanning",available:"environmentCenter.buildStatus.available",failed:"environmentCenter.buildStatus.failed"};function V6e(e,t){var i;const n=(i=e.latestVersion)==null?void 0:i.status;return n?n==="available"?{label:t(p4[n]),color:"success"}:n==="failed"?{label:t(p4[n]),color:"danger"}:{label:t(p4[n]),color:"warning"}:{label:t("environmentCenter.buildStatus.notBuilt"),color:"secondary"}}function cKt(e,t){return LD(e,Date.now(),t)}function uKt(e,t){const n=Date.parse(e);return Number.isNaN(n)?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"medium"}).format(n)}function dKt(e,t,n=Date.now()){const i=Date.parse(e.createdAt),s=Ub.has(e.status)?n:Date.parse(e.updatedAt);if(Number.isNaN(i)||Number.isNaN(s))return"";const o=Math.max(0,Math.floor((s-i)/1e3));if(o<60)return t("environmentCenter.duration.seconds",{count:o});const l=Math.floor(o/60),c=o%60;return l<60?t("environmentCenter.duration.minutesSeconds",{minutes:l,seconds:c}):t("environmentCenter.duration.hoursMinutes",{hours:Math.floor(l/60),minutes:l%60})}function fKt({environment:e,onClose:t}){var w;const{t:n}=Ae("ui"),i=((w=e.latestVersion)==null?void 0:w.versionId)??"",r=p.useId(),s=p.useRef(null),o=p.useRef(t),[l,c]=p.useState(null),[u,d]=p.useState(!0),[f,h]=p.useState(""),[m,g]=p.useState(0),[b,v]=p.useState("idle"),y=p.useMemo(()=>l?HWt(l):"",[l]);o.current=t,p.useEffect(()=>{var C;const O=document.body.style.overflow,S=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(C=s.current)==null||C.focus();const k=E=>{if(E.key==="Escape"){E.preventDefault(),o.current();return}if(E.key!=="Tab"||!s.current)return;const R=Array.from(s.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')).filter(T=>T.getClientRects().length>0);if(!R.length)return;const _=R[0],j=R[R.length-1];E.shiftKey&&document.activeElement===_?(E.preventDefault(),j.focus()):!E.shiftKey&&document.activeElement===j&&(E.preventDefault(),_.focus())};return window.addEventListener("keydown",k),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",k),S!=null&&S.isConnected&&S.focus()}},[]),p.useEffect(()=>{const O=new AbortController;return d(!0),h(""),HEe(e.id,i,O.signal).then(c).catch(S=>{(S==null?void 0:S.name)!=="AbortError"&&h(S instanceof Error?S.message:String(S))}).finally(()=>{O.signal.aborted||d(!1)}),()=>O.abort()},[e.id,m,i]),p.useEffect(()=>{if(b!=="copied")return;const O=window.setTimeout(()=>v("idle"),1500);return()=>window.clearTimeout(O)},[b]);const x=async()=>{try{await navigator.clipboard.writeText(y),v("copied")}catch{v("error")}};return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:O=>{O.target===O.currentTarget&&t()},children:a.jsxs("section",{ref:s,className:"environment-build-dialog environment-manifest-dialog",role:"dialog","aria-modal":"true","aria-labelledby":r,"aria-busy":u||void 0,tabIndex:-1,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("div",{className:"environment-build-dialog__title-row",children:a.jsx("h2",{id:r,children:n("environmentCenter.manifest.title")})}),a.jsxs("p",{children:[e.name," / ",i]})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":n("environmentCenter.manifest.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsx("div",{className:"environment-manifest-dialog__body",children:u?a.jsx("div",{className:"environment-manifest-dialog__state",role:"status",children:a.jsx(yn,{as:"span",children:n("environmentCenter.manifest.loading")})}):f?a.jsxs("div",{className:"environment-manifest-dialog__state is-error",role:"alert",children:[a.jsx("p",{children:f}),a.jsx(Dt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>g(O=>O+1),children:n("common.reload")})]}):a.jsx("div",{className:"environment-manifest-dialog__editor","aria-label":n("environmentCenter.manifest.editorLabel"),children:a.jsx(dT,{value:y,path:"environment.yaml",readOnly:!0,onChange:()=>{}})})}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[b==="error"?a.jsx("span",{className:"environment-manifest-dialog__copy-error",role:"alert",children:n("environmentCenter.manifest.copyFailed")}):null,a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:n("common.close")}),a.jsx(Dt,{type:"button",color:"info",size:"sm",disabled:!y,onClick:()=>void x(),children:n(b==="copied"?"environmentCenter.manifest.copied":"environmentCenter.manifest.copy")})]})]})}),document.body)}function hKt({environment:e,onClose:t,onBuildUpdate:n,onRebuild:i}){var k,C;const{t:r}=Ae("ui"),s=e.latestVersion,[o,l]=p.useState(s),[c,u]=p.useState(!!s),[d,f]=p.useState(""),[h,m]=p.useState(Date.now()),[g,b]=p.useState(!1),v=p.useId(),y=p.useRef(null),x=p.useRef(t),w=p.useRef(n);p.useEffect(()=>{x.current=t,w.current=n},[n,t]),p.useEffect(()=>{var j;const E=document.body.style.overflow,R=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(j=y.current)==null||j.focus();const _=T=>{var D;if(T.key==="Escape"&&x.current(),T.key!=="Tab")return;const N=Array.from(((D=y.current)==null?void 0:D.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'))??[]).filter(M=>M.getClientRects().length>0);if(!N.length)return;const A=N[0],P=N[N.length-1];T.shiftKey&&document.activeElement===A?(T.preventDefault(),P.focus()):!T.shiftKey&&document.activeElement===P&&(T.preventDefault(),A.focus())};return window.addEventListener("keydown",_),()=>{document.body.style.overflow=E,window.removeEventListener("keydown",_),R!=null&&R.isConnected&&R.focus()}},[]),p.useEffect(()=>{if(!s)return;let E=0;const R=new AbortController,_=async()=>{u(!0);try{const j=await VEe(e.id,s.versionId,{includeLogs:!0,signal:R.signal});l(j),f(""),w.current(j),Ub.has(j.status)&&(E=window.setTimeout(_,jse))}catch(j){if((j==null?void 0:j.name)==="AbortError")return;f(j instanceof Error?j.message:String(j)),E=window.setTimeout(_,jse)}finally{R.signal.aborted||u(!1)}};return _(),()=>{R.abort(),window.clearTimeout(E)}},[e.id,s==null?void 0:s.versionId]),p.useEffect(()=>{if(!o||!Ub.has(o.status))return;const E=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(E)},[o==null?void 0:o.status]);const O=o?V6e({...e,latestVersion:o},r):{label:r("environmentCenter.buildStatus.notBuilt"),color:"secondary"},S=e.imageSource||(C=(k=o==null?void 0:o.resources)==null?void 0:k.codePipeline)==null?void 0:C.consoleUrl;return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:a.jsxs("section",{ref:y,className:"environment-build-dialog",role:"dialog","aria-modal":"true","aria-labelledby":v,tabIndex:-1,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"environment-build-dialog__title-row",children:[a.jsx("h2",{id:v,children:r("environmentCenter.buildDetails.title")}),a.jsx(Io,{color:O.color,size:"sm",children:O.label})]}),a.jsx("p",{children:e.name})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":r("environmentCenter.buildDetails.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsxs("div",{className:"environment-build-dialog__summary",children:[a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.currentStep")}),a.jsx("strong",{children:(o==null?void 0:o.currentStep)||r("environmentCenter.buildDetails.waiting")})]}),a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.elapsed")}),a.jsx("strong",{children:o?dKt(o,r,h):"-"})]}),o!=null&&o.sourceCommitSha?a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.sourceCommit")}),a.jsx("strong",{title:o.sourceCommitSha,children:o.sourceCommitSha.slice(0,12)})]}):null,S?a.jsxs("a",{href:S,target:"_blank",rel:"noreferrer",children:[r("environmentCenter.buildDetails.openCodePipeline")," ",a.jsx(my,{"aria-hidden":!0})]}):null]}),a.jsxs("div",{className:"environment-build-dialog__body",children:[d?a.jsx("p",{className:"environment-build-dialog__error",role:"alert",children:d}):null,o!=null&&o.progressError?a.jsx("p",{className:"environment-build-dialog__notice",children:o.progressError}):null,a.jsx(wWt,{steps:(o==null?void 0:o.steps)??[],log:(o==null?void 0:o.logTail)??"",logError:o==null?void 0:o.logError,logTruncated:o==null?void 0:o.logTruncated,logUpdatedAt:o==null?void 0:o.logUpdatedAt,loading:c&&!!(o&&Ub.has(o.status))}),(o==null?void 0:o.status)==="failed"&&o.error?a.jsx("p",{className:"environment-build-dialog__failure",role:"alert",children:o.error}):null]}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:r("common.close")}),o&&!e.imageSource&&!Ub.has(o.status)?a.jsx(Dt,{type:"button",color:"info",size:"sm",disabled:g,onClick:()=>{b(!0),i().then(t).finally(()=>b(!1))},children:r(g?"environmentCenter.buildDetails.starting":"environmentCenter.buildDetails.rebuild")}):null]})]})}),document.body)}function H6e({cloudProvider:e,value:t,disabled:n,onChange:i}){const{t:r}=Ae("ui"),s=Jc(e).map(o=>({value:o.value,label:o.label}));return a.jsxs("label",{className:"environment-field environment-region-field",children:[a.jsxs("span",{children:[r("environmentCenter.region"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-region",value:t,options:s,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:n,triggerClassName:"environment-select-trigger",onChange:o=>i(o.value)})]})}function pKt({repositoryUrl:e,gitRef:t,dockerfilePath:n,inspection:i,inspectedKey:r,disabled:s,onRepositoryUrlChange:o,onGitRefChange:l,onDockerfilePathChange:c,onInspectionChange:u,onInspectedKeyChange:d}){const{t:f}=Ae("ui"),[h,m]=p.useState(!1),[g,b]=p.useState(""),v=p.useRef(null),y=p.useRef(""),x=`${e.trim()}\0${t.trim()}`,w=r===x;p.useEffect(()=>()=>{const C=v.current;v.current=null,C==null||C.abort()},[]);const O=()=>{var C;(C=v.current)==null||C.abort(),v.current=null,m(!1),b(""),u(null),d(""),c(""),y.current=""},S=p.useCallback(async()=>{var R;const C=QB(e,f);if(C){b(C);return}y.current=x,(R=v.current)==null||R.abort();const E=new AbortController;v.current=E,m(!0),b("");try{const _=await MEe({repositoryUrl:e.trim(),...t.trim()?{ref:t.trim()}:{}},E.signal);if(v.current!==E)return;u(_),d(x),c(_.dockerfiles.length===1?_.dockerfiles[0]:"")}catch(_){if((_==null?void 0:_.name)==="AbortError")return;b(rKt(_)),u(null),d(""),c("")}finally{v.current===E&&(v.current=null,m(!1))}},[x,t,c,d,u,e,f]);p.useEffect(()=>{if(s||w||y.current===x||QB(e,f))return;const C=window.setTimeout(()=>void S(),600);return()=>window.clearTimeout(C)},[x,s,S,w,e,f]);const k=w?(i==null?void 0:i.dockerfiles)??[]:[];return a.jsxs("section",{className:"environment-source-section","aria-label":f("environmentCenter.git.sectionLabel"),children:[a.jsxs("div",{className:"environment-form-grid environment-git-fields",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[f("environmentCenter.git.address"),a.jsx(vd,{})]}),a.jsx(hs,{size:"lg",type:"url",required:!0,value:e,placeholder:"https://github.com/owner/repository.git",autoComplete:"url",disabled:s,"aria-invalid":!!g,onChange:C=>{O(),o(C.currentTarget.value)}})]}),a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:f("environmentCenter.git.ref")}),a.jsx(hs,{size:"lg",value:t,placeholder:f("environmentCenter.git.defaultBranch"),autoComplete:"off",disabled:s,onChange:C=>{O(),l(C.currentTarget.value)}})]})]}),a.jsxs("div",{className:"environment-inspection-status environment-form-feedback","aria-live":"polite",children:[h?a.jsx(yn,{as:"span",children:f("environmentCenter.git.inspecting")}):null,g?a.jsxs("div",{className:"environment-source-error",role:"alert",children:[a.jsx("span",{children:g}),a.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,disabled:s,onClick:()=>void S(),children:[a.jsx(ZI,{}),f("common.retry")]})]}):null,!h&&!g&&w&&i?k.length>0?a.jsx("span",{children:i.commitSha?f("environmentCenter.git.foundDockerfiles",{commit:i.commitSha.slice(0,12),count:k.length}):f("environmentCenter.git.savedDockerfileLoaded")}):a.jsxs("div",{className:"environment-source-error",role:"alert",children:[a.jsx("span",{children:f("environmentCenter.git.noDockerfile")}),a.jsx("button",{type:"button",disabled:s,onClick:()=>void S(),children:f("environmentCenter.git.inspectAgain")})]}):null]}),k.length>0?a.jsxs("label",{className:"environment-field environment-dockerfile-picker",children:[a.jsxs("span",{children:["Dockerfile",a.jsx(vd,{})]}),a.jsx(Ag,{ariaLabel:f("environmentCenter.git.selectDockerfile"),value:n,valueLabel:n,placeholder:f("environmentCenter.git.selectDockerfile"),options:k.map(C=>({value:C,label:C})),disabled:s||h,onChange:c})]}):null]})}function mKt({cloudProvider:e,mode:t,region:n,value:i,disabled:r,onModeChange:s,onRegionChange:o,onChange:l}){const{t:c}=Ae("ui");return a.jsx("section",{className:"environment-source-section","aria-label":c("environmentCenter.repository.outputSection"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[c("environmentCenter.repository.type"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-repository-mode",value:t,options:JWt(c),optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:r,triggerClassName:"environment-select-trigger",onChange:u=>s(u.value)})]}),a.jsx(H6e,{cloudProvider:e,value:n,disabled:r,onChange:o}),t==="existing"?a.jsx(B6e,{region:n,value:i,disabled:r,onChange:l}):a.jsx("p",{className:"environment-source-note environment-form-feedback",children:c("environmentCenter.repository.managedHint")})]})})}function gKt({cloudProvider:e,region:t,repository:n,reference:i,disabled:r,onRegionChange:s,onRepositoryChange:o,onReferenceChange:l}){const{t:c}=Ae("ui"),u=z6e(i,c);return a.jsx("section",{className:"environment-source-section","aria-label":c("environmentCenter.existingImage.sectionLabel"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsx(H6e,{cloudProvider:e,value:t,disabled:r,onChange:s}),a.jsx(B6e,{region:t,value:n,disabled:r,onChange:o}),a.jsxs("label",{className:"environment-field environment-image-reference",children:[a.jsxs("span",{children:[c("environmentCenter.existingImage.reference"),a.jsx(vd,{})]}),a.jsx(hs,{size:"lg",value:i,required:!0,placeholder:c("environmentCenter.existingImage.placeholder"),autoComplete:"off",disabled:r,"aria-invalid":!!u,onChange:d=>l(d.currentTarget.value)}),u?a.jsx("small",{className:"environment-source-field__error",role:"alert",children:u}):a.jsx("small",{children:c("environmentCenter.existingImage.hint")})]})]})})}function q6e(e,t,n,i){const r=p.useRef(n),s=p.useRef(i);r.current=n,s.current=i,p.useEffect(()=>{const o=document.body.style.overflow,l=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden";const c=window.requestAnimationFrame(()=>{var d;return(d=t.current)==null?void 0:d.focus()}),u=d=>{var g;if(d.key==="Escape"&&!s.current){d.preventDefault(),r.current();return}if(d.key!=="Tab")return;const f=Array.from(((g=e.current)==null?void 0:g.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(b=>b.getClientRects().length>0);if(!f.length)return;const h=f[0],m=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),h.focus())};return window.addEventListener("keydown",u),()=>{window.cancelAnimationFrame(c),document.body.style.overflow=o,window.removeEventListener("keydown",u),l!=null&&l.isConnected&&l.focus()}},[e,t])}function bKt({environment:e,onClose:t}){const{t:n}=Ae("ui"),i=p.useId(),r=p.useId(),s=p.useRef(null),o=p.useRef(null),[l,c]=p.useState(""),[u,d]=p.useState("loading"),[f,h]=p.useState(""),m=u==="loading";q6e(s,o,t,m);const g=async(b="",v)=>{d("loading"),h("");try{const y=b||(await LEe(e.id,v)).shareCode;c(y),await CEe(y),v!=null&&v.aborted||d("copied")}catch(y){if((y==null?void 0:y.name)==="AbortError")return;h(y instanceof Error?y.message:String(y)),d("error")}};return p.useEffect(()=>{const b=new AbortController;return g("",b.signal),()=>b.abort()},[e.id]),ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:b=>{b.target===b.currentTarget&&!m&&t()},children:a.jsxs("section",{ref:s,className:"environment-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":i,"aria-describedby":r,"aria-busy":m||void 0,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:i,children:n("environmentCenter.share.title")}),a.jsx("p",{id:r,children:e.name})]}),a.jsx(Dt,{ref:o,type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:m,onClick:t,"aria-label":n("environmentCenter.share.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsx("div",{className:"environment-share-dialog__body",children:u==="loading"?a.jsx(yn,{as:"p",children:n("environmentCenter.share.generating")}):a.jsxs("div",{className:"environment-share-dialog__result",children:[u==="copied"?a.jsx("p",{className:"environment-share-dialog__success",role:"status","aria-live":"polite",children:n("environmentCenter.share.copied")}):a.jsxs("div",{className:"environment-share-dialog__error",role:"alert",children:[a.jsx("strong",{children:n("environmentCenter.share.failed")}),a.jsx("span",{children:f})]}),l?a.jsxs("label",{className:"environment-share-dialog__field environment-share-dialog__manual-code",children:[a.jsx("span",{children:n("environmentCenter.share.code")}),a.jsx(Og,{size:"lg",rows:4,value:l,readOnly:!0,"aria-label":n("environmentCenter.share.fullCode"),onFocus:b=>b.currentTarget.select(),onClick:b=>b.currentTarget.select()}),a.jsx("small",{children:n(u==="copied"?"environmentCenter.share.copiedHint":"environmentCenter.share.copyFailedHint")})]}):null,a.jsx("p",{className:"environment-share-dialog__safety",children:n("environmentCenter.share.safety")})]})}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:m,onClick:t,children:n("common.close")}),u==="error"?a.jsx(Dt,{type:"button",color:"info",size:"sm",onClick:()=>void g(l),children:n("common.retry")}):u==="copied"?a.jsx(Dt,{type:"button",color:"info",size:"sm",onClick:()=>void g(l),children:n("environmentCenter.share.copyAgain")}):null]})]})}),document.body)}function yKt({initialValue:e,autoInspect:t,onClose:n,onImported:i}){const{t:r}=Ae("ui"),s=p.useId(),o=p.useId(),l=p.useId(),c=p.useRef(null),u=p.useRef(null),d=p.useRef(!1),[f,h]=p.useState(e),[m,g]=p.useState("editing"),[b,v]=p.useState([]),[y,x]=p.useState(""),[w,O]=p.useState([]),S=p.useMemo(()=>pU(f),[f]),k=S.length>UB,C=m==="inspecting"||m==="importing",E=b.filter(A=>A.status==="valid"),R=b.filter(A=>A.status==="invalid"),_=m==="ready"&&E.length>0;q6e(c,u,n,C);const j=p.useCallback(async()=>{if(!(!S.length||k)){g("inspecting"),x(""),O([]);try{const A=await $Ee(S);v([...A].sort((P,D)=>P.index-D.index)),g("ready")}catch(A){x(A instanceof Error?A.message:String(A)),g("editing")}}},[S,k]);p.useEffect(()=>{!t||d.current||(d.current=!0,j())},[t,j]);const T=async()=>{if(_){g("importing"),x(""),O([]);try{const A=E.map(F=>({code:S[F.index],name:F.name})).filter(F=>!!F.code),P=await FEe(A.map(F=>F.code)),D=P.filter(F=>F.status==="created").length,M=P.filter(F=>F.status==="duplicate").length,L=new Map(P.map(F=>[F.index,F])),U=A.flatMap(({code:F,name:W},V)=>{const X=L.get(V);return!X||X.status==="failed"?[{code:F,name:W,status:"valid",error:(X==null?void 0:X.error)||r("environmentCenter.import.noResult")}]:[]}),H=[...R.flatMap(F=>{const W=S[F.index];return W?[{code:W,name:"",status:"invalid",error:F.error||r("environmentCenter.import.invalidCode")}]:[]}),...U],K=new Map;if(P.forEach(F=>{F.environment&&K.set(F.environment.id,F.environment)}),i([...K.values()],D,M,H.length),!H.length){n();return}h(H.map(F=>F.code).join(` -`)),O(U),v(H.map((F,W)=>({index:W,status:F.status,name:F.name,error:F.status==="invalid"?F.error:""}))),x(r("environmentCenter.import.partial",{created:D,remaining:H.length})),g("ready")}catch(A){x(A instanceof Error?A.message:String(A)),g("ready")}}},N=m==="inspecting"?r("environmentCenter.import.inspecting"):m==="importing"?r("environmentCenter.import.importing"):_?w.length?r("environmentCenter.import.retryImport"):r("environmentCenter.import.confirm"):r("environmentCenter.import.inspectCodes");return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:A=>{A.target===A.currentTarget&&!C&&n()},children:a.jsxs("section",{ref:c,className:"environment-share-dialog environment-import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":s,"aria-describedby":o,"aria-busy":C||void 0,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:s,children:r("environmentCenter.import.title")}),a.jsx("p",{id:o,children:r("environmentCenter.import.description")})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:C,onClick:n,"aria-label":r("environmentCenter.import.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsxs("div",{className:"environment-share-dialog__body",children:[a.jsxs("label",{className:"environment-share-dialog__field",children:[a.jsx("span",{children:r("environmentCenter.import.code")}),a.jsx(Og,{ref:u,size:"lg",rows:6,value:f,disabled:C,"aria-invalid":k||R.length>0||void 0,"aria-describedby":l,placeholder:"akenv://v1/...",onChange:A=>{h(A.currentTarget.value),g("editing"),v([]),x(""),O([])}})]}),a.jsx("p",{id:l,className:`environment-share-dialog__help${k?" is-error":""}`,children:k?r("environmentCenter.import.tooMany",{max:UB,count:S.length}):r("environmentCenter.import.multipleHint")}),a.jsx("p",{className:"environment-share-dialog__safety",children:r("environmentCenter.import.safety")}),m==="inspecting"?a.jsx(yn,{as:"p",children:r("environmentCenter.import.inspectingCodes")}):E.length?a.jsx("p",{className:"environment-share-dialog__summary",role:"status","aria-live":"polite",children:r("environmentCenter.import.found",{count:E.length,names:E.map(A=>A.name||r("environmentCenter.unnamed")).join(r("environmentCenter.listSeparator"))})}):null,R.length?a.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:R.map(A=>a.jsx("li",{children:r("environmentCenter.import.itemError",{index:A.index+1,error:A.error||r("environmentCenter.import.invalidCode")})},A.index))}):null,w.length?a.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:w.map((A,P)=>a.jsx("li",{children:r("environmentCenter.import.itemError",{index:P+1,error:A.error})},`${A.code}:${P}`))}):null,y?a.jsx("p",{className:"environment-share-dialog__error-text",role:"alert",children:y}):null]}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:C,onClick:n,children:r("common.cancel")}),a.jsx(Dt,{type:"button",color:"info",size:"sm",loading:C,disabled:C||!S.length||k||m==="ready"&&!_,onClick:()=>_?void T():void j(),children:N})]})]})}),document.body)}function vKt({environment:e,cloudProvider:t,onCancel:n,onDelete:i,onShare:r,onSave:s}){var qe,De,At,It,lt,Ot,Ct;const{t:o,i18n:l}=Ae("ui"),c=KWt(o),u=lKt(e,t),d=u.dockerfile!==void 0,[f,h]=p.useState(()=>({...u,dockerfile:d?void 0:u.dockerfile})),[m,g]=p.useState(u.gitSource?"git":u.imageSource?"image":d?"dockerfile":"custom"),[b,v]=p.useState(d?(e==null?void 0:e.dockerfile)??"":""),[y,x]=p.useState(""),w=p.useRef(null),[O,S]=p.useState(()=>d?YWt((e==null?void 0:e.dockerfile)??""):u.baseEnvironment==="aio-sandbox"||u.baseEnvironment==="codex-sandbox"?u.baseEnvironment:"none"),[k,C]=p.useState(((qe=u.gitSource)==null?void 0:qe.repositoryUrl)??""),[E,R]=p.useState(((De=u.gitSource)==null?void 0:De.ref)??""),[_,j]=p.useState(((At=u.gitSource)==null?void 0:At.dockerfilePath)??""),[T,N]=p.useState(u.gitSource?{repositoryUrl:u.gitSource.repositoryUrl,ref:u.gitSource.ref??"",commitSha:"",dockerfiles:[u.gitSource.dockerfilePath]}:null),[A,P]=p.useState(u.gitSource?`${u.gitSource.repositoryUrl}\0${u.gitSource.ref??""}`:""),[D,M]=p.useState(u.containerRepository?"existing":"managed"),[L,U]=p.useState(((It=u.containerRepository)==null?void 0:It.region)??Ki(t)),[I,H]=p.useState(u.containerRepository??void 0),[K,F]=p.useState(((lt=u.imageSource)==null?void 0:lt.region)??Ki(t)),[W,V]=p.useState(u.imageSource?{region:u.imageSource.region,registry:u.imageSource.registry,namespace:u.imageSource.namespace,repository:u.imageSource.repository}:void 0),[X,ie]=p.useState(((Ot=u.imageSource)==null?void 0:Ot.reference)??""),[Q,Z]=p.useState(!1),ce=p.useMemo(()=>xz(f,t),[t,f.baseEnvironment,f.operatingSystem,f.language,f.optionIds]),Ee=f.dockerfile??ce,Y=O!=="none",G=O==="aio-sandbox"?yz:O==="codex-sandbox"?TRe[t]:"",te=Y?QWt(b):b,ye=Y?gj(G,""):"",Ne=Y?gj(G,te):b,pe=y||(Y?zWt(te,G,o):qH(b,void 0,o)),me=!!e,se="environment-editor-form",[Se,Le]=p.useState(!1),[be,Ve]=p.useState(""),ve=!!Ne.trim()&&!pe,Re=`${k.trim()}\0${E.trim()}`,ne=!QB(k,o)&&A===Re&&!!_&&(D==="managed"||_se(I)),ge=_se(W)&&!!X.trim()&&!z6e(X,o),Ce=!!f.name.trim()&&!Se&&(m==="custom"||m==="dockerfile"&&ve||m==="git"&&ne||m==="image"&&ge),ke=(dt,yt)=>{h(Ie=>({...Ie,optionIds:yt?[...Ie.optionIds,dt]:Ie.optionIds.filter(vt=>vt!==dt)}))},Ke=dt=>{x(""),v(Y?gj(G,dt):dt)},it=async dt=>{if(!dt)return;const yt=await VWt(dt,o);x(yt.error),yt.content&&v(yt.content)},ue=()=>{x(""),v(ye)},xe=async dt=>{if(dt.preventDefault(),!!Ce){Le(!0),Ve("");try{const yt=txt(Ne);await s({...f,name:f.name.trim(),description:f.description.trim(),optionIds:m==="custom"?f.optionIds:[],selectedSkills:m==="custom"?f.selectedSkills:[],dockerfile:m==="dockerfile"?Ne:m==="custom"?Ee:"",gitSource:m==="git"?{repositoryUrl:k.trim(),...E.trim()?{ref:E.trim()}:{},dockerfilePath:_}:null,containerRepository:m==="git"&&D==="existing"?I:null,imageSource:m==="image"&&W?{...W,reference:X.trim()}:null,...m==="dockerfile"?yt:{}})}catch(yt){Ve(yt instanceof Error?yt.message:String(yt)),Le(!1)}}},Te=f.name.trim()||(me?(e==null?void 0:e.name)||o("environmentCenter.configure"):o("environmentCenter.create"));return a.jsx(Df,{className:"environment-editor","aria-label":o(me?"environmentCenter.details":"environmentCenter.create"),children:a.jsx(LC,{title:Te,description:o("environmentCenter.editorDescription"),identitySeed:Te,backLabel:o("environmentCenter.backToList"),onBack:n,actions:a.jsxs(a.Fragment,{children:[i?a.jsx(Dt,{type:"button",color:"danger",variant:"ghost",size:"sm",onClick:i,disabled:Se,children:o("common.delete")}):null,r?a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:r,disabled:Se,children:o("environmentCenter.share.action")}):null,a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:n,disabled:Se,children:o("common.cancel")}),a.jsx(Dt,{color:"info",size:"sm",type:"submit",form:se,disabled:!Ce,children:o(Se?"common.saving":m==="image"?me?"environmentCenter.save":"environmentCenter.create":me?"environmentCenter.saveAndBuild":"environmentCenter.createAndBuild")})]}),children:a.jsxs("form",{id:se,className:"environment-form",onSubmit:xe,children:[a.jsxs("div",{className:"environment-fields",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.name"),a.jsx(vd,{})]}),a.jsx(hs,{className:"environment-text-input",type:"text",size:"lg",required:!0,value:f.name,maxLength:60,placeholder:o("environmentCenter.namePlaceholder"),onChange:dt=>h(yt=>({...yt,name:dt.target.value}))})]}),a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:o("common.description")}),a.jsx(Og,{className:"environment-description-input",size:"lg",rows:3,value:f.description,maxLength:180,placeholder:o("environmentCenter.descriptionPlaceholder"),onChange:dt=>h(yt=>({...yt,description:dt.target.value}))})]})]}),a.jsxs("label",{className:"environment-field environment-creation-method",children:[a.jsxs("span",{children:[o("environmentCenter.creationMethod"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-creation-method",value:m,options:c,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{const yt=dt.value;g(yt),yt==="dockerfile"&&!b.trim()&&v(ye),Ve("")}}),a.jsx("small",{children:(Ct=c.find(dt=>dt.value===m))==null?void 0:Ct.description})]}),be?a.jsx("p",{className:"environment-form-error",role:"alert",children:be}):null,m==="custom"?a.jsxs("div",{className:"environment-configuration",children:[a.jsx("section",{className:"environment-section environment-form-section","aria-label":o("environmentCenter.baseConfiguration"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.baseEnvironment"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-base-environment",value:f.baseEnvironment,options:GWt.map(dt=>({...dt,description:o(`environmentCenter.baseDescriptions.${dt.value}`)})),optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{const yt=dt.value,Ie=yt==="aio-sandbox"||yt==="codex-sandbox";h(vt=>({...vt,baseEnvironment:yt,operatingSystem:Ie?"ubuntu-22.04":vt.operatingSystem,language:Ie?"python-3.12":vt.language}))}}),a.jsx("small",{children:o(`environmentCenter.baseDescriptions.${f.baseEnvironment}`)})]}),a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.operatingSystem"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-operating-system",value:f.operatingSystem,options:ZWt,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:f.baseEnvironment!=="ubuntu",triggerClassName:"environment-select-trigger",onChange:dt=>h(yt=>({...yt,operatingSystem:dt.value}))}),a.jsx("small",{children:f.baseEnvironment!=="ubuntu"?o("environmentCenter.fixedByBase",{base:HF(f.baseEnvironment),value:"Ubuntu 22.04"}):o("environmentCenter.selectUbuntuVersion")})]}),a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.pythonVersion"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-python-version",value:f.language,options:f.baseEnvironment!=="ubuntu"?Tse.filter(dt=>dt.value==="python-3.12"):Tse,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:f.baseEnvironment!=="ubuntu",triggerClassName:"environment-select-trigger",onChange:dt=>h(yt=>({...yt,language:dt.value}))}),a.jsx("small",{children:f.baseEnvironment!=="ubuntu"?o("environmentCenter.fixedByBase",{base:HF(f.baseEnvironment),value:"Python 3.12"}):o("environmentCenter.selectPythonVersion")})]})]})}),a.jsxs("section",{className:"environment-section","aria-labelledby":"environment-skills-title",children:[a.jsx("h2",{id:"environment-skills-title",children:o("environmentCenter.skills")}),a.jsxs("div",{className:"environment-skill-grid",children:[a.jsx(Cse,{name:"VeADK",description:o("environmentCenter.veadkDescription"),selected:Q,disabled:Se,onChange:Z,icon:a.jsx("img",{src:pP,alt:""})}),a.jsx(HH,{selected:f.selectedSkills,onChange:dt=>h(yt=>({...yt,selectedSkills:dt})),cloudProvider:t,disabled:Se,addLabel:o("environmentCenter.addSkill"),showSelectedCount:!1})]})]}),vz.map(dt=>a.jsxs("section",{className:"environment-section","aria-labelledby":`environment-${dt.id}-title`,children:[a.jsx("h2",{id:`environment-${dt.id}-title`,children:o(`environmentCenter.categories.${dt.id}`)}),a.jsx("div",{className:"environment-option-grid",children:dt.options.map(yt=>{const Ie=f.optionIds.includes(yt.id);return a.jsx(Cse,{name:yt.label,description:o(`environmentCenter.options.${yt.id}`,{defaultValue:yt.description}),selected:Ie,onChange:vt=>ke(yt.id,vt),icon:a.jsx(aKt,{option:yt})},yt.id)})})]},dt.id))]}):m==="dockerfile"?a.jsxs("section",{className:"environment-upload","aria-label":o("environmentCenter.customDockerfile"),children:[a.jsx("div",{className:"environment-dockerfile-settings environment-form-grid",children:a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:o("environmentCenter.presetEnvironment")}),a.jsx(Xs,{id:"environment-dockerfile-base-environment",value:O,options:XWt(o),optionClassName:"environment-select-option",size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{x(""),S(dt.value)}}),a.jsx("small",{children:o("environmentCenter.presetHint")})]})}),a.jsxs("div",{className:"environment-upload__preview",children:[a.jsxs("div",{children:[a.jsxs("h3",{children:["Dockerfile",a.jsx(vd,{})]}),a.jsxs("div",{className:"environment-upload__actions",children:[a.jsx("span",{className:"environment-upload__size",children:o("environmentCenter.dockerfileSize",{size:$6e(Ne).toLocaleString(l.resolvedLanguage??l.language),max:131072 .toLocaleString(l.resolvedLanguage??l.language)})}),a.jsx("input",{ref:w,className:"environment-upload__file-input",type:"file",accept:".dockerfile,text/plain",tabIndex:-1,hidden:!0,onChange:dt=>{var Ie;const yt=dt.currentTarget;it((Ie=yt.files)==null?void 0:Ie[0]).finally(()=>{yt.value=""})}}),a.jsx(Dt,{className:"environment-upload__action",type:"button",color:"secondary",variant:"soft",size:"sm",pill:!1,disabled:Se,onClick:()=>{var dt;return(dt=w.current)==null?void 0:dt.click()},children:o("environmentCenter.upload")}),a.jsx(Dt,{className:"environment-upload__action",type:"button",color:"secondary",variant:"ghost",size:"sm",pill:!1,disabled:Se||!te,onClick:ue,children:o("environmentCenter.reset")})]})]}),a.jsxs("div",{className:`environment-dockerfile-editor${Y?" has-fixed-base":""}${pe?" is-invalid":""}`,children:[Y?a.jsxs("div",{className:"environment-dockerfile-from","aria-label":o("environmentCenter.dockerfileBaseImage"),children:[a.jsx("span",{className:"environment-dockerfile-from__line","aria-hidden":"true",children:"1"}),a.jsxs("code",{children:[a.jsx("span",{className:"environment-dockerfile-from__keyword",children:"FROM"}),a.jsx("span",{title:G,children:G})]})]}):null,a.jsx("div",{className:"environment-dockerfile__editor environment-upload__editor","aria-label":o("environmentCenter.dockerfileContent"),children:a.jsx(dT,{value:te,path:"Dockerfile",lineNumberStart:Y?2:1,height:"auto",minHeight:"28px",maxHeight:"var(--environment-dockerfile-editor-max-height)",onChange:Ke})})]})]}),pe?a.jsx("p",{className:"environment-upload__error environment-upload__error--below",role:"alert",children:pe}):null]}):m==="git"?a.jsxs("div",{className:"environment-source-workflow",children:[a.jsx(pKt,{repositoryUrl:k,gitRef:E,dockerfilePath:_,inspection:T,inspectedKey:A,disabled:Se,onRepositoryUrlChange:C,onGitRefChange:R,onDockerfilePathChange:j,onInspectionChange:N,onInspectedKeyChange:P}),a.jsx(mKt,{cloudProvider:t,mode:D,region:L,value:I,disabled:Se,onModeChange:dt=>{M(dt),Ve("")},onRegionChange:dt=>{U(dt),H(void 0),Ve("")},onChange:H})]}):a.jsx(gKt,{cloudProvider:t,region:K,repository:W,reference:X,disabled:Se,onRegionChange:dt=>{F(dt),V(void 0),Ve("")},onRepositoryChange:V,onReferenceChange:ie})]})})})}function W6e({cloudProvider:e="volcengine",onWorkspace:t,onProjects:n,clipboardImport:i=null,clipboardReadError:r=""}){const{t:s,i18n:o}=Ae("ui"),[l,c]=p.useState([]),[u,d]=p.useState({kind:"list"}),[f,h]=p.useState(""),[m,g]=p.useState(null),[b,v]=p.useState(null),[y,x]=p.useState(null),[w,O]=p.useState(null),[S,k]=p.useState(null),C=p.useRef(0),[E,R]=p.useState(""),[_,j]=p.useState(!1),[T,N]=p.useState(r),[A,P]=p.useState(!0),[D,M]=p.useState(""),[L,U]=p.useState(0),[I,H]=p.useState(()=>new Set),K=p.useDeferredValue(f),F=p.useMemo(()=>{const Y=K.trim().toLocaleLowerCase();return Y?l.filter(G=>`${G.name} ${G.description} ${VF(G.operatingSystem)} ${Xh(G.language)} ${HF(G.baseEnvironment)}`.toLocaleLowerCase().includes(Y)):l},[K,l]),W=p.useCallback((Y="",G=!1)=>{C.current+=1,k({key:C.current,initialValue:Y,autoInspect:G})},[]),V=p.useCallback((Y,G=!1)=>{const te=Y.trim();if(!te.startsWith("akenv://")||!G&&Ase.has(te))return!1;const ye=pU(te);return!ye.length||ye.length>UB?!1:(Ase.add(te),N(""),W(te,!0),!0)},[W]),X=p.useCallback(async()=>{var Y;if(!(u.kind!=="list"||S)){if(typeof navigator>"u"||!((Y=navigator.clipboard)!=null&&Y.readText)){N(s("environmentCenter.clipboardUnsupported"));return}try{const G=await navigator.clipboard.readText();!V(G)&&!G.trim()&&await eKt()&&N(s("environmentCenter.clipboardReadError"))}catch{N(s("environmentCenter.clipboardReadError"))}}},[S,V,s,u.kind]);p.useEffect(()=>{const Y=new AbortController;return l.length===0&&P(!0),M(""),fC(Y.signal).then(G=>{c(G)}).catch(G=>{(G==null?void 0:G.name)!=="AbortError"&&M(G instanceof Error?G.message:String(G))}).finally(()=>{Y.signal.aborted||P(!1)}),()=>Y.abort()},[L]),p.useEffect(()=>{if(!l.some(G=>G.latestVersion&&Ub.has(G.latestVersion.status)))return;const Y=window.setTimeout(()=>U(G=>G+1),2500);return()=>window.clearTimeout(Y)},[l]),p.useEffect(()=>{if(!E||_)return;const Y=window.setTimeout(()=>R(""),2800);return()=>window.clearTimeout(Y)},[_,E]),p.useEffect(()=>{r&&N(r)},[r]),p.useEffect(()=>{i&&V(i.text)},[i,V]),p.useEffect(()=>{if(u.kind!=="list")return;const Y=()=>void X(),G=()=>{document.visibilityState==="visible"&&X()},te=ye=>{var me;const Ne=ye.target;if(Ne instanceof HTMLInputElement||Ne instanceof HTMLTextAreaElement||Ne instanceof HTMLElement&&Ne.isContentEditable)return;const pe=((me=ye.clipboardData)==null?void 0:me.getData("text/plain"))??"";V(pe,!0)&&ye.preventDefault()};return window.addEventListener("focus",Y),document.addEventListener("visibilitychange",G),window.addEventListener("paste",te),()=>{window.removeEventListener("focus",Y),document.removeEventListener("visibilitychange",G),window.removeEventListener("paste",te)}},[V,X,u.kind]);const ie=u.kind==="editor"&&u.environmentId?l.find(Y=>Y.id===u.environmentId):void 0,Q=async Y=>{const G={...Y,dockerfile:Y.dockerfile??xz(Y,e)},te=ie?await QEe(ie.id,G):await UEe(G);if(c(ye=>[te,...ye.filter(Ne=>Ne.id!==te.id)]),d({kind:"list"}),j(!1),G.imageSource){R(s("environmentCenter.status.boundImage",{name:te.name}));return}try{const ye=await I6(te.id);c(Ne=>Ne.map(pe=>pe.id===te.id?{...pe,latestVersion:ye}:pe)),R(s("environmentCenter.status.queued",{name:te.name}))}catch(ye){j(!0),R(s("environmentCenter.status.savedBuildFailed",{error:ye instanceof Error?ye.message:String(ye)}))}},Z=async Y=>{if(!I.has(Y.id)){H(G=>new Set(G).add(Y.id)),j(!1);try{const G=await I6(Y.id);c(te=>te.map(ye=>ye.id===Y.id?{...ye,latestVersion:G}:ye)),R(s("environmentCenter.status.queued",{name:Y.name}))}catch(G){j(!0),R(G instanceof Error?G.message:String(G))}finally{H(G=>{const te=new Set(G);return te.delete(Y.id),te})}}},ce=(Y,G,te,ye)=>{Y.length&&c(Ne=>{const pe=new Set(Y.map(me=>me.id));return[...Y,...Ne.filter(me=>!pe.has(me.id))]}),j(ye>0),R(ye>0?s("environmentCenter.status.importedFailed",{created:G,failed:ye}):te>0?s("environmentCenter.status.importedDuplicate",{created:G,duplicate:te}):s("environmentCenter.status.imported",{count:G}))},Ee=m?a.jsx(Gu,{title:s("environmentCenter.deleteTitle"),description:s("environmentCenter.deleteDescription",{name:m.name}),confirmLabel:s("common.delete"),variant:"danger",onCancel:()=>g(null),onConfirm:()=>{const Y=m;g(null),d({kind:"list"}),zEe(Y.id).then(()=>{c(G=>G.filter(te=>te.id!==Y.id)),j(!1),R(s("environmentCenter.status.deleted",{name:Y.name}))}).catch(G=>{j(!0),R(G instanceof Error?G.message:String(G))})}}):null;return u.kind==="editor"?a.jsxs(a.Fragment,{children:[a.jsx(vKt,{environment:ie,cloudProvider:e,onCancel:()=>d({kind:"list"}),onDelete:ie?()=>g(ie):void 0,onShare:ie?()=>O(ie):void 0,onSave:Q},u.environmentId??"new"),w?a.jsx(bKt,{environment:w,onClose:()=>O(null)}):null,Ee]}):a.jsxs(zH,{section:"environments",className:"environment-center",onWorkspace:t,onProjects:n,actions:a.jsxs(a.Fragment,{children:[E?a.jsx("span",{className:`environment-status${_?" is-error":""}`,role:_?"alert":"status","aria-live":"polite",children:E}):null,a.jsx(hp,{"aria-label":s("environmentCenter.search"),value:f,onChange:Y=>h(Y.target.value),placeholder:s("environmentCenter.search")})]}),children:[T?a.jsxs("div",{className:"environment-clipboard-notice",role:"alert",children:[a.jsx("span",{children:T}),a.jsx(Dt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>{N(""),W()},children:s("environmentCenter.manualImport")})]}):null,a.jsx(Rg,{"aria-live":"polite",children:A?a.jsx(Fa,{}):D?a.jsxs("div",{className:"environment-load-error",role:"alert",children:[a.jsx("p",{children:Fu(D,o.resolvedLanguage||o.language)||s("environmentCenter.loadFailed")}),a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>U(Y=>Y+1),children:s("common.reload")})]}):F.length===0&&f.trim()?a.jsx("div",{className:"environment-empty",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(sKt,{})}),a.jsx(Pn.Title,{children:s("environmentCenter.noMatches")}),a.jsx(Pn.Description,{children:s("environmentCenter.tryAnotherName")})]})}):a.jsxs(Yy,{children:[f.trim()?null:a.jsxs(a.Fragment,{children:[a.jsx(ug,{"aria-label":s("environmentCenter.create"),icon:a.jsx(nKt,{}),onClick:()=>d({kind:"editor",environmentId:null}),children:s("environmentCenter.create")}),a.jsx(ug,{"aria-label":s("environmentCenter.import.title"),icon:a.jsx(iKt,{}),onClick:()=>W(),children:s("environmentCenter.import.title")})]}),F.map(Y=>{var Ne,pe;const G=V6e(Y,s),te=!!(Y.latestVersion&&Ub.has(Y.latestVersion.status)),ye=I.has(Y.id);return a.jsx(Jy,{className:"environment-card",title:Y.name,status:a.jsx(Io,{color:G.color,size:"sm",children:G.label}),description:((Ne=Y.latestVersion)==null?void 0:Ne.error)||(te?(pe=Y.latestVersion)==null?void 0:pe.currentStep:"")||Y.description||s("common.noDescription"),metadata:[{label:s("workspace.updated"),value:cKt(Y.updatedAt,o.resolvedLanguage??o.language),title:uKt(Y.updatedAt,o.resolvedLanguage??o.language)}],action:{label:Y.latestVersion?s("environmentCenter.buildDetails.title"):s(ye?"environmentCenter.buildDetails.starting":"environmentCenter.startBuild"),icon:"play",title:s("environmentCenter.build"),disabled:ye,onClick:()=>Y.latestVersion?v(Y.id):void Z(Y)},auxiliaryAction:{label:s("environmentCenter.manifest.view"),icon:a.jsx(Ent,{}),title:Y.latestVersion?s("environmentCenter.manifest.viewShort"):s("environmentCenter.manifest.unavailable"),disabled:!Y.latestVersion,onClick:()=>x(Y)},detailAction:{label:s("environmentCenter.configure"),onClick:()=>d({kind:"editor",environmentId:Y.id})}},Y.id)})]})}),b?(()=>{const Y=l.find(G=>G.id===b);return Y?a.jsx(hKt,{environment:Y,onClose:()=>v(null),onBuildUpdate:G=>{c(te=>te.map(ye=>ye.id===Y.id?{...ye,latestVersion:G}:ye))},onRebuild:()=>Z(Y)}):null})():null,y!=null&&y.latestVersion?a.jsx(fKt,{environment:y,onClose:()=>x(null)}):null,Ee,S?a.jsx(yKt,{initialValue:S.initialValue,autoInspect:S.autoInspect,onClose:()=>k(null),onImported:ce},S.key):null]})}function xKt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function wKt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"4.5",y:"7",width:"23",height:"18",rx:"3"}),a.jsx("path",{d:"M10 7V5.5A1.5 1.5 0 0 1 11.5 4h4A1.5 1.5 0 0 1 17 5.5V7M9 13h5v5H9zM18 13h5M18 17h5M9 22h14"})]})}function zB(e,t){const n=Date.parse(e);return Number.isNaN(n)?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function OKt(e,t){return e.environmentIds.reduce((n,i)=>{var r,s;return((s=(r=t.get(i))==null?void 0:r.latestVersion)==null?void 0:s.status)==="available"?n+1:n},0)}function kKt({workspace:e,environments:t,onBack:n,onSave:i,onDelete:r}){const{t:s,i18n:o}=Ae("ui"),[l,c]=p.useState((e==null?void 0:e.name)??""),[u,d]=p.useState((e==null?void 0:e.description)??""),[f,h]=p.useState((e==null?void 0:e.environmentIds)??[]),[m,g]=p.useState(""),[b,v]=p.useState(!1),[y,x]=p.useState(""),w=m.trim().toLocaleLowerCase(),O=t.filter(k=>`${k.name} ${k.description} ${Xh(k.language)}`.toLocaleLowerCase().includes(w)),S=async k=>{if(k.preventDefault(),!(!l.trim()||b)){v(!0),x("");try{await i({name:l.trim(),description:u.trim(),environmentIds:f})}catch(C){x(C instanceof Error?C.message:String(C)),v(!1)}}};return a.jsx(Df,{className:"workspace-center","aria-label":s(e?"workspace.detail":"workspace.create"),children:a.jsxs(LC,{title:e?e.name:s("workspace.create"),description:s("workspace.editorDescription"),identitySeed:(e==null?void 0:e.name)||s("workspace.create"),backLabel:s("workspace.backToList"),onBack:n,actions:a.jsxs(a.Fragment,{children:[r?a.jsx("button",{type:"button",className:"is-danger",onClick:r,children:s("common.delete")}):null,a.jsx("button",{type:"submit",form:"workspace-form",disabled:b||!l.trim(),children:s(b?"common.saving":"common.save")})]}),children:[e?a.jsxs(Oz,{children:[a.jsxs("div",{children:[a.jsx("dt",{children:s("common.environment")}),a.jsx("dd",{children:s("workspace.environmentCount",{count:f.length})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("workspace.createdAt")}),a.jsx("dd",{children:zB(e.createdAt,o.resolvedLanguage??o.language)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("workspace.updatedAt")}),a.jsx("dd",{children:zB(e.updatedAt,o.resolvedLanguage??o.language)})]})]}):null,a.jsxs("form",{id:"workspace-form",className:"workspace-form",onSubmit:S,children:[a.jsxs("section",{className:"workspace-fields","aria-label":s("workspace.basicInfo"),children:[a.jsxs("label",{children:[a.jsx("span",{children:s("common.name")}),a.jsx(hs,{value:l,maxLength:128,autoFocus:!0,onChange:k=>c(k.target.value),placeholder:s("workspace.namePlaceholder")})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("common.description")}),a.jsx(Og,{value:u,maxLength:2e3,onChange:k=>d(k.target.value),placeholder:s("workspace.descriptionPlaceholder")})]})]}),a.jsxs("section",{className:"workspace-environments",children:[a.jsx(HRe,{title:s("common.environment"),description:s("workspace.selectedEnvironmentCount",{count:f.length}),actions:a.jsx(hp,{"aria-label":s("workspace.searchAvailableEnvironments"),value:m,onChange:k=>g(k.target.value),placeholder:s("workspace.searchEnvironments")})}),t.length===0?a.jsxs("div",{className:"workspace-environment-empty",children:[a.jsx("p",{children:s("workspace.noAvailableEnvironments")}),a.jsx("span",{children:s("workspace.createEnvironmentFirst")})]}):O.length===0?a.jsxs("div",{className:"workspace-environment-empty",children:[a.jsx("p",{children:s("workspace.noMatchingEnvironments")}),a.jsx("span",{children:s("workspace.tryAnotherName")})]}):a.jsx("div",{className:"workspace-environment-list",children:O.map(k=>{var R;const C=f.includes(k.id),E=((R=k.latestVersion)==null?void 0:R.status)==="available"?s("workspace.environmentStatus.available"):k.latestVersion?s("workspace.environmentStatus.building"):s("workspace.environmentStatus.notBuilt");return a.jsxs("label",{className:`workspace-environment-option${C?" is-selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:C,onChange:()=>h(_=>C?_.filter(j=>j!==k.id):[..._,k.id])}),a.jsxs("span",{className:"workspace-environment-option__copy",children:[a.jsx("strong",{title:k.name,children:k.name}),a.jsxs("span",{children:[Xh(k.language)," · ",E]})]}),a.jsx("span",{className:"workspace-environment-option__action",children:s(C?"workspace.added":"common.add")})]},k.id)})})]}),y?a.jsx("p",{className:"workspace-form-error",role:"alert",children:y}):null]})]})})}function SKt({onEnvironment:e,onProjects:t}){const{t:n,i18n:i}=Ae("ui"),[r,s]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState({kind:"list"}),[d,f]=p.useState(""),[h,m]=p.useState(!0),[g,b]=p.useState(""),[v,y]=p.useState(""),[x,w]=p.useState(!1),[O,S]=p.useState(null),[k,C]=p.useState(0),E=p.useDeferredValue(d);p.useEffect(()=>{const T=new AbortController;return m(!0),b(""),Promise.all([bU(T.signal),fC(T.signal)]).then(([N,A])=>{s(N),l(A)}).catch(N=>{(N==null?void 0:N.name)!=="AbortError"&&(console.warn("Unable to load Studio workspaces",N),b(n("workspace.loadFailed")))}).finally(()=>{T.signal.aborted||m(!1)}),()=>T.abort()},[k,n]),p.useEffect(()=>{if(!v||x)return;const T=window.setTimeout(()=>y(""),2800);return()=>window.clearTimeout(T)},[x,v]);const R=p.useMemo(()=>new Map(o.map(T=>[T.id,T])),[o]),_=p.useMemo(()=>{const T=E.trim().toLocaleLowerCase();return T?r.filter(N=>{const A=N.environmentIds.map(P=>{var D;return((D=R.get(P))==null?void 0:D.name)??""}).join(" ");return`${N.name} ${N.description} ${A}`.toLocaleLowerCase().includes(T)}):r},[E,R,r]),j=c.kind==="detail"&&c.workspaceId?r.find(T=>T.id===c.workspaceId):void 0;return c.kind==="detail"?a.jsx(kKt,{workspace:j,environments:o,onBack:()=>u({kind:"list"}),onDelete:j?()=>S(j):null,onSave:async T=>{const N=j?await PEe(j.id,T):await IEe(T);s(A=>[N,...A.filter(P=>P.id!==N.id)]),w(!1),y(n("workspace.saved",{name:N.name})),u({kind:"list"})}},c.workspaceId??"new"):a.jsxs(zH,{section:"workspaces",onEnvironment:e,onProjects:t,actions:a.jsxs(a.Fragment,{children:[v?a.jsx("span",{className:`workspace-status${x?" is-error":""}`,role:x?"alert":"status","aria-live":"polite",children:v}):null,a.jsx(hp,{"aria-label":n("workspace.searchWorkspaces"),value:d,onChange:T=>f(T.target.value),placeholder:n("workspace.searchWorkspaces")})]}),children:[a.jsx(Rg,{"aria-live":"polite",children:h?a.jsx(Fa,{}):g?a.jsxs("div",{className:"workspace-load-error",role:"alert",children:[a.jsx("p",{children:g}),a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>C(T=>T+1),children:n("common.reload")})]}):_.length===0&&d.trim()?a.jsx("div",{className:"workspace-empty",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(wKt,{})}),a.jsx(Pn.Title,{children:n("workspace.noMatchingWorkspaces")}),a.jsx(Pn.Description,{children:n("workspace.tryAnotherNameOrEnvironment")})]})}):a.jsxs(Yy,{children:[d.trim()?null:a.jsx(ug,{"aria-label":n("workspace.create"),icon:a.jsx(xKt,{}),onClick:()=>u({kind:"detail",workspaceId:null}),children:n("workspace.create")}),_.map(T=>{const N=OKt(T,R),A=T.environmentIds.filter(P=>!R.has(P)).length;return a.jsx(Jy,{className:"workspace-card",title:T.name,status:a.jsx(Io,{color:A?"danger":N===T.environmentIds.length&&N>0?"success":"secondary",size:"sm",children:T.environmentIds.length===0?n("workspace.noEnvironmentAdded"):A?n("workspace.environmentMissing"):n("workspace.availableFraction",{available:N,total:T.environmentIds.length})}),description:T.description||n("common.noDescription"),metadata:[{label:n("common.environment"),value:n("workspace.environmentCount",{count:T.environmentIds.length})},{label:n("workspace.available"),value:n("workspace.availableCount",{count:N})},{label:n("workspace.updated"),value:zB(T.updatedAt,i.resolvedLanguage??i.language)}],detailAction:{label:n("common.manage"),onClick:()=>u({kind:"detail",workspaceId:T.id})},action:{label:n("workspace.addEnvironment"),icon:"plus",onClick:()=>u({kind:"detail",workspaceId:T.id})}},T.id)})]})}),O?a.jsx(Gu,{title:n("workspace.deleteTitle"),description:n("workspace.deleteDescription",{name:O.name}),confirmLabel:n("common.delete"),variant:"danger",onCancel:()=>S(null),onConfirm:()=>{const T=O;S(null),DEe(T.id).then(()=>{s(N=>N.filter(A=>A.id!==T.id)),w(!1),y(n("workspace.deleted",{name:T.name})),u({kind:"list"})}).catch(N=>{w(!0),y(N instanceof Error?N.message:String(N))})}}):null]})}function EKt({cloudProvider:e,onProjects:t,initialSection:n="workspaces"}){const[i,r]=p.useState(n),{t:s}=Ae("ui"),[o,l]=p.useState(null),[c,u]=p.useState(""),d=p.useRef(0),f=()=>{var g;d.current+=1;const h=d.current;u("");let m=null;if(typeof navigator<"u"&&((g=navigator.clipboard)!=null&&g.readText))try{m=navigator.clipboard.readText()}catch{u(s("workspace.clipboardPermissionError"))}else u(s("workspace.clipboardUnsupported"));r("environments"),m&&m.then(async b=>{var v;if(d.current===h){if(b.trim()){l({key:h,text:b});return}try{const y=await((v=navigator.permissions)==null?void 0:v.query({name:"clipboard-read"}));d.current===h&&(y==null?void 0:y.state)==="denied"&&u(s("workspace.clipboardPermissionError"))}catch{}}}).catch(()=>{d.current===h&&u(s("workspace.clipboardPermissionError"))})};return i==="environments"?a.jsx(W6e,{cloudProvider:e,onWorkspace:()=>r("workspaces"),onProjects:t,clipboardImport:o,clipboardReadError:c}):a.jsx(SKt,{onEnvironment:f,onProjects:t})}function CKt(e){return e==="127.0.0.1"}const TKt={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"Configure coding agents",badge:"Local",badgeTone:"success",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},AKt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},_Kt={id:"gitlab-review",kind:"gitlab",category:"development",icon:"gitlab",name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."};mn.hasResourceBundle("en-US","automations")||mn.addResourceBundle("en-US","automations",Ice,!0,!0);mn.hasResourceBundle("zh-CN","automations")||mn.addResourceBundle("zh-CN","automations",Pge,!0,!0);function $f(e,t={}){return mn.t(e,{...t,ns:"automations"})}const K6e={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL",required:!0},G6e={name:"baseBranch",label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base",required:!1},X6e={name:"runtimeName",label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration",required:!0},Y6e={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates",required:!0},jKt="https://ark.cn-beijing.volces.com/api/coding/v3";function NKt(e){return e==="byteplus"?va(e):jKt}function WH(e){return e==="byteplus"?{accessKey:"BYTEPLUS_ACCESS_KEY",secretKey:"BYTEPLUS_SECRET_KEY",sessionToken:"BYTEPLUS_SESSION_TOKEN"}:{accessKey:"VOLCENGINE_ACCESS_KEY",secretKey:"VOLCENGINE_SECRET_KEY",sessionToken:"VOLCENGINE_SESSION_TOKEN"}}function Z6e(e){const t=WH(e);return[$f("github.secretPair",{accessKey:t.accessKey,secretKey:t.secretKey}),$f("github.sessionToken",{sessionToken:t.sessionToken})]}function KH(e){return e==="byteplus"?"BytePlus":"Volcengine"}function GH(e,t={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",modelName:"",modelBaseUrl:NKt(e),region:Ki(e),token:"",...t}}function J6e(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const RKt={id:"review",kind:"github",category:"development",icon:"github",name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",fields:[],initialValues:({cloudProvider:e})=>GH(e),regionHelp:"",secrets:()=>[],async submit(){throw new Error("PR 自动评审已切换为 GitHub App 授权模式。")}},IKt="https://api.github.com",PKt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,Nse=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,DKt=/^[A-Za-z0-9._/-]+$/;function MKt(e,t,n){const i=String((t==null?void 0:t.message)||"");return e===403&&/workflow/i.test(i)?"GitHub Token 缺少 Workflows 写权限,无法创建或更新 .github/workflows 下的文件":e===401||e===403?z("github.invalidToken"):e===404?z("github.notFound"):e===422?z("github.rejectedCommit"):i.split(n).join("***").trim().slice(0,240)||z("github.requestFailed",{status:e})}async function ob(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let i;try{i=await fetch(`${IKt}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(s){throw t.signal.aborted?s:new Error(z("github.networkFailed"))}const r=await i.json().catch(()=>null);if(!t.expected.includes(i.status))throw new Error(MKt(i.status,r,t.token));return{status:i.status,payload:r}}function m4(e){return e.split("/").map(encodeURIComponent).join("/")}function LKt(e){const t=new TextEncoder().encode(e);let n="";const i=32768;for(let r=0;r({...h,path:YH(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),o=`/repos/${n}`;await ob(`${o}`,{token:e.token,expected:[200],signal:s});const c=(f=(await ob(`${o}/git/ref/heads/${m4(i)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error(z("github.missingBaseSha"));const u=$Kt(e.branchPrefix);await ob(`${o}/git/refs`,{token:e.token,expected:[201],signal:s,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const m of r){const g=m4(m.path),b=await ob(`${o}/contents/${g}?ref=${encodeURIComponent(i)}`,{token:e.token,expected:[200,404],signal:s});if(m.mustBeNew&&b.status===200)throw new Error(z("github.fileAlreadyExists",{path:m.path}));if(b.status===200&&!b.payload.sha)throw new Error(z("github.pathNotUpdatable",{path:m.path}));await ob(`${o}/contents/${g}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:m.commitMessage,content:LKt(m.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await ob(`${o}/pulls`,{token:e.token,expected:[201],signal:s,method:"POST",body:{title:e.title,head:u,base:i,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error(z("github.invalidPullRequest"));return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await ob(`${o}/git/refs/heads/${m4(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}async function FKt(e,t){const n=await gn("/web/github/pull-request-reviews",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await hT(n);const i=await n.json();if(i.status!=="started"||typeof i.sessionId!="string"||!i.sessionId||typeof i.displayName!="string")throw new Error("PR 评审服务返回了无效结果。");return i}async function BKt(e){const t=await gn("/web/github/app/config",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await hT(t);const n=await t.json();if(typeof n.configured!="boolean"||typeof n.appSlug!="string"||typeof n.installUrl!="string"||typeof n.reason!="string")throw new Error("GitHub App 配置响应格式无效。");return n}async function UKt(e,t){var s;const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)});(s=t.query)!=null&&s.trim()&&n.set("q",t.query.trim());const i=await gn(`/web/github/app/repositories?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await hT(i);const r=await i.json();if(!Array.isArray(r.repositories)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.repositories.some(o=>typeof o!="object"||o===null||typeof o.installationId!="number"||typeof o.account!="string"||typeof o.fullName!="string"||typeof o.htmlUrl!="string"||typeof o.private!="boolean"||typeof o.reviewEnabled!="boolean"))throw new Error("GitHub App 仓库列表响应格式无效。");return r}async function QKt(e,t){const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)}),i=await gn(`/web/github/app/review-records?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await hT(i);const r=await i.json();if(!Array.isArray(r.records)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.records.some(s=>typeof s!="object"||s===null||typeof s.id!="string"||typeof s.repository!="string"||typeof s.pullRequestUrl!="string"||typeof s.pullRequestNumber!="number"||!["started","completed","ignored","failed"].includes(String(s.status))||!["manual","webhook"].includes(String(s.trigger))||typeof s.createdAt!="string"||typeof s.deliveryId!="string"||typeof s.action!="string"||typeof s.sessionId!="string"||typeof s.displayName!="string"||typeof s.reason!="string"))throw new Error("PR 评审记录响应格式无效。");return r}async function zKt(e,t){const n=await gn("/web/github/app/review-repositories",{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await hT(n);const i=await n.json();if(!Array.isArray(i.repositories)||i.repositories.some(r=>typeof r!="string"))throw new Error("GitHub App 评审仓库保存响应格式无效。");return i.repositories}async function hT(e){const t=await e.text().catch(()=>"");try{const n=JSON.parse(t),i=typeof n.detail=="object"&&n.detail?n.detail.message:n.detail??n.message??n.error,r=typeof i=="string"?i:"";return new Error(r||`PR 评审发起失败(HTTP ${e.status})`)}catch{return new Error(t||`PR 评审发起失败(HTTP ${e.status})`)}}const VKt=/^[A-Za-z0-9_-]+$/,tFe=4,$R=64,FR=6,Ise="agent-runtime";function nFe(e){const t=e.trim();if(!t)return Ise;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,$R);return n?(n.lengthKt(`validation.runtimeName.${n}`)){return e?VKt.test(e)?e.length$R?t("length"):null:t("characters"):t("required")}const WKt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,KKt="cn-hongkong";function GKt(e){const t=b1(e.runtimeName,n=>$f(`github.validation.runtimeName.${n}`));if(t)throw new Error(t);if(!WKt.test(e.runtimeId))throw new Error($f("github.validation.runtimeId"))}function iFe(e){GKt(e);const t=e.cloudProvider??"volcengine",n=WH(t),i=t==="byteplus"?` +${i}`:n}function HWt(e,t,n){return t.trim()?/^\s*FROM(?:\s|$)/im.test(e)?Sx("duplicateFrom",n):qH(gj(t,e),void 0,n):Sx("baseImageRequired",n)}function qH(e,t=$6e(e),n){return t>L6e?Sx("tooLarge",n):e.trim()?/^\s*FROM\s+\S+/im.test(e)?"":Sx("missingFrom",n):Sx("empty",n)}async function qWt(e,t){if(e.size>L6e)return{content:"",error:Sx("tooLarge",t)};const n=UD(await e.text());return{content:n,error:qH(n,e.size,t)}}function WWt(e){return uD(e,{lineWidth:0})}function KWt(e){return[{value:"auto",label:e("deploymentResources.mode.auto"),description:e("deploymentResources.mode.autoDescription"),badge:e("deploymentResources.mode.recommended")},{value:"create",label:e("deploymentResources.mode.create"),description:e("deploymentResources.mode.createDescription")},{value:"existing",label:e("deploymentResources.mode.existing"),description:e("deploymentResources.mode.existingDescription")}]}const F6e={tos:{mode:"auto"},cr:{mode:"auto"},codePipeline:{mode:"auto"}};function Th(e){const[t,n]=p.useState([]),[i,r]=p.useState(""),[s,o]=p.useState(1),[l,c]=p.useState(0),[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,g]=p.useState(null),[b,v]=p.useState(""),[y,x]=p.useState(""),[w,O]=p.useState(""),[S,k]=p.useState(0),C=p.useRef(!1),E=p.useRef(null),R=e?JSON.stringify(e):"",_=e?JSON.stringify({...e,search:y}):"";p.useEffect(()=>{const P=window.setTimeout(()=>{x(b.trim())},250);return()=>window.clearTimeout(P)},[b]),p.useEffect(()=>{v(""),x("")},[R]);const j=p.useCallback((P,D)=>{var U;if(!_)return;(U=E.current)==null||U.abort();const M=new AbortController;E.current=M;const L=JSON.parse(_);D&&n([]),C.current=!0,h(!0),g(null),kEe({...L,pageNumber:P,pageSize:100},M.signal).then(I=>{n(H=>{if(D)return I.items;const K=new Set(H.map(F=>`${F.id}\0${F.name}`));return[...H,...I.items.filter(F=>!K.has(`${F.id}\0${F.name}`))]}),r(I.serviceRegion),o(I.pageNumber),c(I.totalCount),d(I.hasMore),O(_)}).catch(I=>{I instanceof DOMException&&I.name==="AbortError"||(O(_),g(I instanceof Error?I.message:String(I)))}).finally(()=>{E.current===M&&(E.current=null,C.current=!1,h(!1))})},[_]);p.useEffect(()=>{var P;if(!_){(P=E.current)==null||P.abort(),E.current=null,C.current=!1,n([]),r(""),o(1),c(0),d(!1),O(""),h(!1),g(null);return}return j(1,!0),()=>{var D;return(D=E.current)==null?void 0:D.abort()}},[j,_,S]);const T=!!_&&w===_&&b.trim()===y,N=p.useCallback(()=>{O(""),k(P=>P+1)},[]),A=p.useCallback(()=>{!T||C.current||!u||j(s+1,!1)},[u,j,s,T]);return{items:t,serviceRegion:i,totalCount:l,hasMore:T?u:!1,loading:!!_&&(!T||f),error:m,search:b,setSearch:v,reload:N,loadMore:A}}function GWt(e,t){return e.map(n=>({value:n[t],label:n.name,description:[n.status,n.region,n.id].filter(Boolean).join(" · ")}))}function Ah({ariaLabel:e,value:t,valueLabel:n,state:i,disabled:r,disabledMessage:s,valueField:o="id",onChange:l}){const{t:c}=Ae("ui"),u=p.useMemo(()=>GWt(i.items,o),[i.items,o]);return a.jsxs("div",{className:"pp-resource-picker",children:[a.jsx(Ag,{ariaLabel:e,value:t,valueLabel:n,placeholder:i.loading?c("common.loading"):c("deploymentResources.selectExisting"),options:u,disabled:r||!!i.error,searchValue:i.search,searchPlaceholder:c("deploymentResources.searchResource"),loading:i.loading,hasMore:i.hasMore,emptyMessage:i.search.trim()?c("deploymentResources.noMatch"):c("deploymentResources.noAvailable"),onSearchChange:i.setSearch,onLoadMore:i.loadMore,onChange:d=>{const f=i.items.find(h=>h[o]===d);f&&l(f)}}),s?a.jsx("span",{className:"pp-resource-status",children:s}):i.error?a.jsxs("div",{className:"pp-resource-error",role:"alert",children:[a.jsx("span",{children:i.error}),a.jsx("button",{type:"button",onClick:i.reload,children:c("common.retry")})]}):i.loading&&i.items.length===0?a.jsx("span",{className:"pp-resource-status","aria-live":"polite",children:i.search.trim()?c("deploymentResources.searching"):c("deploymentResources.loading")}):i.items.length===0?a.jsx("span",{className:"pp-resource-status",children:i.search.trim()?c("deploymentResources.noMatchSentence"):c("deploymentResources.noAvailableSentence")}):i.serviceRegion?a.jsx("span",{className:"pp-resource-status",children:c("deploymentResources.loadedSummary",{region:i.serviceRegion,loaded:i.items.length,total:i.totalCount>0?`/${i.totalCount}`:""})}):null]})}function B6e({region:e,value:t,disabled:n=!1,onChange:i}){const{t:r}=Ae("ui"),s=Th(e?{kind:"cr-registry",region:e}:null),o=Th(e&&(t!=null&&t.registry)?{kind:"cr-namespace",region:e,registry:t.registry}:null),l=Th(e&&(t!=null&&t.registry)&&t.namespace?{kind:"cr-repository",region:e,registry:t.registry,namespace:t.namespace}:null),c=t??{region:e,registry:"",namespace:"",repository:""};return a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three environment-repository-fields",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.registryInstance")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.registryAriaLabel"),value:c.registry,valueLabel:c.registry,state:s,disabled:n||!e,valueField:"name",onChange:u=>i({region:e,registry:u.name,namespace:"",repository:""})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.namespace")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.namespaceAriaLabel"),value:c.namespace,valueLabel:c.namespace,state:o,disabled:n||!c.registry,disabledMessage:c.registry?void 0:r("deploymentResources.selectRegistryFirst"),valueField:"name",onChange:u=>i({...c,region:e,namespace:u.name,repository:""})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:r("deploymentResources.repository")}),a.jsx(Ah,{ariaLabel:r("deploymentResources.existingRepository"),value:c.repository,valueLabel:c.repository,state:l,disabled:n||!c.registry||!c.namespace,disabledMessage:c.registry?c.namespace?void 0:r("deploymentResources.selectNamespaceFirst"):r("deploymentResources.selectRegistryFirst"),valueField:"name",onChange:u=>i({...c,region:e,repository:u.name})})]})]})}function f4({resource:e,value:t,disabled:n,onChange:i}){const{t:r}=Ae("ui");return a.jsxs("label",{className:"pp-resource-field pp-resource-mode",children:[a.jsx("span",{children:r("deploymentResources.configurationMode")}),a.jsx(Ag,{ariaLabel:r("deploymentResources.configurationModeAriaLabel",{resource:e}),value:t,placeholder:r("deploymentResources.selectConfigurationMode"),options:KWt(r),disabled:n,onChange:s=>i(s)})]})}function W0({label:e,value:t,placeholder:n,disabled:i,onChange:r}){return a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:e}),a.jsx("input",{value:t,placeholder:n,disabled:i,autoComplete:"off",onChange:s=>r(s.currentTarget.value)})]})}function h4({items:e,note:t}){const{t:n}=Ae("ui");return a.jsxs("div",{className:"pp-resource-auto-names",children:[a.jsx("span",{children:n("deploymentResources.automaticNames")}),a.jsx("dl",{children:e.map(i=>a.jsxs("div",{children:[a.jsx("dt",{children:i.label}),a.jsx("dd",{title:i.name,children:i.name})]},i.label))}),t&&a.jsx("small",{children:t})]})}function U6e(e){var t,n,i,r,s,o,l,c;return e.tos.mode!=="auto"&&!((t=e.tos.bucket)!=null&&t.trim())?mn.t("ui:deploymentResources.validation.tos"):e.cr.mode!=="auto"&&(!((n=e.cr.instance)!=null&&n.trim())||!((i=e.cr.namespace)!=null&&i.trim())||!((r=e.cr.repository)!=null&&r.trim()))?mn.t("ui:deploymentResources.validation.cr"):e.codePipeline.mode!=="auto"&&(!((s=e.codePipeline.workspaceName)!=null&&s.trim())||!((o=e.codePipeline.pipelineName)!=null&&o.trim()))?mn.t("ui:deploymentResources.validation.codePipeline"):e.codePipeline.mode==="existing"&&(!((l=e.codePipeline.workspaceId)!=null&&l.trim())||!((c=e.codePipeline.pipelineId)!=null&&c.trim()))?mn.t("ui:deploymentResources.validation.existingCodePipeline"):null}function Q6e({value:e,agentName:t,runtimeName:n,region:i,disabled:r,validationError:s,onChange:o}){const{t:l}=Ae("ui"),c=t.trim()||"agentkit-app",u=n.trim()||c,d=i&&i!=="cn-beijing"?l("deploymentResources.autoBucketWithRegion",{region:i.startsWith("cn-")?i.slice(3):i}):l("deploymentResources.autoBucket"),f=Th(e.tos.mode==="existing"?{kind:"tos-bucket",region:i}:null),h=Th(e.cr.mode==="existing"?{kind:"cr-registry",region:i}:null),m=Th(e.cr.mode==="existing"&&e.cr.instance?{kind:"cr-namespace",region:i,registry:e.cr.instance}:null),g=Th(e.cr.mode==="existing"&&e.cr.instance&&e.cr.namespace?{kind:"cr-repository",region:i,registry:e.cr.instance,namespace:e.cr.namespace}:null),b=Th(e.codePipeline.mode==="existing"?{kind:"cp-workspace",region:i}:null),v=Th(e.codePipeline.mode==="existing"&&e.codePipeline.workspaceId?{kind:"cp-pipeline",region:i,workspaceId:e.codePipeline.workspaceId}:null),y=x=>o({...e,...x});return a.jsxs("div",{className:"pp-resource-list",children:[a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:l("deploymentResources.tosBucket")}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:l("deploymentResources.tosBucket"),value:e.tos.mode,disabled:r,onChange:x=>y({tos:{mode:x}})}),e.tos.mode==="create"&&a.jsx(W0,{label:l("deploymentResources.bucketName"),value:e.tos.bucket??"",placeholder:l("deploymentResources.bucketNamePlaceholder"),disabled:r,onChange:x=>y({tos:{...e.tos,bucket:x}})}),e.tos.mode==="existing"&&a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.existingBucket")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingTosBucket"),value:e.tos.bucket??"",valueLabel:e.tos.bucket,state:f,disabled:r,onChange:x=>y({tos:{...e.tos,bucket:x.name}})})]}),e.tos.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.bucket"),name:d}],note:l("deploymentResources.accountIdResolved")})]})]}),a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:l("deploymentResources.containerRegistry")}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:"CR",value:e.cr.mode,disabled:r,onChange:x=>y({cr:{mode:x}})}),e.cr.mode==="create"&&a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[a.jsx(W0,{label:l("deploymentResources.instanceName"),value:e.cr.instance??"",placeholder:l("deploymentResources.crInstance"),disabled:r,onChange:x=>y({cr:{...e.cr,instance:x}})}),a.jsx(W0,{label:l("deploymentResources.namespace"),value:e.cr.namespace??"",placeholder:l("deploymentResources.namespace"),disabled:r,onChange:x=>y({cr:{...e.cr,namespace:x}})}),a.jsx(W0,{label:l("deploymentResources.repository"),value:e.cr.repository??"",placeholder:l("deploymentResources.repository"),disabled:r,onChange:x=>y({cr:{...e.cr,repository:x}})})]}),e.cr.mode==="existing"&&a.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.crInstance")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrInstance"),value:e.cr.instance??"",valueLabel:e.cr.instance,state:h,disabled:r,valueField:"name",onChange:x=>y({cr:{mode:"existing",instance:x.name}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.namespace")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrNamespace"),value:e.cr.namespace??"",valueLabel:e.cr.namespace,state:m,disabled:r||!e.cr.instance,valueField:"name",onChange:x=>y({cr:{...e.cr,namespace:x.name,repository:void 0}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.repository")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingCrRepository"),value:e.cr.repository??"",valueLabel:e.cr.repository,state:g,disabled:r||!e.cr.namespace,valueField:"name",onChange:x=>y({cr:{...e.cr,repository:x.name}})})]})]}),e.cr.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.crInstance"),name:l("deploymentResources.autoRegistry")},{label:l("deploymentResources.namespace"),name:"agentkit"},{label:l("deploymentResources.repository"),name:l("deploymentResources.autoRepositoryName",{name:c})}],note:l("deploymentResources.registryNameNote")})]})]}),a.jsxs("div",{className:"pp-resource-item",children:[a.jsx("div",{className:"pp-resource-name",children:"CodePipeline"}),a.jsxs("div",{className:"pp-resource-grid",children:[a.jsx(f4,{resource:"CodePipeline",value:e.codePipeline.mode,disabled:r,onChange:x=>y({codePipeline:{mode:x}})}),e.codePipeline.mode==="create"&&a.jsxs("div",{className:"pp-resource-fields",children:[a.jsx(W0,{label:l("deploymentResources.workspaceName"),value:e.codePipeline.workspaceName??"",placeholder:l("deploymentResources.workspaceName"),disabled:r,onChange:x=>y({codePipeline:{...e.codePipeline,workspaceName:x}})}),a.jsx(W0,{label:l("deploymentResources.pipelineName"),value:e.codePipeline.pipelineName??"",placeholder:l("deploymentResources.pipelineName"),disabled:r,onChange:x=>y({codePipeline:{...e.codePipeline,pipelineName:x}})})]}),e.codePipeline.mode==="existing"&&a.jsxs("div",{className:"pp-resource-fields",children:[a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.workspace")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingWorkspace"),value:e.codePipeline.workspaceId??"",valueLabel:e.codePipeline.workspaceName,state:b,disabled:r,onChange:x=>y({codePipeline:{mode:"existing",workspaceId:x.id,workspaceName:x.name}})})]}),a.jsxs("label",{className:"pp-resource-field",children:[a.jsx("span",{children:l("deploymentResources.compatiblePipeline")}),a.jsx(Ah,{ariaLabel:l("deploymentResources.existingPipeline"),value:e.codePipeline.pipelineId??"",valueLabel:e.codePipeline.pipelineName,state:v,disabled:r||!e.codePipeline.workspaceId,onChange:x=>y({codePipeline:{...e.codePipeline,pipelineId:x.id,pipelineName:x.name}})})]})]}),e.codePipeline.mode==="auto"&&a.jsx(h4,{items:[{label:l("deploymentResources.workspace"),name:"agentkit-cli-workspace"},{label:l("deploymentResources.pipeline"),name:u}],note:l("deploymentResources.pipelineNameNote")})]})]}),s&&a.jsx("p",{className:"pp-resource-validation",role:"alert",children:s})]})}function XWt(e){return[{value:"custom",label:e("environmentCenter.creation.custom.label"),description:e("environmentCenter.creation.custom.description")},{value:"dockerfile",label:e("environmentCenter.creation.dockerfile.label"),description:e("environmentCenter.creation.dockerfile.description")},{value:"git",label:e("environmentCenter.creation.git.label"),description:e("environmentCenter.creation.git.description")},{value:"image",label:e("environmentCenter.creation.image.label"),description:e("environmentCenter.creation.image.description")}]}const YWt=CRe.map(e=>({value:e.id,label:e.label,description:e.description}));function ZWt(e){return[{value:"none",label:e("common.none"),description:e("environmentCenter.presets.none")},{value:"aio-sandbox",label:"AIO Sandbox",description:e("environmentCenter.presets.aio")},{value:"codex-sandbox",label:"Codex Sandbox",description:e("environmentCenter.presets.codex")}]}function JWt(e){const t=zWt(e,"");return t===yz?"aio-sandbox":t.includes("/codexenv:")?"codex-sandbox":"none"}const eKt=$N.map(e=>({value:e.id,label:e.label})),Tse=ARe.map(e=>({value:e.id,label:e.label}));function tKt(e){return[{value:"managed",label:e("environmentCenter.repository.managed")},{value:"existing",label:e("environmentCenter.repository.existing")}]}const UB=20,Ase=new Set;async function nKt(){var e;if(typeof navigator>"u"||!((e=navigator.permissions)!=null&&e.query))return!1;try{return(await navigator.permissions.query({name:"clipboard-read"})).state==="denied"}catch{return!1}}const iKt={opencli:dWt,uv:fWt,playwright:hWt,chromium:pWt,git:mWt,curl:gWt,ffmpeg:bWt,imagemagick:yWt};function rKt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function vd(){return a.jsx("span",{className:"environment-required-mark","aria-hidden":"true",children:"*"})}function sKt(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4"}),a.jsx("path",{d:"M5 16v2.5A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V16"})]})}function QB(e,t){const n=e.trim();if(!n)return t("environmentCenter.errors.repositoryRequired");try{const i=new URL(n);if(i.protocol!=="https:"||!i.hostname)return t("environmentCenter.errors.repositoryHttps")}catch{return t("environmentCenter.errors.repositoryInvalid")}return""}function _se(e){return!!(e!=null&&e.region&&e.registry&&e.namespace&&e.repository)}function z6e(e,t){const n=e.trim();return n?/\s/.test(n)?t("environmentCenter.errors.imageReferenceWhitespace"):n.startsWith("sha256:")?/^sha256:[0-9a-fA-F]{64}$/.test(n)?"":t("environmentCenter.errors.imageDigestInvalid"):/[@/]/.test(n)?t("environmentCenter.errors.imageTagOnly"):"":""}function oKt(e){return(e instanceof Error?e.message:String(e)).split(` +原始响应:`,1)[0].trim()}function aKt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M5.5 10.5 16 5l10.5 5.5L16 16 5.5 10.5Z"}),a.jsx("path",{d:"M5.5 16 16 21.5 26.5 16M5.5 21.5 16 27l10.5-5.5"})]})}function lKt({label:e}){return a.jsx("span",{className:"environment-package-fallback",children:e.slice(0,1).toUpperCase()})}function cKt({option:e}){if(e.id==="lark-cli")return a.jsx("img",{src:BD,alt:""});if(e.id==="pandoc")return a.jsx("img",{src:uWt,alt:""});if(e.id==="github-cli")return a.jsx(VH,{});const t=iKt[e.id];return t?a.jsx("img",{src:t,alt:""}):a.jsx(lKt,{label:e.label})}function uKt(e,t){return e?{name:e.name,description:e.description,baseEnvironment:e.baseEnvironment,operatingSystem:e.operatingSystem,language:e.language,optionIds:[...e.optionIds],selectedSkills:[...e.selectedSkills],dockerfile:e.dockerfile===xz(e,t)?void 0:e.dockerfile,gitSource:e.gitSource,containerRepository:e.containerRepository,imageSource:e.imageSource}:{...k5,optionIds:[...k5.optionIds],selectedSkills:[...k5.selectedSkills]}}const Ub=new Set(["preparing","queued","building","scanning"]),jse=3e3,p4={preparing:"environmentCenter.buildStatus.preparing",queued:"environmentCenter.buildStatus.queued",building:"environmentCenter.buildStatus.building",scanning:"environmentCenter.buildStatus.scanning",available:"environmentCenter.buildStatus.available",failed:"environmentCenter.buildStatus.failed"};function V6e(e,t){var i;const n=(i=e.latestVersion)==null?void 0:i.status;return n?n==="available"?{label:t(p4[n]),color:"success"}:n==="failed"?{label:t(p4[n]),color:"danger"}:{label:t(p4[n]),color:"warning"}:{label:t("environmentCenter.buildStatus.notBuilt"),color:"secondary"}}function dKt(e,t){return LD(e,Date.now(),t)}function fKt(e,t){const n=Date.parse(e);return Number.isNaN(n)?e:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"medium"}).format(n)}function hKt(e,t,n=Date.now()){const i=Date.parse(e.createdAt),s=Ub.has(e.status)?n:Date.parse(e.updatedAt);if(Number.isNaN(i)||Number.isNaN(s))return"";const o=Math.max(0,Math.floor((s-i)/1e3));if(o<60)return t("environmentCenter.duration.seconds",{count:o});const l=Math.floor(o/60),c=o%60;return l<60?t("environmentCenter.duration.minutesSeconds",{minutes:l,seconds:c}):t("environmentCenter.duration.hoursMinutes",{hours:Math.floor(l/60),minutes:l%60})}function pKt({environment:e,onClose:t}){var w;const{t:n}=Ae("ui"),i=((w=e.latestVersion)==null?void 0:w.versionId)??"",r=p.useId(),s=p.useRef(null),o=p.useRef(t),[l,c]=p.useState(null),[u,d]=p.useState(!0),[f,h]=p.useState(""),[m,g]=p.useState(0),[b,v]=p.useState("idle"),y=p.useMemo(()=>l?WWt(l):"",[l]);o.current=t,p.useEffect(()=>{var C;const O=document.body.style.overflow,S=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(C=s.current)==null||C.focus();const k=E=>{if(E.key==="Escape"){E.preventDefault(),o.current();return}if(E.key!=="Tab"||!s.current)return;const R=Array.from(s.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')).filter(T=>T.getClientRects().length>0);if(!R.length)return;const _=R[0],j=R[R.length-1];E.shiftKey&&document.activeElement===_?(E.preventDefault(),j.focus()):!E.shiftKey&&document.activeElement===j&&(E.preventDefault(),_.focus())};return window.addEventListener("keydown",k),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",k),S!=null&&S.isConnected&&S.focus()}},[]),p.useEffect(()=>{const O=new AbortController;return d(!0),h(""),HEe(e.id,i,O.signal).then(c).catch(S=>{(S==null?void 0:S.name)!=="AbortError"&&h(S instanceof Error?S.message:String(S))}).finally(()=>{O.signal.aborted||d(!1)}),()=>O.abort()},[e.id,m,i]),p.useEffect(()=>{if(b!=="copied")return;const O=window.setTimeout(()=>v("idle"),1500);return()=>window.clearTimeout(O)},[b]);const x=async()=>{try{await navigator.clipboard.writeText(y),v("copied")}catch{v("error")}};return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:O=>{O.target===O.currentTarget&&t()},children:a.jsxs("section",{ref:s,className:"environment-build-dialog environment-manifest-dialog",role:"dialog","aria-modal":"true","aria-labelledby":r,"aria-busy":u||void 0,tabIndex:-1,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("div",{className:"environment-build-dialog__title-row",children:a.jsx("h2",{id:r,children:n("environmentCenter.manifest.title")})}),a.jsxs("p",{children:[e.name," / ",i]})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":n("environmentCenter.manifest.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsx("div",{className:"environment-manifest-dialog__body",children:u?a.jsx("div",{className:"environment-manifest-dialog__state",role:"status",children:a.jsx(yn,{as:"span",children:n("environmentCenter.manifest.loading")})}):f?a.jsxs("div",{className:"environment-manifest-dialog__state is-error",role:"alert",children:[a.jsx("p",{children:f}),a.jsx(Dt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>g(O=>O+1),children:n("common.reload")})]}):a.jsx("div",{className:"environment-manifest-dialog__editor","aria-label":n("environmentCenter.manifest.editorLabel"),children:a.jsx(dT,{value:y,path:"environment.yaml",readOnly:!0,onChange:()=>{}})})}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[b==="error"?a.jsx("span",{className:"environment-manifest-dialog__copy-error",role:"alert",children:n("environmentCenter.manifest.copyFailed")}):null,a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:n("common.close")}),a.jsx(Dt,{type:"button",color:"info",size:"sm",disabled:!y,onClick:()=>void x(),children:n(b==="copied"?"environmentCenter.manifest.copied":"environmentCenter.manifest.copy")})]})]})}),document.body)}function mKt({environment:e,onClose:t,onBuildUpdate:n,onRebuild:i}){var k,C;const{t:r}=Ae("ui"),s=e.latestVersion,[o,l]=p.useState(s),[c,u]=p.useState(!!s),[d,f]=p.useState(""),[h,m]=p.useState(Date.now()),[g,b]=p.useState(!1),v=p.useId(),y=p.useRef(null),x=p.useRef(t),w=p.useRef(n);p.useEffect(()=>{x.current=t,w.current=n},[n,t]),p.useEffect(()=>{var j;const E=document.body.style.overflow,R=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(j=y.current)==null||j.focus();const _=T=>{var D;if(T.key==="Escape"&&x.current(),T.key!=="Tab")return;const N=Array.from(((D=y.current)==null?void 0:D.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'))??[]).filter(M=>M.getClientRects().length>0);if(!N.length)return;const A=N[0],P=N[N.length-1];T.shiftKey&&document.activeElement===A?(T.preventDefault(),P.focus()):!T.shiftKey&&document.activeElement===P&&(T.preventDefault(),A.focus())};return window.addEventListener("keydown",_),()=>{document.body.style.overflow=E,window.removeEventListener("keydown",_),R!=null&&R.isConnected&&R.focus()}},[]),p.useEffect(()=>{if(!s)return;let E=0;const R=new AbortController,_=async()=>{u(!0);try{const j=await VEe(e.id,s.versionId,{includeLogs:!0,signal:R.signal});l(j),f(""),w.current(j),Ub.has(j.status)&&(E=window.setTimeout(_,jse))}catch(j){if((j==null?void 0:j.name)==="AbortError")return;f(j instanceof Error?j.message:String(j)),E=window.setTimeout(_,jse)}finally{R.signal.aborted||u(!1)}};return _(),()=>{R.abort(),window.clearTimeout(E)}},[e.id,s==null?void 0:s.versionId]),p.useEffect(()=>{if(!o||!Ub.has(o.status))return;const E=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(E)},[o==null?void 0:o.status]);const O=o?V6e({...e,latestVersion:o},r):{label:r("environmentCenter.buildStatus.notBuilt"),color:"secondary"},S=e.imageSource||(C=(k=o==null?void 0:o.resources)==null?void 0:k.codePipeline)==null?void 0:C.consoleUrl;return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:a.jsxs("section",{ref:y,className:"environment-build-dialog",role:"dialog","aria-modal":"true","aria-labelledby":v,tabIndex:-1,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"environment-build-dialog__title-row",children:[a.jsx("h2",{id:v,children:r("environmentCenter.buildDetails.title")}),a.jsx(Io,{color:O.color,size:"sm",children:O.label})]}),a.jsx("p",{children:e.name})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":r("environmentCenter.buildDetails.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsxs("div",{className:"environment-build-dialog__summary",children:[a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.currentStep")}),a.jsx("strong",{children:(o==null?void 0:o.currentStep)||r("environmentCenter.buildDetails.waiting")})]}),a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.elapsed")}),a.jsx("strong",{children:o?hKt(o,r,h):"-"})]}),o!=null&&o.sourceCommitSha?a.jsxs("div",{children:[a.jsx("span",{children:r("environmentCenter.buildDetails.sourceCommit")}),a.jsx("strong",{title:o.sourceCommitSha,children:o.sourceCommitSha.slice(0,12)})]}):null,S?a.jsxs("a",{href:S,target:"_blank",rel:"noreferrer",children:[r("environmentCenter.buildDetails.openCodePipeline")," ",a.jsx(my,{"aria-hidden":!0})]}):null]}),a.jsxs("div",{className:"environment-build-dialog__body",children:[d?a.jsx("p",{className:"environment-build-dialog__error",role:"alert",children:d}):null,o!=null&&o.progressError?a.jsx("p",{className:"environment-build-dialog__notice",children:o.progressError}):null,a.jsx(kWt,{steps:(o==null?void 0:o.steps)??[],log:(o==null?void 0:o.logTail)??"",logError:o==null?void 0:o.logError,logTruncated:o==null?void 0:o.logTruncated,logUpdatedAt:o==null?void 0:o.logUpdatedAt,loading:c&&!!(o&&Ub.has(o.status))}),(o==null?void 0:o.status)==="failed"&&o.error?a.jsx("p",{className:"environment-build-dialog__failure",role:"alert",children:o.error}):null]}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:r("common.close")}),o&&!e.imageSource&&!Ub.has(o.status)?a.jsx(Dt,{type:"button",color:"info",size:"sm",disabled:g,onClick:()=>{b(!0),i().then(t).finally(()=>b(!1))},children:r(g?"environmentCenter.buildDetails.starting":"environmentCenter.buildDetails.rebuild")}):null]})]})}),document.body)}function H6e({cloudProvider:e,value:t,disabled:n,onChange:i}){const{t:r}=Ae("ui"),s=Jc(e).map(o=>({value:o.value,label:o.label}));return a.jsxs("label",{className:"environment-field environment-region-field",children:[a.jsxs("span",{children:[r("environmentCenter.region"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-region",value:t,options:s,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:n,triggerClassName:"environment-select-trigger",onChange:o=>i(o.value)})]})}function gKt({repositoryUrl:e,gitRef:t,dockerfilePath:n,inspection:i,inspectedKey:r,disabled:s,onRepositoryUrlChange:o,onGitRefChange:l,onDockerfilePathChange:c,onInspectionChange:u,onInspectedKeyChange:d}){const{t:f}=Ae("ui"),[h,m]=p.useState(!1),[g,b]=p.useState(""),v=p.useRef(null),y=p.useRef(""),x=`${e.trim()}\0${t.trim()}`,w=r===x;p.useEffect(()=>()=>{const C=v.current;v.current=null,C==null||C.abort()},[]);const O=()=>{var C;(C=v.current)==null||C.abort(),v.current=null,m(!1),b(""),u(null),d(""),c(""),y.current=""},S=p.useCallback(async()=>{var R;const C=QB(e,f);if(C){b(C);return}y.current=x,(R=v.current)==null||R.abort();const E=new AbortController;v.current=E,m(!0),b("");try{const _=await MEe({repositoryUrl:e.trim(),...t.trim()?{ref:t.trim()}:{}},E.signal);if(v.current!==E)return;u(_),d(x),c(_.dockerfiles.length===1?_.dockerfiles[0]:"")}catch(_){if((_==null?void 0:_.name)==="AbortError")return;b(oKt(_)),u(null),d(""),c("")}finally{v.current===E&&(v.current=null,m(!1))}},[x,t,c,d,u,e,f]);p.useEffect(()=>{if(s||w||y.current===x||QB(e,f))return;const C=window.setTimeout(()=>void S(),600);return()=>window.clearTimeout(C)},[x,s,S,w,e,f]);const k=w?(i==null?void 0:i.dockerfiles)??[]:[];return a.jsxs("section",{className:"environment-source-section","aria-label":f("environmentCenter.git.sectionLabel"),children:[a.jsxs("div",{className:"environment-form-grid environment-git-fields",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[f("environmentCenter.git.address"),a.jsx(vd,{})]}),a.jsx(hs,{size:"lg",type:"url",required:!0,value:e,placeholder:"https://github.com/owner/repository.git",autoComplete:"url",disabled:s,"aria-invalid":!!g,onChange:C=>{O(),o(C.currentTarget.value)}})]}),a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:f("environmentCenter.git.ref")}),a.jsx(hs,{size:"lg",value:t,placeholder:f("environmentCenter.git.defaultBranch"),autoComplete:"off",disabled:s,onChange:C=>{O(),l(C.currentTarget.value)}})]})]}),a.jsxs("div",{className:"environment-inspection-status environment-form-feedback","aria-live":"polite",children:[h?a.jsx(yn,{as:"span",children:f("environmentCenter.git.inspecting")}):null,g?a.jsxs("div",{className:"environment-source-error",role:"alert",children:[a.jsx("span",{children:g}),a.jsxs(Dt,{type:"button",color:"primary",size:"sm",pill:!1,disabled:s,onClick:()=>void S(),children:[a.jsx(ZI,{}),f("common.retry")]})]}):null,!h&&!g&&w&&i?k.length>0?a.jsx("span",{children:i.commitSha?f("environmentCenter.git.foundDockerfiles",{commit:i.commitSha.slice(0,12),count:k.length}):f("environmentCenter.git.savedDockerfileLoaded")}):a.jsxs("div",{className:"environment-source-error",role:"alert",children:[a.jsx("span",{children:f("environmentCenter.git.noDockerfile")}),a.jsx("button",{type:"button",disabled:s,onClick:()=>void S(),children:f("environmentCenter.git.inspectAgain")})]}):null]}),k.length>0?a.jsxs("label",{className:"environment-field environment-dockerfile-picker",children:[a.jsxs("span",{children:["Dockerfile",a.jsx(vd,{})]}),a.jsx(Ag,{ariaLabel:f("environmentCenter.git.selectDockerfile"),value:n,valueLabel:n,placeholder:f("environmentCenter.git.selectDockerfile"),options:k.map(C=>({value:C,label:C})),disabled:s||h,onChange:c})]}):null]})}function bKt({cloudProvider:e,mode:t,region:n,value:i,disabled:r,onModeChange:s,onRegionChange:o,onChange:l}){const{t:c}=Ae("ui");return a.jsx("section",{className:"environment-source-section","aria-label":c("environmentCenter.repository.outputSection"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[c("environmentCenter.repository.type"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-repository-mode",value:t,options:tKt(c),optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:r,triggerClassName:"environment-select-trigger",onChange:u=>s(u.value)})]}),a.jsx(H6e,{cloudProvider:e,value:n,disabled:r,onChange:o}),t==="existing"?a.jsx(B6e,{region:n,value:i,disabled:r,onChange:l}):a.jsx("p",{className:"environment-source-note environment-form-feedback",children:c("environmentCenter.repository.managedHint")})]})})}function yKt({cloudProvider:e,region:t,repository:n,reference:i,disabled:r,onRegionChange:s,onRepositoryChange:o,onReferenceChange:l}){const{t:c}=Ae("ui"),u=z6e(i,c);return a.jsx("section",{className:"environment-source-section","aria-label":c("environmentCenter.existingImage.sectionLabel"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsx(H6e,{cloudProvider:e,value:t,disabled:r,onChange:s}),a.jsx(B6e,{region:t,value:n,disabled:r,onChange:o}),a.jsxs("label",{className:"environment-field environment-image-reference",children:[a.jsxs("span",{children:[c("environmentCenter.existingImage.reference"),a.jsx(vd,{})]}),a.jsx(hs,{size:"lg",value:i,required:!0,placeholder:c("environmentCenter.existingImage.placeholder"),autoComplete:"off",disabled:r,"aria-invalid":!!u,onChange:d=>l(d.currentTarget.value)}),u?a.jsx("small",{className:"environment-source-field__error",role:"alert",children:u}):a.jsx("small",{children:c("environmentCenter.existingImage.hint")})]})]})})}function q6e(e,t,n,i){const r=p.useRef(n),s=p.useRef(i);r.current=n,s.current=i,p.useEffect(()=>{const o=document.body.style.overflow,l=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden";const c=window.requestAnimationFrame(()=>{var d;return(d=t.current)==null?void 0:d.focus()}),u=d=>{var g;if(d.key==="Escape"&&!s.current){d.preventDefault(),r.current();return}if(d.key!=="Tab")return;const f=Array.from(((g=e.current)==null?void 0:g.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(b=>b.getClientRects().length>0);if(!f.length)return;const h=f[0],m=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),h.focus())};return window.addEventListener("keydown",u),()=>{window.cancelAnimationFrame(c),document.body.style.overflow=o,window.removeEventListener("keydown",u),l!=null&&l.isConnected&&l.focus()}},[e,t])}function vKt({environment:e,onClose:t}){const{t:n}=Ae("ui"),i=p.useId(),r=p.useId(),s=p.useRef(null),o=p.useRef(null),[l,c]=p.useState(""),[u,d]=p.useState("loading"),[f,h]=p.useState(""),m=u==="loading";q6e(s,o,t,m);const g=async(b="",v)=>{d("loading"),h("");try{const y=b||(await LEe(e.id,v)).shareCode;c(y),await CEe(y),v!=null&&v.aborted||d("copied")}catch(y){if((y==null?void 0:y.name)==="AbortError")return;h(y instanceof Error?y.message:String(y)),d("error")}};return p.useEffect(()=>{const b=new AbortController;return g("",b.signal),()=>b.abort()},[e.id]),ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:b=>{b.target===b.currentTarget&&!m&&t()},children:a.jsxs("section",{ref:s,className:"environment-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":i,"aria-describedby":r,"aria-busy":m||void 0,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:i,children:n("environmentCenter.share.title")}),a.jsx("p",{id:r,children:e.name})]}),a.jsx(Dt,{ref:o,type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:m,onClick:t,"aria-label":n("environmentCenter.share.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsx("div",{className:"environment-share-dialog__body",children:u==="loading"?a.jsx(yn,{as:"p",children:n("environmentCenter.share.generating")}):a.jsxs("div",{className:"environment-share-dialog__result",children:[u==="copied"?a.jsx("p",{className:"environment-share-dialog__success",role:"status","aria-live":"polite",children:n("environmentCenter.share.copied")}):a.jsxs("div",{className:"environment-share-dialog__error",role:"alert",children:[a.jsx("strong",{children:n("environmentCenter.share.failed")}),a.jsx("span",{children:f})]}),l?a.jsxs("label",{className:"environment-share-dialog__field environment-share-dialog__manual-code",children:[a.jsx("span",{children:n("environmentCenter.share.code")}),a.jsx(Og,{size:"lg",rows:4,value:l,readOnly:!0,"aria-label":n("environmentCenter.share.fullCode"),onFocus:b=>b.currentTarget.select(),onClick:b=>b.currentTarget.select()}),a.jsx("small",{children:n(u==="copied"?"environmentCenter.share.copiedHint":"environmentCenter.share.copyFailedHint")})]}):null,a.jsx("p",{className:"environment-share-dialog__safety",children:n("environmentCenter.share.safety")})]})}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:m,onClick:t,children:n("common.close")}),u==="error"?a.jsx(Dt,{type:"button",color:"info",size:"sm",onClick:()=>void g(l),children:n("common.retry")}):u==="copied"?a.jsx(Dt,{type:"button",color:"info",size:"sm",onClick:()=>void g(l),children:n("environmentCenter.share.copyAgain")}):null]})]})}),document.body)}function xKt({initialValue:e,autoInspect:t,onClose:n,onImported:i}){const{t:r}=Ae("ui"),s=p.useId(),o=p.useId(),l=p.useId(),c=p.useRef(null),u=p.useRef(null),d=p.useRef(!1),[f,h]=p.useState(e),[m,g]=p.useState("editing"),[b,v]=p.useState([]),[y,x]=p.useState(""),[w,O]=p.useState([]),S=p.useMemo(()=>pU(f),[f]),k=S.length>UB,C=m==="inspecting"||m==="importing",E=b.filter(A=>A.status==="valid"),R=b.filter(A=>A.status==="invalid"),_=m==="ready"&&E.length>0;q6e(c,u,n,C);const j=p.useCallback(async()=>{if(!(!S.length||k)){g("inspecting"),x(""),O([]);try{const A=await $Ee(S);v([...A].sort((P,D)=>P.index-D.index)),g("ready")}catch(A){x(A instanceof Error?A.message:String(A)),g("editing")}}},[S,k]);p.useEffect(()=>{!t||d.current||(d.current=!0,j())},[t,j]);const T=async()=>{if(_){g("importing"),x(""),O([]);try{const A=E.map(F=>({code:S[F.index],name:F.name})).filter(F=>!!F.code),P=await FEe(A.map(F=>F.code)),D=P.filter(F=>F.status==="created").length,M=P.filter(F=>F.status==="duplicate").length,L=new Map(P.map(F=>[F.index,F])),U=A.flatMap(({code:F,name:W},V)=>{const X=L.get(V);return!X||X.status==="failed"?[{code:F,name:W,status:"valid",error:(X==null?void 0:X.error)||r("environmentCenter.import.noResult")}]:[]}),H=[...R.flatMap(F=>{const W=S[F.index];return W?[{code:W,name:"",status:"invalid",error:F.error||r("environmentCenter.import.invalidCode")}]:[]}),...U],K=new Map;if(P.forEach(F=>{F.environment&&K.set(F.environment.id,F.environment)}),i([...K.values()],D,M,H.length),!H.length){n();return}h(H.map(F=>F.code).join(` +`)),O(U),v(H.map((F,W)=>({index:W,status:F.status,name:F.name,error:F.status==="invalid"?F.error:""}))),x(r("environmentCenter.import.partial",{created:D,remaining:H.length})),g("ready")}catch(A){x(A instanceof Error?A.message:String(A)),g("ready")}}},N=m==="inspecting"?r("environmentCenter.import.inspecting"):m==="importing"?r("environmentCenter.import.importing"):_?w.length?r("environmentCenter.import.retryImport"):r("environmentCenter.import.confirm"):r("environmentCenter.import.inspectCodes");return ri.createPortal(a.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:A=>{A.target===A.currentTarget&&!C&&n()},children:a.jsxs("section",{ref:c,className:"environment-share-dialog environment-import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":s,"aria-describedby":o,"aria-busy":C||void 0,children:[a.jsxs("header",{className:"environment-build-dialog__header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:s,children:r("environmentCenter.import.title")}),a.jsx("p",{id:o,children:r("environmentCenter.import.description")})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:C,onClick:n,"aria-label":r("environmentCenter.import.closeLabel"),children:a.jsx(xa,{"aria-hidden":!0})})]}),a.jsxs("div",{className:"environment-share-dialog__body",children:[a.jsxs("label",{className:"environment-share-dialog__field",children:[a.jsx("span",{children:r("environmentCenter.import.code")}),a.jsx(Og,{ref:u,size:"lg",rows:6,value:f,disabled:C,"aria-invalid":k||R.length>0||void 0,"aria-describedby":l,placeholder:"akenv://v1/...",onChange:A=>{h(A.currentTarget.value),g("editing"),v([]),x(""),O([])}})]}),a.jsx("p",{id:l,className:`environment-share-dialog__help${k?" is-error":""}`,children:k?r("environmentCenter.import.tooMany",{max:UB,count:S.length}):r("environmentCenter.import.multipleHint")}),a.jsx("p",{className:"environment-share-dialog__safety",children:r("environmentCenter.import.safety")}),m==="inspecting"?a.jsx(yn,{as:"p",children:r("environmentCenter.import.inspectingCodes")}):E.length?a.jsx("p",{className:"environment-share-dialog__summary",role:"status","aria-live":"polite",children:r("environmentCenter.import.found",{count:E.length,names:E.map(A=>A.name||r("environmentCenter.unnamed")).join(r("environmentCenter.listSeparator"))})}):null,R.length?a.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:R.map(A=>a.jsx("li",{children:r("environmentCenter.import.itemError",{index:A.index+1,error:A.error||r("environmentCenter.import.invalidCode")})},A.index))}):null,w.length?a.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:w.map((A,P)=>a.jsx("li",{children:r("environmentCenter.import.itemError",{index:P+1,error:A.error})},`${A.code}:${P}`))}):null,y?a.jsx("p",{className:"environment-share-dialog__error-text",role:"alert",children:y}):null]}),a.jsxs("footer",{className:"environment-build-dialog__actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:C,onClick:n,children:r("common.cancel")}),a.jsx(Dt,{type:"button",color:"info",size:"sm",loading:C,disabled:C||!S.length||k||m==="ready"&&!_,onClick:()=>_?void T():void j(),children:N})]})]})}),document.body)}function wKt({environment:e,cloudProvider:t,onCancel:n,onDelete:i,onShare:r,onSave:s}){var qe,De,At,It,lt,Ot,Ct;const{t:o,i18n:l}=Ae("ui"),c=XWt(o),u=uKt(e,t),d=u.dockerfile!==void 0,[f,h]=p.useState(()=>({...u,dockerfile:d?void 0:u.dockerfile})),[m,g]=p.useState(u.gitSource?"git":u.imageSource?"image":d?"dockerfile":"custom"),[b,v]=p.useState(d?(e==null?void 0:e.dockerfile)??"":""),[y,x]=p.useState(""),w=p.useRef(null),[O,S]=p.useState(()=>d?JWt((e==null?void 0:e.dockerfile)??""):u.baseEnvironment==="aio-sandbox"||u.baseEnvironment==="codex-sandbox"?u.baseEnvironment:"none"),[k,C]=p.useState(((qe=u.gitSource)==null?void 0:qe.repositoryUrl)??""),[E,R]=p.useState(((De=u.gitSource)==null?void 0:De.ref)??""),[_,j]=p.useState(((At=u.gitSource)==null?void 0:At.dockerfilePath)??""),[T,N]=p.useState(u.gitSource?{repositoryUrl:u.gitSource.repositoryUrl,ref:u.gitSource.ref??"",commitSha:"",dockerfiles:[u.gitSource.dockerfilePath]}:null),[A,P]=p.useState(u.gitSource?`${u.gitSource.repositoryUrl}\0${u.gitSource.ref??""}`:""),[D,M]=p.useState(u.containerRepository?"existing":"managed"),[L,U]=p.useState(((It=u.containerRepository)==null?void 0:It.region)??Ki(t)),[I,H]=p.useState(u.containerRepository??void 0),[K,F]=p.useState(((lt=u.imageSource)==null?void 0:lt.region)??Ki(t)),[W,V]=p.useState(u.imageSource?{region:u.imageSource.region,registry:u.imageSource.registry,namespace:u.imageSource.namespace,repository:u.imageSource.repository}:void 0),[X,ie]=p.useState(((Ot=u.imageSource)==null?void 0:Ot.reference)??""),[Q,Z]=p.useState(!1),ce=p.useMemo(()=>xz(f,t),[t,f.baseEnvironment,f.operatingSystem,f.language,f.optionIds]),Ee=f.dockerfile??ce,Y=O!=="none",G=O==="aio-sandbox"?yz:O==="codex-sandbox"?TRe[t]:"",te=Y?VWt(b):b,ye=Y?gj(G,""):"",Ne=Y?gj(G,te):b,pe=y||(Y?HWt(te,G,o):qH(b,void 0,o)),me=!!e,se="environment-editor-form",[Se,Le]=p.useState(!1),[be,Ve]=p.useState(""),ve=!!Ne.trim()&&!pe,Re=`${k.trim()}\0${E.trim()}`,ne=!QB(k,o)&&A===Re&&!!_&&(D==="managed"||_se(I)),ge=_se(W)&&!!X.trim()&&!z6e(X,o),Ce=!!f.name.trim()&&!Se&&(m==="custom"||m==="dockerfile"&&ve||m==="git"&&ne||m==="image"&&ge),ke=(dt,yt)=>{h(Ie=>({...Ie,optionIds:yt?[...Ie.optionIds,dt]:Ie.optionIds.filter(vt=>vt!==dt)}))},Ke=dt=>{x(""),v(Y?gj(G,dt):dt)},it=async dt=>{if(!dt)return;const yt=await qWt(dt,o);x(yt.error),yt.content&&v(yt.content)},ue=()=>{x(""),v(ye)},xe=async dt=>{if(dt.preventDefault(),!!Ce){Le(!0),Ve("");try{const yt=ixt(Ne);await s({...f,name:f.name.trim(),description:f.description.trim(),optionIds:m==="custom"?f.optionIds:[],selectedSkills:m==="custom"?f.selectedSkills:[],dockerfile:m==="dockerfile"?Ne:m==="custom"?Ee:"",gitSource:m==="git"?{repositoryUrl:k.trim(),...E.trim()?{ref:E.trim()}:{},dockerfilePath:_}:null,containerRepository:m==="git"&&D==="existing"?I:null,imageSource:m==="image"&&W?{...W,reference:X.trim()}:null,...m==="dockerfile"?yt:{}})}catch(yt){Ve(yt instanceof Error?yt.message:String(yt)),Le(!1)}}},Te=f.name.trim()||(me?(e==null?void 0:e.name)||o("environmentCenter.configure"):o("environmentCenter.create"));return a.jsx(Df,{className:"environment-editor","aria-label":o(me?"environmentCenter.details":"environmentCenter.create"),children:a.jsx(LC,{title:Te,description:o("environmentCenter.editorDescription"),identitySeed:Te,backLabel:o("environmentCenter.backToList"),onBack:n,actions:a.jsxs(a.Fragment,{children:[i?a.jsx(Dt,{type:"button",color:"danger",variant:"ghost",size:"sm",onClick:i,disabled:Se,children:o("common.delete")}):null,r?a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:r,disabled:Se,children:o("environmentCenter.share.action")}):null,a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:n,disabled:Se,children:o("common.cancel")}),a.jsx(Dt,{color:"info",size:"sm",type:"submit",form:se,disabled:!Ce,children:o(Se?"common.saving":m==="image"?me?"environmentCenter.save":"environmentCenter.create":me?"environmentCenter.saveAndBuild":"environmentCenter.createAndBuild")})]}),children:a.jsxs("form",{id:se,className:"environment-form",onSubmit:xe,children:[a.jsxs("div",{className:"environment-fields",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.name"),a.jsx(vd,{})]}),a.jsx(hs,{className:"environment-text-input",type:"text",size:"lg",required:!0,value:f.name,maxLength:60,placeholder:o("environmentCenter.namePlaceholder"),onChange:dt=>h(yt=>({...yt,name:dt.target.value}))})]}),a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:o("common.description")}),a.jsx(Og,{className:"environment-description-input",size:"lg",rows:3,value:f.description,maxLength:180,placeholder:o("environmentCenter.descriptionPlaceholder"),onChange:dt=>h(yt=>({...yt,description:dt.target.value}))})]})]}),a.jsxs("label",{className:"environment-field environment-creation-method",children:[a.jsxs("span",{children:[o("environmentCenter.creationMethod"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-creation-method",value:m,options:c,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{const yt=dt.value;g(yt),yt==="dockerfile"&&!b.trim()&&v(ye),Ve("")}}),a.jsx("small",{children:(Ct=c.find(dt=>dt.value===m))==null?void 0:Ct.description})]}),be?a.jsx("p",{className:"environment-form-error",role:"alert",children:be}):null,m==="custom"?a.jsxs("div",{className:"environment-configuration",children:[a.jsx("section",{className:"environment-section environment-form-section","aria-label":o("environmentCenter.baseConfiguration"),children:a.jsxs("div",{className:"environment-form-grid",children:[a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.baseEnvironment"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-base-environment",value:f.baseEnvironment,options:YWt.map(dt=>({...dt,description:o(`environmentCenter.baseDescriptions.${dt.value}`)})),optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{const yt=dt.value,Ie=yt==="aio-sandbox"||yt==="codex-sandbox";h(vt=>({...vt,baseEnvironment:yt,operatingSystem:Ie?"ubuntu-22.04":vt.operatingSystem,language:Ie?"python-3.12":vt.language}))}}),a.jsx("small",{children:o(`environmentCenter.baseDescriptions.${f.baseEnvironment}`)})]}),a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.operatingSystem"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-operating-system",value:f.operatingSystem,options:eKt,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:f.baseEnvironment!=="ubuntu",triggerClassName:"environment-select-trigger",onChange:dt=>h(yt=>({...yt,operatingSystem:dt.value}))}),a.jsx("small",{children:f.baseEnvironment!=="ubuntu"?o("environmentCenter.fixedByBase",{base:HF(f.baseEnvironment),value:"Ubuntu 22.04"}):o("environmentCenter.selectUbuntuVersion")})]}),a.jsxs("label",{className:"environment-field",children:[a.jsxs("span",{children:[o("environmentCenter.pythonVersion"),a.jsx(vd,{})]}),a.jsx(Xs,{id:"environment-python-version",value:f.language,options:f.baseEnvironment!=="ubuntu"?Tse.filter(dt=>dt.value==="python-3.12"):Tse,optionClassName:"environment-select-option",required:!0,size:"lg",block:!0,pill:!1,disabled:f.baseEnvironment!=="ubuntu",triggerClassName:"environment-select-trigger",onChange:dt=>h(yt=>({...yt,language:dt.value}))}),a.jsx("small",{children:f.baseEnvironment!=="ubuntu"?o("environmentCenter.fixedByBase",{base:HF(f.baseEnvironment),value:"Python 3.12"}):o("environmentCenter.selectPythonVersion")})]})]})}),a.jsxs("section",{className:"environment-section","aria-labelledby":"environment-skills-title",children:[a.jsx("h2",{id:"environment-skills-title",children:o("environmentCenter.skills")}),a.jsxs("div",{className:"environment-skill-grid",children:[a.jsx(Cse,{name:"VeADK",description:o("environmentCenter.veadkDescription"),selected:Q,disabled:Se,onChange:Z,icon:a.jsx("img",{src:pP,alt:""})}),a.jsx(HH,{selected:f.selectedSkills,onChange:dt=>h(yt=>({...yt,selectedSkills:dt})),cloudProvider:t,disabled:Se,addLabel:o("environmentCenter.addSkill"),showSelectedCount:!1})]})]}),vz.map(dt=>a.jsxs("section",{className:"environment-section","aria-labelledby":`environment-${dt.id}-title`,children:[a.jsx("h2",{id:`environment-${dt.id}-title`,children:o(`environmentCenter.categories.${dt.id}`)}),a.jsx("div",{className:"environment-option-grid",children:dt.options.map(yt=>{const Ie=f.optionIds.includes(yt.id);return a.jsx(Cse,{name:yt.label,description:o(`environmentCenter.options.${yt.id}`,{defaultValue:yt.description}),selected:Ie,onChange:vt=>ke(yt.id,vt),icon:a.jsx(cKt,{option:yt})},yt.id)})})]},dt.id))]}):m==="dockerfile"?a.jsxs("section",{className:"environment-upload","aria-label":o("environmentCenter.customDockerfile"),children:[a.jsx("div",{className:"environment-dockerfile-settings environment-form-grid",children:a.jsxs("label",{className:"environment-field",children:[a.jsx("span",{children:o("environmentCenter.presetEnvironment")}),a.jsx(Xs,{id:"environment-dockerfile-base-environment",value:O,options:ZWt(o),optionClassName:"environment-select-option",size:"lg",block:!0,pill:!1,triggerClassName:"environment-select-trigger",onChange:dt=>{x(""),S(dt.value)}}),a.jsx("small",{children:o("environmentCenter.presetHint")})]})}),a.jsxs("div",{className:"environment-upload__preview",children:[a.jsxs("div",{children:[a.jsxs("h3",{children:["Dockerfile",a.jsx(vd,{})]}),a.jsxs("div",{className:"environment-upload__actions",children:[a.jsx("span",{className:"environment-upload__size",children:o("environmentCenter.dockerfileSize",{size:$6e(Ne).toLocaleString(l.resolvedLanguage??l.language),max:131072 .toLocaleString(l.resolvedLanguage??l.language)})}),a.jsx("input",{ref:w,className:"environment-upload__file-input",type:"file",accept:".dockerfile,text/plain",tabIndex:-1,hidden:!0,onChange:dt=>{var Ie;const yt=dt.currentTarget;it((Ie=yt.files)==null?void 0:Ie[0]).finally(()=>{yt.value=""})}}),a.jsx(Dt,{className:"environment-upload__action",type:"button",color:"secondary",variant:"soft",size:"sm",pill:!1,disabled:Se,onClick:()=>{var dt;return(dt=w.current)==null?void 0:dt.click()},children:o("environmentCenter.upload")}),a.jsx(Dt,{className:"environment-upload__action",type:"button",color:"secondary",variant:"ghost",size:"sm",pill:!1,disabled:Se||!te,onClick:ue,children:o("environmentCenter.reset")})]})]}),a.jsxs("div",{className:`environment-dockerfile-editor${Y?" has-fixed-base":""}${pe?" is-invalid":""}`,children:[Y?a.jsxs("div",{className:"environment-dockerfile-from","aria-label":o("environmentCenter.dockerfileBaseImage"),children:[a.jsx("span",{className:"environment-dockerfile-from__line","aria-hidden":"true",children:"1"}),a.jsxs("code",{children:[a.jsx("span",{className:"environment-dockerfile-from__keyword",children:"FROM"}),a.jsx("span",{title:G,children:G})]})]}):null,a.jsx("div",{className:"environment-dockerfile__editor environment-upload__editor","aria-label":o("environmentCenter.dockerfileContent"),children:a.jsx(dT,{value:te,path:"Dockerfile",lineNumberStart:Y?2:1,height:"auto",minHeight:"28px",maxHeight:"var(--environment-dockerfile-editor-max-height)",onChange:Ke})})]})]}),pe?a.jsx("p",{className:"environment-upload__error environment-upload__error--below",role:"alert",children:pe}):null]}):m==="git"?a.jsxs("div",{className:"environment-source-workflow",children:[a.jsx(gKt,{repositoryUrl:k,gitRef:E,dockerfilePath:_,inspection:T,inspectedKey:A,disabled:Se,onRepositoryUrlChange:C,onGitRefChange:R,onDockerfilePathChange:j,onInspectionChange:N,onInspectedKeyChange:P}),a.jsx(bKt,{cloudProvider:t,mode:D,region:L,value:I,disabled:Se,onModeChange:dt=>{M(dt),Ve("")},onRegionChange:dt=>{U(dt),H(void 0),Ve("")},onChange:H})]}):a.jsx(yKt,{cloudProvider:t,region:K,repository:W,reference:X,disabled:Se,onRegionChange:dt=>{F(dt),V(void 0),Ve("")},onRepositoryChange:V,onReferenceChange:ie})]})})})}function W6e({cloudProvider:e="volcengine",onWorkspace:t,onProjects:n,clipboardImport:i=null,clipboardReadError:r=""}){const{t:s,i18n:o}=Ae("ui"),[l,c]=p.useState([]),[u,d]=p.useState({kind:"list"}),[f,h]=p.useState(""),[m,g]=p.useState(null),[b,v]=p.useState(null),[y,x]=p.useState(null),[w,O]=p.useState(null),[S,k]=p.useState(null),C=p.useRef(0),[E,R]=p.useState(""),[_,j]=p.useState(!1),[T,N]=p.useState(r),[A,P]=p.useState(!0),[D,M]=p.useState(""),[L,U]=p.useState(0),[I,H]=p.useState(()=>new Set),K=p.useDeferredValue(f),F=p.useMemo(()=>{const Y=K.trim().toLocaleLowerCase();return Y?l.filter(G=>`${G.name} ${G.description} ${VF(G.operatingSystem)} ${Xh(G.language)} ${HF(G.baseEnvironment)}`.toLocaleLowerCase().includes(Y)):l},[K,l]),W=p.useCallback((Y="",G=!1)=>{C.current+=1,k({key:C.current,initialValue:Y,autoInspect:G})},[]),V=p.useCallback((Y,G=!1)=>{const te=Y.trim();if(!te.startsWith("akenv://")||!G&&Ase.has(te))return!1;const ye=pU(te);return!ye.length||ye.length>UB?!1:(Ase.add(te),N(""),W(te,!0),!0)},[W]),X=p.useCallback(async()=>{var Y;if(!(u.kind!=="list"||S)){if(typeof navigator>"u"||!((Y=navigator.clipboard)!=null&&Y.readText)){N(s("environmentCenter.clipboardUnsupported"));return}try{const G=await navigator.clipboard.readText();!V(G)&&!G.trim()&&await nKt()&&N(s("environmentCenter.clipboardReadError"))}catch{N(s("environmentCenter.clipboardReadError"))}}},[S,V,s,u.kind]);p.useEffect(()=>{const Y=new AbortController;return l.length===0&&P(!0),M(""),fC(Y.signal).then(G=>{c(G)}).catch(G=>{(G==null?void 0:G.name)!=="AbortError"&&M(G instanceof Error?G.message:String(G))}).finally(()=>{Y.signal.aborted||P(!1)}),()=>Y.abort()},[L]),p.useEffect(()=>{if(!l.some(G=>G.latestVersion&&Ub.has(G.latestVersion.status)))return;const Y=window.setTimeout(()=>U(G=>G+1),2500);return()=>window.clearTimeout(Y)},[l]),p.useEffect(()=>{if(!E||_)return;const Y=window.setTimeout(()=>R(""),2800);return()=>window.clearTimeout(Y)},[_,E]),p.useEffect(()=>{r&&N(r)},[r]),p.useEffect(()=>{i&&V(i.text)},[i,V]),p.useEffect(()=>{if(u.kind!=="list")return;const Y=()=>void X(),G=()=>{document.visibilityState==="visible"&&X()},te=ye=>{var me;const Ne=ye.target;if(Ne instanceof HTMLInputElement||Ne instanceof HTMLTextAreaElement||Ne instanceof HTMLElement&&Ne.isContentEditable)return;const pe=((me=ye.clipboardData)==null?void 0:me.getData("text/plain"))??"";V(pe,!0)&&ye.preventDefault()};return window.addEventListener("focus",Y),document.addEventListener("visibilitychange",G),window.addEventListener("paste",te),()=>{window.removeEventListener("focus",Y),document.removeEventListener("visibilitychange",G),window.removeEventListener("paste",te)}},[V,X,u.kind]);const ie=u.kind==="editor"&&u.environmentId?l.find(Y=>Y.id===u.environmentId):void 0,Q=async Y=>{const G={...Y,dockerfile:Y.dockerfile??xz(Y,e)},te=ie?await QEe(ie.id,G):await UEe(G);if(c(ye=>[te,...ye.filter(Ne=>Ne.id!==te.id)]),d({kind:"list"}),j(!1),G.imageSource){R(s("environmentCenter.status.boundImage",{name:te.name}));return}try{const ye=await I6(te.id);c(Ne=>Ne.map(pe=>pe.id===te.id?{...pe,latestVersion:ye}:pe)),R(s("environmentCenter.status.queued",{name:te.name}))}catch(ye){j(!0),R(s("environmentCenter.status.savedBuildFailed",{error:ye instanceof Error?ye.message:String(ye)}))}},Z=async Y=>{if(!I.has(Y.id)){H(G=>new Set(G).add(Y.id)),j(!1);try{const G=await I6(Y.id);c(te=>te.map(ye=>ye.id===Y.id?{...ye,latestVersion:G}:ye)),R(s("environmentCenter.status.queued",{name:Y.name}))}catch(G){j(!0),R(G instanceof Error?G.message:String(G))}finally{H(G=>{const te=new Set(G);return te.delete(Y.id),te})}}},ce=(Y,G,te,ye)=>{Y.length&&c(Ne=>{const pe=new Set(Y.map(me=>me.id));return[...Y,...Ne.filter(me=>!pe.has(me.id))]}),j(ye>0),R(ye>0?s("environmentCenter.status.importedFailed",{created:G,failed:ye}):te>0?s("environmentCenter.status.importedDuplicate",{created:G,duplicate:te}):s("environmentCenter.status.imported",{count:G}))},Ee=m?a.jsx(Gu,{title:s("environmentCenter.deleteTitle"),description:s("environmentCenter.deleteDescription",{name:m.name}),confirmLabel:s("common.delete"),variant:"danger",onCancel:()=>g(null),onConfirm:()=>{const Y=m;g(null),d({kind:"list"}),zEe(Y.id).then(()=>{c(G=>G.filter(te=>te.id!==Y.id)),j(!1),R(s("environmentCenter.status.deleted",{name:Y.name}))}).catch(G=>{j(!0),R(G instanceof Error?G.message:String(G))})}}):null;return u.kind==="editor"?a.jsxs(a.Fragment,{children:[a.jsx(wKt,{environment:ie,cloudProvider:e,onCancel:()=>d({kind:"list"}),onDelete:ie?()=>g(ie):void 0,onShare:ie?()=>O(ie):void 0,onSave:Q},u.environmentId??"new"),w?a.jsx(vKt,{environment:w,onClose:()=>O(null)}):null,Ee]}):a.jsxs(zH,{section:"environments",className:"environment-center",onWorkspace:t,onProjects:n,actions:a.jsxs(a.Fragment,{children:[E?a.jsx("span",{className:`environment-status${_?" is-error":""}`,role:_?"alert":"status","aria-live":"polite",children:E}):null,a.jsx(hp,{"aria-label":s("environmentCenter.search"),value:f,onChange:Y=>h(Y.target.value),placeholder:s("environmentCenter.search")})]}),children:[T?a.jsxs("div",{className:"environment-clipboard-notice",role:"alert",children:[a.jsx("span",{children:T}),a.jsx(Dt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>{N(""),W()},children:s("environmentCenter.manualImport")})]}):null,a.jsx(Rg,{"aria-live":"polite",children:A?a.jsx(Fa,{}):D?a.jsxs("div",{className:"environment-load-error",role:"alert",children:[a.jsx("p",{children:Fu(D,o.resolvedLanguage||o.language)||s("environmentCenter.loadFailed")}),a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>U(Y=>Y+1),children:s("common.reload")})]}):F.length===0&&f.trim()?a.jsx("div",{className:"environment-empty",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(aKt,{})}),a.jsx(Pn.Title,{children:s("environmentCenter.noMatches")}),a.jsx(Pn.Description,{children:s("environmentCenter.tryAnotherName")})]})}):a.jsxs(Yy,{children:[f.trim()?null:a.jsxs(a.Fragment,{children:[a.jsx(ug,{"aria-label":s("environmentCenter.create"),icon:a.jsx(rKt,{}),onClick:()=>d({kind:"editor",environmentId:null}),children:s("environmentCenter.create")}),a.jsx(ug,{"aria-label":s("environmentCenter.import.title"),icon:a.jsx(sKt,{}),onClick:()=>W(),children:s("environmentCenter.import.title")})]}),F.map(Y=>{var Ne,pe;const G=V6e(Y,s),te=!!(Y.latestVersion&&Ub.has(Y.latestVersion.status)),ye=I.has(Y.id);return a.jsx(Jy,{className:"environment-card",title:Y.name,status:a.jsx(Io,{color:G.color,size:"sm",children:G.label}),description:((Ne=Y.latestVersion)==null?void 0:Ne.error)||(te?(pe=Y.latestVersion)==null?void 0:pe.currentStep:"")||Y.description||s("common.noDescription"),metadata:[{label:s("workspace.updated"),value:dKt(Y.updatedAt,o.resolvedLanguage??o.language),title:fKt(Y.updatedAt,o.resolvedLanguage??o.language)}],action:{label:Y.latestVersion?s("environmentCenter.buildDetails.title"):s(ye?"environmentCenter.buildDetails.starting":"environmentCenter.startBuild"),icon:"play",title:s("environmentCenter.build"),disabled:ye,onClick:()=>Y.latestVersion?v(Y.id):void Z(Y)},auxiliaryAction:{label:s("environmentCenter.manifest.view"),icon:a.jsx(Tnt,{}),title:Y.latestVersion?s("environmentCenter.manifest.viewShort"):s("environmentCenter.manifest.unavailable"),disabled:!Y.latestVersion,onClick:()=>x(Y)},detailAction:{label:s("environmentCenter.configure"),onClick:()=>d({kind:"editor",environmentId:Y.id})}},Y.id)})]})}),b?(()=>{const Y=l.find(G=>G.id===b);return Y?a.jsx(mKt,{environment:Y,onClose:()=>v(null),onBuildUpdate:G=>{c(te=>te.map(ye=>ye.id===Y.id?{...ye,latestVersion:G}:ye))},onRebuild:()=>Z(Y)}):null})():null,y!=null&&y.latestVersion?a.jsx(pKt,{environment:y,onClose:()=>x(null)}):null,Ee,S?a.jsx(xKt,{initialValue:S.initialValue,autoInspect:S.autoInspect,onClose:()=>k(null),onImported:ce},S.key):null]})}function OKt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:a.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function kKt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"4.5",y:"7",width:"23",height:"18",rx:"3"}),a.jsx("path",{d:"M10 7V5.5A1.5 1.5 0 0 1 11.5 4h4A1.5 1.5 0 0 1 17 5.5V7M9 13h5v5H9zM18 13h5M18 17h5M9 22h14"})]})}function zB(e,t){const n=Date.parse(e);return Number.isNaN(n)?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function SKt(e,t){return e.environmentIds.reduce((n,i)=>{var r,s;return((s=(r=t.get(i))==null?void 0:r.latestVersion)==null?void 0:s.status)==="available"?n+1:n},0)}function EKt({workspace:e,environments:t,onBack:n,onSave:i,onDelete:r}){const{t:s,i18n:o}=Ae("ui"),[l,c]=p.useState((e==null?void 0:e.name)??""),[u,d]=p.useState((e==null?void 0:e.description)??""),[f,h]=p.useState((e==null?void 0:e.environmentIds)??[]),[m,g]=p.useState(""),[b,v]=p.useState(!1),[y,x]=p.useState(""),w=m.trim().toLocaleLowerCase(),O=t.filter(k=>`${k.name} ${k.description} ${Xh(k.language)}`.toLocaleLowerCase().includes(w)),S=async k=>{if(k.preventDefault(),!(!l.trim()||b)){v(!0),x("");try{await i({name:l.trim(),description:u.trim(),environmentIds:f})}catch(C){x(C instanceof Error?C.message:String(C)),v(!1)}}};return a.jsx(Df,{className:"workspace-center","aria-label":s(e?"workspace.detail":"workspace.create"),children:a.jsxs(LC,{title:e?e.name:s("workspace.create"),description:s("workspace.editorDescription"),identitySeed:(e==null?void 0:e.name)||s("workspace.create"),backLabel:s("workspace.backToList"),onBack:n,actions:a.jsxs(a.Fragment,{children:[r?a.jsx("button",{type:"button",className:"is-danger",onClick:r,children:s("common.delete")}):null,a.jsx("button",{type:"submit",form:"workspace-form",disabled:b||!l.trim(),children:s(b?"common.saving":"common.save")})]}),children:[e?a.jsxs(Oz,{children:[a.jsxs("div",{children:[a.jsx("dt",{children:s("common.environment")}),a.jsx("dd",{children:s("workspace.environmentCount",{count:f.length})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("workspace.createdAt")}),a.jsx("dd",{children:zB(e.createdAt,o.resolvedLanguage??o.language)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("workspace.updatedAt")}),a.jsx("dd",{children:zB(e.updatedAt,o.resolvedLanguage??o.language)})]})]}):null,a.jsxs("form",{id:"workspace-form",className:"workspace-form",onSubmit:S,children:[a.jsxs("section",{className:"workspace-fields","aria-label":s("workspace.basicInfo"),children:[a.jsxs("label",{children:[a.jsx("span",{children:s("common.name")}),a.jsx(hs,{value:l,maxLength:128,autoFocus:!0,onChange:k=>c(k.target.value),placeholder:s("workspace.namePlaceholder")})]}),a.jsxs("label",{children:[a.jsx("span",{children:s("common.description")}),a.jsx(Og,{value:u,maxLength:2e3,onChange:k=>d(k.target.value),placeholder:s("workspace.descriptionPlaceholder")})]})]}),a.jsxs("section",{className:"workspace-environments",children:[a.jsx(HRe,{title:s("common.environment"),description:s("workspace.selectedEnvironmentCount",{count:f.length}),actions:a.jsx(hp,{"aria-label":s("workspace.searchAvailableEnvironments"),value:m,onChange:k=>g(k.target.value),placeholder:s("workspace.searchEnvironments")})}),t.length===0?a.jsxs("div",{className:"workspace-environment-empty",children:[a.jsx("p",{children:s("workspace.noAvailableEnvironments")}),a.jsx("span",{children:s("workspace.createEnvironmentFirst")})]}):O.length===0?a.jsxs("div",{className:"workspace-environment-empty",children:[a.jsx("p",{children:s("workspace.noMatchingEnvironments")}),a.jsx("span",{children:s("workspace.tryAnotherName")})]}):a.jsx("div",{className:"workspace-environment-list",children:O.map(k=>{var R;const C=f.includes(k.id),E=((R=k.latestVersion)==null?void 0:R.status)==="available"?s("workspace.environmentStatus.available"):k.latestVersion?s("workspace.environmentStatus.building"):s("workspace.environmentStatus.notBuilt");return a.jsxs("label",{className:`workspace-environment-option${C?" is-selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:C,onChange:()=>h(_=>C?_.filter(j=>j!==k.id):[..._,k.id])}),a.jsxs("span",{className:"workspace-environment-option__copy",children:[a.jsx("strong",{title:k.name,children:k.name}),a.jsxs("span",{children:[Xh(k.language)," · ",E]})]}),a.jsx("span",{className:"workspace-environment-option__action",children:s(C?"workspace.added":"common.add")})]},k.id)})})]}),y?a.jsx("p",{className:"workspace-form-error",role:"alert",children:y}):null]})]})})}function CKt({onEnvironment:e,onProjects:t}){const{t:n,i18n:i}=Ae("ui"),[r,s]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState({kind:"list"}),[d,f]=p.useState(""),[h,m]=p.useState(!0),[g,b]=p.useState(""),[v,y]=p.useState(""),[x,w]=p.useState(!1),[O,S]=p.useState(null),[k,C]=p.useState(0),E=p.useDeferredValue(d);p.useEffect(()=>{const T=new AbortController;return m(!0),b(""),Promise.all([bU(T.signal),fC(T.signal)]).then(([N,A])=>{s(N),l(A)}).catch(N=>{(N==null?void 0:N.name)!=="AbortError"&&(console.warn("Unable to load Studio workspaces",N),b(n("workspace.loadFailed")))}).finally(()=>{T.signal.aborted||m(!1)}),()=>T.abort()},[k,n]),p.useEffect(()=>{if(!v||x)return;const T=window.setTimeout(()=>y(""),2800);return()=>window.clearTimeout(T)},[x,v]);const R=p.useMemo(()=>new Map(o.map(T=>[T.id,T])),[o]),_=p.useMemo(()=>{const T=E.trim().toLocaleLowerCase();return T?r.filter(N=>{const A=N.environmentIds.map(P=>{var D;return((D=R.get(P))==null?void 0:D.name)??""}).join(" ");return`${N.name} ${N.description} ${A}`.toLocaleLowerCase().includes(T)}):r},[E,R,r]),j=c.kind==="detail"&&c.workspaceId?r.find(T=>T.id===c.workspaceId):void 0;return c.kind==="detail"?a.jsx(EKt,{workspace:j,environments:o,onBack:()=>u({kind:"list"}),onDelete:j?()=>S(j):null,onSave:async T=>{const N=j?await PEe(j.id,T):await IEe(T);s(A=>[N,...A.filter(P=>P.id!==N.id)]),w(!1),y(n("workspace.saved",{name:N.name})),u({kind:"list"})}},c.workspaceId??"new"):a.jsxs(zH,{section:"workspaces",onEnvironment:e,onProjects:t,actions:a.jsxs(a.Fragment,{children:[v?a.jsx("span",{className:`workspace-status${x?" is-error":""}`,role:x?"alert":"status","aria-live":"polite",children:v}):null,a.jsx(hp,{"aria-label":n("workspace.searchWorkspaces"),value:d,onChange:T=>f(T.target.value),placeholder:n("workspace.searchWorkspaces")})]}),children:[a.jsx(Rg,{"aria-live":"polite",children:h?a.jsx(Fa,{}):g?a.jsxs("div",{className:"workspace-load-error",role:"alert",children:[a.jsx("p",{children:g}),a.jsx(Dt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>C(T=>T+1),children:n("common.reload")})]}):_.length===0&&d.trim()?a.jsx("div",{className:"workspace-empty",children:a.jsxs(Pn,{fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(kKt,{})}),a.jsx(Pn.Title,{children:n("workspace.noMatchingWorkspaces")}),a.jsx(Pn.Description,{children:n("workspace.tryAnotherNameOrEnvironment")})]})}):a.jsxs(Yy,{children:[d.trim()?null:a.jsx(ug,{"aria-label":n("workspace.create"),icon:a.jsx(OKt,{}),onClick:()=>u({kind:"detail",workspaceId:null}),children:n("workspace.create")}),_.map(T=>{const N=SKt(T,R),A=T.environmentIds.filter(P=>!R.has(P)).length;return a.jsx(Jy,{className:"workspace-card",title:T.name,status:a.jsx(Io,{color:A?"danger":N===T.environmentIds.length&&N>0?"success":"secondary",size:"sm",children:T.environmentIds.length===0?n("workspace.noEnvironmentAdded"):A?n("workspace.environmentMissing"):n("workspace.availableFraction",{available:N,total:T.environmentIds.length})}),description:T.description||n("common.noDescription"),metadata:[{label:n("common.environment"),value:n("workspace.environmentCount",{count:T.environmentIds.length})},{label:n("workspace.available"),value:n("workspace.availableCount",{count:N})},{label:n("workspace.updated"),value:zB(T.updatedAt,i.resolvedLanguage??i.language)}],detailAction:{label:n("common.manage"),onClick:()=>u({kind:"detail",workspaceId:T.id})},action:{label:n("workspace.addEnvironment"),icon:"plus",onClick:()=>u({kind:"detail",workspaceId:T.id})}},T.id)})]})}),O?a.jsx(Gu,{title:n("workspace.deleteTitle"),description:n("workspace.deleteDescription",{name:O.name}),confirmLabel:n("common.delete"),variant:"danger",onCancel:()=>S(null),onConfirm:()=>{const T=O;S(null),DEe(T.id).then(()=>{s(N=>N.filter(A=>A.id!==T.id)),w(!1),y(n("workspace.deleted",{name:T.name})),u({kind:"list"})}).catch(N=>{w(!0),y(N instanceof Error?N.message:String(N))})}}):null]})}function TKt({cloudProvider:e,onProjects:t,initialSection:n="workspaces"}){const[i,r]=p.useState(n),{t:s}=Ae("ui"),[o,l]=p.useState(null),[c,u]=p.useState(""),d=p.useRef(0),f=()=>{var g;d.current+=1;const h=d.current;u("");let m=null;if(typeof navigator<"u"&&((g=navigator.clipboard)!=null&&g.readText))try{m=navigator.clipboard.readText()}catch{u(s("workspace.clipboardPermissionError"))}else u(s("workspace.clipboardUnsupported"));r("environments"),m&&m.then(async b=>{var v;if(d.current===h){if(b.trim()){l({key:h,text:b});return}try{const y=await((v=navigator.permissions)==null?void 0:v.query({name:"clipboard-read"}));d.current===h&&(y==null?void 0:y.state)==="denied"&&u(s("workspace.clipboardPermissionError"))}catch{}}}).catch(()=>{d.current===h&&u(s("workspace.clipboardPermissionError"))})};return i==="environments"?a.jsx(W6e,{cloudProvider:e,onWorkspace:()=>r("workspaces"),onProjects:t,clipboardImport:o,clipboardReadError:c}):a.jsx(CKt,{onEnvironment:f,onProjects:t})}function AKt(e){return e==="127.0.0.1"}const _Kt={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"Configure coding agents",badge:"Local",badgeTone:"success",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},jKt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},NKt={id:"gitlab-review",kind:"gitlab",category:"development",icon:"gitlab",name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."};mn.hasResourceBundle("en-US","automations")||mn.addResourceBundle("en-US","automations",Ice,!0,!0);mn.hasResourceBundle("zh-CN","automations")||mn.addResourceBundle("zh-CN","automations",Pge,!0,!0);function $f(e,t={}){return mn.t(e,{...t,ns:"automations"})}const K6e={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL",required:!0},G6e={name:"baseBranch",label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base",required:!1},X6e={name:"runtimeName",label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration",required:!0},Y6e={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates",required:!0},RKt="https://ark.cn-beijing.volces.com/api/coding/v3";function IKt(e){return e==="byteplus"?va(e):RKt}function WH(e){return e==="byteplus"?{accessKey:"BYTEPLUS_ACCESS_KEY",secretKey:"BYTEPLUS_SECRET_KEY",sessionToken:"BYTEPLUS_SESSION_TOKEN"}:{accessKey:"VOLCENGINE_ACCESS_KEY",secretKey:"VOLCENGINE_SECRET_KEY",sessionToken:"VOLCENGINE_SESSION_TOKEN"}}function Z6e(e){const t=WH(e);return[$f("github.secretPair",{accessKey:t.accessKey,secretKey:t.secretKey}),$f("github.sessionToken",{sessionToken:t.sessionToken})]}function KH(e){return e==="byteplus"?"BytePlus":"Volcengine"}function GH(e,t={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",modelName:"",modelBaseUrl:IKt(e),region:Ki(e),token:"",...t}}function J6e(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const PKt={id:"review",kind:"github",category:"development",icon:"github",name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",fields:[],initialValues:({cloudProvider:e})=>GH(e),regionHelp:"",secrets:()=>[],async submit(){throw new Error("PR 自动评审已切换为 GitHub App 授权模式。")}},DKt="https://api.github.com",MKt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,Nse=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,LKt=/^[A-Za-z0-9._/-]+$/;function $Kt(e,t,n){const i=String((t==null?void 0:t.message)||"");return e===403&&/workflow/i.test(i)?"GitHub Token 缺少 Workflows 写权限,无法创建或更新 .github/workflows 下的文件":e===401||e===403?z("github.invalidToken"):e===404?z("github.notFound"):e===422?z("github.rejectedCommit"):i.split(n).join("***").trim().slice(0,240)||z("github.requestFailed",{status:e})}async function ob(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let i;try{i=await fetch(`${DKt}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(s){throw t.signal.aborted?s:new Error(z("github.networkFailed"))}const r=await i.json().catch(()=>null);if(!t.expected.includes(i.status))throw new Error($Kt(i.status,r,t.token));return{status:i.status,payload:r}}function m4(e){return e.split("/").map(encodeURIComponent).join("/")}function FKt(e){const t=new TextEncoder().encode(e);let n="";const i=32768;for(let r=0;r({...h,path:YH(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),o=`/repos/${n}`;await ob(`${o}`,{token:e.token,expected:[200],signal:s});const c=(f=(await ob(`${o}/git/ref/heads/${m4(i)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error(z("github.missingBaseSha"));const u=BKt(e.branchPrefix);await ob(`${o}/git/refs`,{token:e.token,expected:[201],signal:s,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const m of r){const g=m4(m.path),b=await ob(`${o}/contents/${g}?ref=${encodeURIComponent(i)}`,{token:e.token,expected:[200,404],signal:s});if(m.mustBeNew&&b.status===200)throw new Error(z("github.fileAlreadyExists",{path:m.path}));if(b.status===200&&!b.payload.sha)throw new Error(z("github.pathNotUpdatable",{path:m.path}));await ob(`${o}/contents/${g}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:m.commitMessage,content:FKt(m.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await ob(`${o}/pulls`,{token:e.token,expected:[201],signal:s,method:"POST",body:{title:e.title,head:u,base:i,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error(z("github.invalidPullRequest"));return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await ob(`${o}/git/refs/heads/${m4(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}async function UKt(e,t){const n=await gn("/web/github/pull-request-reviews",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await hT(n);const i=await n.json();if(i.status!=="started"||typeof i.sessionId!="string"||!i.sessionId||typeof i.displayName!="string")throw new Error("PR 评审服务返回了无效结果。");return i}async function QKt(e){const t=await gn("/web/github/app/config",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await hT(t);const n=await t.json();if(typeof n.configured!="boolean"||typeof n.appSlug!="string"||typeof n.installUrl!="string"||typeof n.reason!="string")throw new Error("GitHub App 配置响应格式无效。");return n}async function zKt(e,t){var s;const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)});(s=t.query)!=null&&s.trim()&&n.set("q",t.query.trim());const i=await gn(`/web/github/app/repositories?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await hT(i);const r=await i.json();if(!Array.isArray(r.repositories)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.repositories.some(o=>typeof o!="object"||o===null||typeof o.installationId!="number"||typeof o.account!="string"||typeof o.fullName!="string"||typeof o.htmlUrl!="string"||typeof o.private!="boolean"||typeof o.reviewEnabled!="boolean"))throw new Error("GitHub App 仓库列表响应格式无效。");return r}async function VKt(e,t){const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)}),i=await gn(`/web/github/app/review-records?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await hT(i);const r=await i.json();if(!Array.isArray(r.records)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.records.some(s=>typeof s!="object"||s===null||typeof s.id!="string"||typeof s.repository!="string"||typeof s.pullRequestUrl!="string"||typeof s.pullRequestNumber!="number"||!["started","completed","ignored","failed"].includes(String(s.status))||!["manual","webhook"].includes(String(s.trigger))||typeof s.createdAt!="string"||typeof s.deliveryId!="string"||typeof s.action!="string"||typeof s.sessionId!="string"||typeof s.displayName!="string"||typeof s.reason!="string"))throw new Error("PR 评审记录响应格式无效。");return r}async function HKt(e,t){const n=await gn("/web/github/app/review-repositories",{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await hT(n);const i=await n.json();if(!Array.isArray(i.repositories)||i.repositories.some(r=>typeof r!="string"))throw new Error("GitHub App 评审仓库保存响应格式无效。");return i.repositories}async function hT(e){const t=await e.text().catch(()=>"");try{const n=JSON.parse(t),i=typeof n.detail=="object"&&n.detail?n.detail.message:n.detail??n.message??n.error,r=typeof i=="string"?i:"";return new Error(r||`PR 评审发起失败(HTTP ${e.status})`)}catch{return new Error(t||`PR 评审发起失败(HTTP ${e.status})`)}}const qKt=/^[A-Za-z0-9_-]+$/,tFe=4,$R=64,FR=6,Ise="agent-runtime";function nFe(e){const t=e.trim();if(!t)return Ise;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,$R);return n?(n.lengthKt(`validation.runtimeName.${n}`)){return e?qKt.test(e)?e.length$R?t("length"):null:t("characters"):t("required")}const GKt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,XKt="cn-hongkong";function YKt(e){const t=b1(e.runtimeName,n=>$f(`github.validation.runtimeName.${n}`));if(t)throw new Error(t);if(!GKt.test(e.runtimeId))throw new Error($f("github.validation.runtimeId"))}function iFe(e){YKt(e);const t=e.cloudProvider??"volcengine",n=WH(t),i=t==="byteplus"?` VOLCENGINE_ACCESS_KEY: \${{ secrets.${n.accessKey} }} VOLCENGINE_SECRET_KEY: \${{ secrets.${n.secretKey} }} VOLCENGINE_SESSION_TOKEN: \${{ secrets.${n.sessionToken} }} BYTEPLUS_REGION: ${JSON.stringify(e.region)}`:"",r=t==="byteplus"?` - "DATABASE_VIKING_REGION": ${JSON.stringify(KKt)},`:"",s=`name: Publish to AgentKit Runtime + "DATABASE_VIKING_REGION": ${JSON.stringify(XKt)},`:"",s=`name: Publish to AgentKit Runtime on: push: @@ -940,8 +940,8 @@ jobs: if not result.success: raise SystemExit(f"AgentKit publish failed: {result.error}") PY -`,o={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_ENV__:i,__BYTEPLUS_RUNTIME_ENV__:r,__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(o).reduce((l,[c,u])=>l.split(c).join(u),s)}const XKt={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",fields:[K6e,G6e,{name:"projectPath",label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server",required:!1},X6e,Y6e],initialValues:({cloudProvider:e})=>GH(e),regionHelp:"Must match the target Runtime region",secrets:({cloudProvider:e})=>Z6e(e),submit(e,t,n){const i=J6e(e),r=YH(e.projectPath,"."),s=KH(t.cloudProvider);return eFe({...i,files:[{path:".github/workflows/publish-agentkit.yml",content:iFe({baseBranch:i.baseBranch,projectPath:r,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:i.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:$f("cards.delivery.pullRequest.title"),description:$f("cards.delivery.pullRequest.description",{provider:s})},n)}};function YKt(e,t){return e==="."?t:`${e}/${t}`}function ZKt(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}const JKt={volcengine:"agentkit-prod-public-cn-beijing.cr.volces.com/base/py-simple:python3.12-bookworm-slim-latest",byteplus:"agentkit-prod-public-ap-southeast-1.cr.bytepluses.com/base/py-simple:python3.12-bookworm-slim-latest"},eGt="1.1.13",tGt=["https://mirrors.cloud.tencent.com/pypi/simple","https://pypi.mirrors.ustc.edu.cn/simple","https://pypi.org/simple"];function nGt(e){return e!=="volcengine"?"RUN uv pip install -r requirements.txt":`RUN ${tGt.map(n=>`uv pip install --index-url ${n} -r requirements.txt`).join(` || \\ - `)}`}function iGt(e){const t=WH(e);return`# Local ${KH(e)} credentials. Never commit real values. +`,o={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_ENV__:i,__BYTEPLUS_RUNTIME_ENV__:r,__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(o).reduce((l,[c,u])=>l.split(c).join(u),s)}const ZKt={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",fields:[K6e,G6e,{name:"projectPath",label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server",required:!1},X6e,Y6e],initialValues:({cloudProvider:e})=>GH(e),regionHelp:"Must match the target Runtime region",secrets:({cloudProvider:e})=>Z6e(e),submit(e,t,n){const i=J6e(e),r=YH(e.projectPath,"."),s=KH(t.cloudProvider);return eFe({...i,files:[{path:".github/workflows/publish-agentkit.yml",content:iFe({baseBranch:i.baseBranch,projectPath:r,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:i.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:$f("cards.delivery.pullRequest.title"),description:$f("cards.delivery.pullRequest.description",{provider:s})},n)}};function JKt(e,t){return e==="."?t:`${e}/${t}`}function eGt(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}const tGt={volcengine:"agentkit-prod-public-cn-beijing.cr.volces.com/base/py-simple:python3.12-bookworm-slim-latest",byteplus:"agentkit-prod-public-ap-southeast-1.cr.bytepluses.com/base/py-simple:python3.12-bookworm-slim-latest"},nGt="1.1.13",iGt=["https://mirrors.cloud.tencent.com/pypi/simple","https://pypi.mirrors.ustc.edu.cn/simple","https://pypi.org/simple"];function rGt(e){return e!=="volcengine"?"RUN uv pip install -r requirements.txt":`RUN ${iGt.map(n=>`uv pip install --index-url ${n} -r requirements.txt`).join(` || \\ + `)}`}function sGt(e){const t=WH(e);return`# Local ${KH(e)} credentials. Never commit real values. ${t.accessKey}= ${t.secretKey}= # ${t.sessionToken}= @@ -958,7 +958,7 @@ AGENTKIT_CLOUD_PROVIDER=${e} # Optional Feishu Channel credentials. Studio can create and bind these. FEISHU_APP_ID= FEISHU_APP_SECRET= -`}function rGt(e,t="volcengine"){const n={"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" +`}function oGt(e,t="volcengine"){const n={"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" from assistant import root_agent from veadk.integrations.agentkit import create_agentkit_app, run_agentkit_app @@ -1002,19 +1002,19 @@ root_agent = Agent( instruction="You are a helpful assistant. Use your tools when relevant.", tools=[get_city_weather], ) -`,"requirements.txt":`veadk-python==${eGt} +`,"requirements.txt":`veadk-python==${nGt} agentkit-sdk-python==0.8.4 google-adk==2.1.0 lark-channel-sdk==1.2.0 lark-oapi==1.7.3 starlette==0.52.1 -`,Dockerfile:`FROM ${JKt[t]} +`,Dockerfile:`FROM ${tGt[t]} ENV UV_SYSTEM_PYTHON=1 UV_COMPILE_BYTECODE=1 PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt ./ -${nGt(t)} +${rGt(t)} COPY . . @@ -1039,7 +1039,7 @@ and local short-term memory fallback. Pushes to the configured target branch are continuously published by the GitHub Actions workflow added with this project. -`,".env.example":iGt(t),".gitignore":`__pycache__/ +`,".env.example":sGt(t),".gitignore":`__pycache__/ *.pyc .venv/ .env @@ -1053,21 +1053,21 @@ __pycache__/ Dockerfile .dockerignore README.md -`};return Object.fromEntries(Object.entries(n).map(([i,r])=>[i,r.split("__PROJECT_NAME__").join(e)]))}const sGt={id:"template",kind:"github",category:"development",icon:"github",name:"Import starter project",description:"Create a minimal Agent project in your repository with continuous delivery to AgentKit Runtime.",title:"Import starter project",subtitle:"Add a ready-to-run basic Agent and continuous delivery configuration to your repository",panel:"This creates a pull request containing the basic project and AgentKit Runtime delivery workflow.",submitLabel:"Import template and create PR",fields:[K6e,G6e,{name:"projectPath",label:"Agent project directory",placeholder:"agentkit-basic-agent",help:"The basic project will be added here; app.py mounts the complete Studio App Server and serves as the entry point",required:!0},X6e,Y6e],initialValues:({cloudProvider:e})=>GH(e,{projectPath:"agentkit-basic-agent"}),regionHelp:"Must match the target Runtime region",secrets:({cloudProvider:e})=>Z6e(e),submit(e,t,n){const i=J6e(e),r=XH(i.repository),s=YH(e.projectPath,"agentkit-basic-agent"),o=s==="."?r.split("/").slice(-1)[0]||"agentkit-basic-agent":s.split("/").slice(-1)[0]||"agentkit-basic-agent",l=Object.entries(rGt(o,t.cloudProvider)).map(([c,u])=>({path:YKt(s,c),content:u,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return l.push({path:ZKt(s),content:iFe({baseBranch:i.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:i.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),eFe({...i,repository:r,files:l,branchPrefix:"feat/agentkit-basic-template",title:$f("cards.template.pullRequest.title"),description:$f("cards.template.pullRequest.description",{provider:KH(t.cloudProvider)})},n)}},oGt={id:"website-integration",kind:"website-integration",category:"channels",icon:"website-integration",name:"Website integration",description:"Embed an AgentKit Runtime on your website as a floating chat window."},Pse=[{id:"development",label:"Development"},{id:"channels",label:"Messaging channels"}],rFe=[TKt,sGt,XKt,RKt,_Kt,AKt,oGt],aGt=new Map(rFe.map(e=>[e.id,e]));function lGt(e){const t=aGt.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function cGt(e){const t=lGt(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}function Dse(e){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[a.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),a.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function uGt(e){return a.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),a.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function dGt(e){return a.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.5",y:"5",width:"22",height:"18",rx:"4",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M4.5 10h20M9 7.5h.1M12 7.5h.1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),a.jsx("path",{d:"M18 18.5c0-3 2.5-5.5 5.5-5.5h3c3 0 5.5 2.5 5.5 5.5v5c0 3-2.5 5.5-5.5 5.5H25l-4 3v-3.6a5.5 5.5 0 0 1-3-4.9v-5Z",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),a.jsx("path",{d:"M22 19.5h6M22 23h4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function fGt(e){return a.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M18 31 5.5 21.8 8.7 6.5 14 17.1h8L27.3 6.5l3.2 15.3L18 31Z",fill:"currentColor",opacity:"0.12"}),a.jsx("path",{d:"M18 31 5.5 21.8 8.7 6.5 14 17.1h8L27.3 6.5l3.2 15.3L18 31Z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),a.jsx("path",{d:"m14 17.1 4 13.9 4-13.9M5.5 21.8h25",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})}function hGt({onOpen:e}){var d;const{t}=Ae("automations"),[n,i]=p.useState("development"),[r,s]=p.useState(""),o=p.useDeferredValue(r),l=p.useMemo(()=>{const f=o.trim().toLocaleLowerCase();return rFe.filter(h=>h.category===n).filter(h=>!f||`${t(`cards.${h.id}.name`)} ${t(`cards.${h.id}.description`)}`.toLocaleLowerCase().includes(f))},[n,o,t]),c=(d=Pse.find(f=>f.id===n))==null?void 0:d.id,u=CKt(window.location.hostname);return a.jsxs("div",{className:"applications-page",children:[a.jsxs("header",{className:"applications-header",children:[a.jsxs("div",{children:[a.jsx("h1",{children:t("title")}),a.jsx("p",{children:t("description")})]}),a.jsxs("label",{className:"applications-search",children:[a.jsx(Dse,{}),a.jsx("input",{type:"search","aria-label":t("search"),value:r,onChange:f=>s(f.target.value),placeholder:t("search")})]})]}),a.jsx("nav",{className:"applications-categories","aria-label":t("categoriesLabel"),children:Pse.map(f=>a.jsx("button",{type:"button",className:n===f.id?"is-active":"","aria-pressed":n===f.id,onClick:()=>i(f.id),children:t(`categories.${f.id}`)},f.id))}),a.jsx("section",{className:"applications-results","aria-label":t("resultsLabel",{category:t(`categories.${c}`)}),children:l.length?a.jsx("div",{className:"applications-grid",children:l.map(f=>{const h=f.id==="coding-agents"&&!u,m=h?"coding-agents-local-only-tooltip":void 0;return a.jsxs("div",{className:`application-card-wrap${h?" is-disabled":""}`,tabIndex:h?0:void 0,"aria-describedby":m,children:[a.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(f.id),"aria-label":t("open",{name:t(`cards.${f.id}.name`)}),disabled:h,children:[f.icon==="feishu"?a.jsx("img",{className:"application-card-icon application-card-brand-icon",src:BD,alt:"","aria-hidden":"true"}):f.icon==="coding-agents"?a.jsx(uGt,{className:"application-card-icon"}):f.icon==="website-integration"?a.jsx(dGt,{className:"application-card-icon"}):f.icon==="gitlab"?a.jsx(fGt,{className:"application-card-icon"}):a.jsx(VH,{className:"application-card-icon"}),a.jsxs("div",{className:"application-card-copy",children:[a.jsxs("div",{className:"application-card-title",children:[a.jsx("h2",{children:t(`cards.${f.id}.name`)}),f.badge?a.jsx("span",{className:`application-card-badge is-${f.badgeTone||"default"}`,children:t(`cards.${f.id}.badge`,{defaultValue:f.badge})}):null]}),a.jsx("p",{children:t(`cards.${f.id}.description`)})]})]}),h?a.jsx("span",{id:m,className:"application-card-tooltip",role:"tooltip",children:t("localOnly")}):null]},f.id)})}):a.jsxs("div",{className:"applications-empty",role:"status",children:[a.jsx(Dse,{}),a.jsx("h2",{children:t("emptyTitle")}),a.jsx("p",{children:t("emptyDescription")})]})})]})}const pGt="_Container_1bl61_1",mGt="_Track_1bl61_16",gGt="_Thumb_1bl61_56",bGt="_Label_1bl61_78",M2={Container:pGt,Track:mGt,Thumb:gGt,Label:bGt},VB=({className:e,label:t,id:n,disabled:i,labelPosition:r="end",...s})=>{const o=p.useId(),l=n??o;return a.jsxs("div",{className:Ti(M2.Container,e),"data-disabled":i?"":void 0,"data-has-label":t?"":void 0,"data-label-position":r,children:[a.jsx(Olt,{id:l,className:M2.Track,disabled:i,...s,children:a.jsx(Slt,{className:M2.Thumb})}),t&&a.jsx("label",{htmlFor:l,className:M2.Label,children:t})]})};function kg({message:e,className:t="",onRetry:n,retryLabel:i,defaultExpanded:r=!0}){const{t:s}=Ae("ui"),o=i??s("deploymentError.retryDeployment"),[l,c]=p.useState(r),[u,d]=p.useState(!1),f=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return a.jsxs("div",{className:`deploy-error-message${l?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[a.jsx("p",{className:"deploy-error-message-text",children:e}),a.jsxs("div",{className:"deploy-error-message-actions",children:[n&&a.jsxs(Dt,{type:"button",className:"deploy-error-retry",color:"danger",variant:"soft",size:"sm",pill:!1,loading:u,onClick:()=>void f(),children:[!u&&a.jsx(hnt,{}),u?s("deploymentError.retrying"):o]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,pill:!1,title:s(l?"deploymentError.collapse":"deploymentError.expand"),"aria-label":s(l?"deploymentError.collapse":"deploymentError.expand"),onClick:()=>c(h=>!h),children:l?a.jsx(ynt,{}):a.jsx(knt,{})}),a.jsx(UQ,{copyValue:e,color:"secondary",variant:"ghost",size:"sm",uniform:!0,pill:!1,title:s("deploymentError.copy"),"aria-label":s("deploymentError.copy"),children:({copied:h})=>h?a.jsx(Gx,{}):a.jsx(YU,{})})]})]})}const yGt={queued:"status.queued",pending:"status.pending",running:"status.running",retrying:"status.retrying",success:"status.success",failed:"status.failed",cancelled:"status.cancelled",skipped:"status.skipped"},sFe=["weekdays.sunday","weekdays.monday","weekdays.tuesday","weekdays.wednesday","weekdays.thursday","weekdays.friday","weekdays.saturday"];function HB(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(mn.resolvedLanguage,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function vGt(e){if(!e.startedAt)return"-";const t=Date.parse(e.startedAt),n=e.finishedAt?Date.parse(e.finishedAt):Date.now();if(!Number.isFinite(t)||!Number.isFinite(n)||n{const d=i.current;!d||r.current||c(d.scrollHeight>d.clientHeight+1)},[]);return p.useLayoutEffect(()=>{r.current=s,s||u()},[s,u,e]),p.useEffect(()=>{const d=i.current;if(!d||typeof ResizeObserver>"u")return;const f=new ResizeObserver(u);return f.observe(d),()=>f.disconnect()},[u]),a.jsxs("div",{className:`cronjobs-run-output-body${s?" is-expanded":""}`,children:[a.jsx("p",{id:n,ref:i,children:e}),l?a.jsx(Dt,{type:"button",className:"cronjobs-run-output-toggle",color:"secondary",variant:"ghost",size:"sm",pill:!1,"aria-expanded":s,"aria-controls":n,onClick:()=>o(d=>!d),children:t(s?"actions.collapse":"actions.expand")}):null]})}const WB="Asia/Shanghai",wGt=3e3,OGt=["Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Europe/London","America/Los_Angeles","America/New_York","UTC"];function Lt(e,t){return mn.t(e,{ns:"cronjobs",...t})}function kGt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||WB}catch{return WB}}function SGt(){const e=kGt(),t=new Date(Date.now()+24*60*60*1e3);return t.setSeconds(0,0),{name:"",runtimeId:"",prompt:"",scheduleType:"daily",onceAt:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),time:"09:00",weekday:1,cron:"0 9 * * *",timezone:e,enabled:!0}}function EGt(e){return{name:e.name,runtimeId:e.runtimeId,prompt:e.prompt,scheduleType:e.schedule.type,onceAt:e.schedule.onceAt??"",time:e.schedule.time??"09:00",weekday:e.schedule.weekday??1,cron:e.schedule.cron??"0 9 * * *",timezone:e.schedule.timezone||WB,enabled:e.enabled}}function CGt({run:e}){const t=e?e.status==="success"?"success":e.status==="failed"?"danger":["queued","pending","running","retrying"].includes(e.status)?"info":"secondary":"secondary";return a.jsx(Io,{className:"cronjobs-status",color:t,variant:"soft",size:"sm",pill:!0,children:Lt(e?yGt[e.status]:"status.notRun")})}function Mse({job:e,runtimes:t,cloudProvider:n,busy:i,onClose:r,onSubmit:s}){const[o,l]=p.useState(()=>e?EGt(e):SGt()),[c,u]=p.useState(""),[d,f]=p.useState(!1),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=i||d,v=p.useRef(b),y=p.useRef(r),x=p.useMemo(()=>Array.from(new Set([o.timezone,...OGt])),[o.timezone]),w=p.useMemo(()=>t.map(C=>({value:C.runtimeId,label:C.name,description:If(C.region,n)})),[n,t]),O=p.useMemo(()=>sFe.map((C,E)=>({value:String(E),label:Lt(C)})),[]),S=p.useMemo(()=>x.map(C=>({value:C,label:C})),[x]);p.useEffect(()=>{v.current=b,y.current=r},[b,r]),p.useEffect(()=>{var _;const C=document.body.style.overflow,E=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(_=m.current)==null||_.focus();const R=j=>{var D,M;if(j.key==="Escape"&&!v.current){y.current();return}if(j.key!=="Tab")return;const T=Array.from(((D=h.current)==null?void 0:D.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(L=>!L.hidden&&L.getClientRects().length>0);if(T.length===0){j.preventDefault();return}const N=T[0],A=T[T.length-1],P=document.activeElement;j.shiftKey&&(P===N||!((M=h.current)!=null&&M.contains(P)))?(j.preventDefault(),A.focus()):!j.shiftKey&&P===A&&(j.preventDefault(),N.focus())};return window.addEventListener("keydown",R),()=>{document.body.style.overflow=C,window.removeEventListener("keydown",R),E!=null&&E.isConnected&&E.focus()}},[]);const k=async C=>{C.preventDefault();const E=o.name.trim(),R=o.prompt.trim(),_=t.find(T=>T.runtimeId===o.runtimeId);if(!E)return u(Lt("validation.nameRequired"));if(!_)return u(Lt("validation.runtimeRequired"));if(!R)return u(Lt("validation.promptRequired"));if(o.scheduleType==="once"&&!o.onceAt||(o.scheduleType==="daily"||o.scheduleType==="weekly")&&!o.time)return u(Lt("validation.timeRequired"));const j=o.cron.trim().split(/\s+/);if(o.scheduleType==="cron"&&j.length!==5)return u(Lt("validation.cronFields"));u(""),f(!0);try{let T=(e==null?void 0:e.runtimeId)===_.runtimeId?e.agentName.trim():"";if(!T){const[N]=await dC("","",{runtimeId:_.runtimeId,region:_.region});T=(N==null?void 0:N.trim())??""}if(!T)throw new Error(Lt("validation.runtimeAppMissing"));await s({name:E,runtimeId:_.runtimeId,runtimeName:_.name,agentName:T,region:_.region,prompt:R,enabled:o.enabled,schedule:{type:o.scheduleType,timezone:o.timezone,...o.scheduleType==="once"?{onceAt:o.onceAt}:{},...o.scheduleType==="daily"?{time:o.time}:{},...o.scheduleType==="weekly"?{time:o.time,weekday:o.weekday}:{},...o.scheduleType==="cron"?{cron:o.cron.trim()}:{}}})}catch(T){u(T instanceof Error?T.message:String(T)),window.requestAnimationFrame(()=>{var N;return(N=g.current)==null?void 0:N.focus()})}finally{f(!1)}};return a.jsx("div",{className:"cronjobs-drawer-backdrop",onMouseDown:C=>{C.target===C.currentTarget&&!b&&r()},children:a.jsxs("aside",{ref:h,className:"cronjobs-drawer",role:"dialog","aria-modal":"true","aria-labelledby":"cronjobs-drawer-title",children:[a.jsxs("header",{className:"cronjobs-drawer-head",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"cronjobs-drawer-title",children:Lt(e?"drawer.editTitle":"drawer.createTitle")}),a.jsx("p",{children:Lt("drawer.description")})]}),a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:r,disabled:b,"aria-label":Lt("actions.closeDrawer"),children:a.jsx(ZU,{})})]}),a.jsxs("form",{className:"cronjobs-form",onSubmit:C=>void k(C),children:[a.jsxs("div",{className:"cronjobs-form-scroll",children:[a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.name")}),a.jsx(hs,{ref:m,size:"lg",value:o.name,maxLength:80,invalid:!!c&&!o.name.trim(),onChange:C=>l({...o,name:C.target.value}),placeholder:Lt("fields.namePlaceholder")})]}),a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.runtimeAgent")}),a.jsx(Xs,{value:o.runtimeId,options:w,size:"lg",disabled:t.length===0,placeholder:Lt(t.length?"fields.runtimePlaceholder":"fields.noRuntime"),onChange:C=>l({...o,runtimeId:C.value})}),a.jsx("small",{children:Lt("fields.runtimeHelp")})]}),a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.prompt")}),a.jsx(Og,{value:o.prompt,rows:5,maxRows:10,autoResize:!0,maxLength:2e4,invalid:!!c&&!o.prompt.trim(),onChange:C=>l({...o,prompt:C.target.value}),placeholder:Lt("fields.promptPlaceholder")}),a.jsxs("small",{className:"cronjobs-character-count",children:[o.prompt.length.toLocaleString()," / 20,000"]})]}),a.jsxs("fieldset",{className:"cronjobs-fieldset",children:[a.jsx("legend",{children:Lt("fields.schedule")}),a.jsxs(ju,{className:"cronjobs-schedule-types",value:o.scheduleType,size:"lg",block:!0,"aria-label":Lt("fields.scheduleType"),onChange:C=>l({...o,scheduleType:C}),children:[a.jsx(ju.Option,{value:"once",children:Lt("scheduleTypes.once")}),a.jsx(ju.Option,{value:"daily",children:Lt("scheduleTypes.daily")}),a.jsx(ju.Option,{value:"weekly",children:Lt("scheduleTypes.weekly")}),a.jsx(ju.Option,{value:"cron",children:"Cron"})]}),o.scheduleType==="once"?a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.runAt")}),a.jsx(hs,{size:"lg",type:"datetime-local",value:o.onceAt,onChange:C=>l({...o,onceAt:C.target.value})})]}):null,o.scheduleType==="daily"?a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.dailyTime")}),a.jsx(hs,{size:"lg",type:"time",value:o.time,onChange:C=>l({...o,time:C.target.value})})]}):null,o.scheduleType==="weekly"?a.jsxs("div",{className:"cronjobs-inline-fields",children:[a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.weekday")}),a.jsx(Xs,{value:String(o.weekday),options:O,size:"lg",onChange:C=>l({...o,weekday:Number(C.value)})})]}),a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.runAt")}),a.jsx(hs,{size:"lg",type:"time",value:o.time,onChange:C=>l({...o,time:C.target.value})})]})]}):null,o.scheduleType==="cron"?a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.cronExpression")}),a.jsx(hs,{size:"lg",value:o.cron,onChange:C=>l({...o,cron:C.target.value}),placeholder:"0 9 * * *"}),a.jsx("small",{children:Lt("fields.cronHelp")})]}):null,a.jsxs("label",{className:"cronjobs-field",children:[a.jsx("span",{children:Lt("fields.timezone")}),a.jsx(Xs,{value:o.timezone,options:S,size:"lg",onChange:C=>l({...o,timezone:C.value})})]})]}),a.jsxs("div",{className:"cronjobs-switch-row",children:[a.jsxs("span",{children:[a.jsx("strong",{children:Lt("fields.enableAfterCreate")}),a.jsx("small",{children:Lt("fields.enableHelp")})]}),a.jsx(VB,{checked:o.enabled,onCheckedChange:C=>l({...o,enabled:C}),"aria-label":Lt("fields.enableAfterCreate")})]}),c?a.jsx("div",{ref:g,className:"cronjobs-inline-error",tabIndex:-1,children:a.jsx(Oy,{color:"danger",variant:"soft",description:c})}):null]}),a.jsxs("footer",{className:"cronjobs-drawer-actions",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:r,disabled:b,children:Lt("actions.cancel")}),a.jsx(Dt,{type:"submit",color:"primary",size:"lg",pill:!1,loading:b,disabled:t.length===0,"aria-busy":b||void 0,children:Lt(d?"actions.connectingRuntime":i?"actions.saving":e?"actions.saveChanges":"actions.createTask")})]})]})]})})}function TGt({jobs:e,canCreate:t,onCreate:n,onSelect:i}){return a.jsxs(Yy,{children:[a.jsx(ug,{icon:a.jsx(vAe,{}),onClick:n,disabled:!t,title:Lt(t?"actions.createScheduledTask":"fields.noRuntime"),children:Lt("actions.createScheduledTask")}),e.map(r=>{const s=oFe(r.schedule);return a.jsx(Jy,{className:"cronjobs-card",title:r.name,status:a.jsx(Io,{color:r.enabled?"success":"secondary",variant:"soft",size:"sm",pill:!0,children:Lt(r.enabled?"status.enabled":"status.paused")}),description:r.prompt,metadata:[{label:Lt("fields.schedule"),value:s,title:s}],detailAction:{label:Lt("actions.viewDetails"),onClick:()=>i(r)}},r.jobId)})]})}function AGt({job:e,runs:t,runsLoading:n,runsError:i,busyAction:r,onBack:s,onEdit:o,onToggle:l,onRun:c,onDelete:u,onCancel:d,onRetryRun:f,onRetryRuns:h}){const m=t.find(b=>b.status==="queued"||b.status==="running"||b.status==="retrying"||b.status==="pending")??(qB(e)?e.latestRun:void 0),g=r.includes(e.jobId);return a.jsxs("div",{className:"cronjobs-detail",children:[a.jsxs("header",{className:"cronjobs-detail-head",children:[a.jsxs("div",{className:"cronjobs-detail-title",children:[a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:s,"aria-label":Lt("actions.backToList"),children:a.jsx(dnt,{})}),a.jsxs("div",{children:[a.jsx("h1",{children:e.name}),a.jsxs("p",{children:[e.runtimeName||e.agentName," · ",oFe(e.schedule)]})]})]}),a.jsxs("div",{className:"cronjobs-detail-actions",children:[a.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:o,disabled:g,children:[a.jsx(Ont,{}),Lt("actions.edit")]}),a.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:l,disabled:g,children:[e.enabled?a.jsx(Ant,{}):a.jsx(PY,{}),Lt(e.enabled?"actions.pause":"actions.enable")]}),m?a.jsxs(Dt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>d(m),disabled:g||!!m.cancellationRequestedAt,children:[a.jsx(Int,{}),Lt(m.cancellationRequestedAt?m.status==="queued"?"actions.cancelling":"actions.stopping":m.status==="queued"?"actions.cancelQueue":"actions.stopRun")]}):a.jsxs(Dt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:c,disabled:g||!e.enabled,children:[a.jsx(PY,{}),Lt("actions.runNow")]}),a.jsx(uo,{compact:!0,content:Lt(m?m.status==="queued"?"actions.cancelQueueFirst":"actions.stopRunFirst":"actions.deleteTask"),children:a.jsxs(Dt,{type:"button",color:"danger",variant:"ghost",size:"lg",pill:!1,onClick:u,disabled:g||!!m,"aria-label":Lt("actions.deleteTask"),children:[a.jsx(vnt,{}),Lt("actions.delete")]})})]})]}),a.jsxs("div",{className:"cronjobs-detail-scroll",children:[a.jsxs("section",{className:"cronjobs-summary-grid","aria-label":Lt("detail.configuration"),children:[a.jsxs("dl",{children:[a.jsxs("div",{children:[a.jsx("dt",{children:Lt("detail.status")}),a.jsx("dd",{children:Lt(e.enabled?"status.enabled":"status.paused")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:Lt("detail.nextRun")}),a.jsx("dd",{children:e.enabled?HB(e.nextRunAt):"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:Lt("detail.runtime")}),a.jsx("dd",{title:e.runtimeName,children:e.runtimeName})]}),a.jsxs("div",{children:[a.jsx("dt",{children:Lt("detail.region")}),a.jsx("dd",{children:e.region})]})]}),a.jsxs("div",{className:"cronjobs-prompt",children:[a.jsx("span",{children:Lt("fields.prompt")}),a.jsx("p",{children:e.prompt})]})]}),a.jsxs("section",{className:"cronjobs-history",children:[a.jsxs("header",{children:[a.jsxs("div",{children:[a.jsx("h2",{children:Lt("history.title")}),a.jsx("p",{children:Lt("history.description")})]}),a.jsx(uo,{compact:!0,content:Lt("actions.refresh"),children:a.jsx(Dt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:h,disabled:n,"aria-label":Lt("actions.refreshHistory"),children:a.jsx(ZI,{})})})]}),n&&t.length===0?a.jsx(Fa,{}):i?a.jsx(Oy,{className:"cronjobs-history-alert",color:"danger",variant:"soft",title:Lt("history.loadFailed"),description:i,actions:a.jsx(Dt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:h,children:Lt("actions.retry")})}):t.length===0?a.jsxs(Pn,{className:"cronjobs-history-state",fill:"none",children:[a.jsx(Pn.Icon,{children:a.jsx(XU,{})}),a.jsx(Pn.Title,{children:Lt("history.emptyTitle")}),a.jsx(Pn.Description,{children:Lt("history.emptyDescription")})]}):a.jsx("div",{className:"cronjobs-runs",children:t.map(b=>a.jsxs("article",{className:"cronjobs-run",children:[a.jsxs("div",{className:"cronjobs-run-main",children:[a.jsx(CGt,{run:b}),a.jsxs("div",{children:[a.jsx("strong",{children:HB(b.startedAt||b.scheduledAt)}),a.jsxs("span",{children:[Lt("history.duration",{duration:vGt(b)}),b.runtimeVersion?` · Runtime v${b.runtimeVersion}`:""]})]})]}),b.sessionId?a.jsxs("div",{className:"cronjobs-run-meta",children:[a.jsx("span",{children:Lt("history.session")}),a.jsx("strong",{title:b.sessionId,children:b.sessionId})]}):null,b.output?a.jsxs("div",{className:"cronjobs-run-output",children:[a.jsx("span",{children:Lt("history.finalAnswer")}),a.jsx(xGt,{output:b.output})]}):null,b.error?a.jsxs("div",{className:"cronjobs-run-output is-error",children:[a.jsx("span",{children:Lt("history.errorDetails")}),a.jsx(kg,{message:b.error,className:"cronjobs-run-error-detail",defaultExpanded:!1,onRetry:b.status==="failed"?f:void 0,retryLabel:Lt("actions.rerun")})]}):null,b.status==="queued"||b.status==="running"||b.status==="retrying"||b.status==="pending"?a.jsx(Dt,{type:"button",className:"cronjobs-run-cancel",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>d(b),disabled:g||!!b.cancellationRequestedAt,loading:!!b.cancellationRequestedAt,children:Lt(b.cancellationRequestedAt?"actions.stopping":b.status==="queued"?"actions.cancelQueue":"actions.stop")}):null]},b.runId))})]})]})]})}function _Gt({cloudProvider:e}){Ae("cronjobs");const[t,n]=p.useState([]),[i,r]=p.useState([]),[s,o]=p.useState(!0),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(void 0),[m,g]=p.useState([]),[b,v]=p.useState(!1),[y,x]=p.useState(""),[w,O]=p.useState(""),[S,k]=p.useState("all"),[C,E]=p.useState(""),[R,_]=p.useState(null),[j,T]=p.useState(""),N=t.find(V=>V.jobId===u),A=S==="all"?t:t.filter(V=>S==="enabled"?V.enabled:!V.enabled),P=p.useCallback(async V=>{o(!0),c("");try{const[X,ie]=await Promise.all([D6(V),Fw({scope:"all",region:"all",pageSize:100})]);if(V!=null&&V.aborted)return;n(X),r(ie.runtimes.filter(Q=>Q.status.toLowerCase()==="ready"))}catch(X){if(V!=null&&V.aborted)return;console.warn("Unable to load scheduled tasks",X),c(Lt("page.loadFailedDescription"))}finally{V!=null&&V.aborted||o(!1)}},[]);p.useEffect(()=>{const V=new AbortController;return P(V.signal),()=>V.abort()},[P]);const D=p.useCallback(async(V,X)=>{v(!0),x("");try{const ie=await M6(V,X);X!=null&&X.aborted||g(ie)}catch(ie){X!=null&&X.aborted||(console.warn("Unable to load scheduled-task history",ie),x(Lt("history.loadFailedDescription")))}finally{X!=null&&X.aborted||v(!1)}},[]);p.useEffect(()=>{if(!u){g([]),x("");return}const V=new AbortController;return D(u,V.signal),()=>V.abort()},[D,u]);const M=t.some(qB);p.useEffect(()=>{!M&&C===Lt("notices.queued")&&E("")},[M,C]),p.useEffect(()=>{if(!M)return;const V=new AbortController,X=async()=>{try{const[Q,Z]=await Promise.all([D6(V.signal),u?M6(u,V.signal):Promise.resolve(null)]);if(V.signal.aborted)return;n(Q),Z&&g(Z),Q.some(qB)||E("")}catch(Q){V.signal.aborted||E(Q instanceof Error?Q.message:String(Q))}},ie=window.setInterval(()=>void X(),wGt);return()=>{window.clearInterval(ie),V.abort()}},[M,u]);const L=V=>n(X=>X.some(ie=>ie.jobId===V.jobId)?X.map(ie=>ie.jobId===V.jobId?V:ie):[V,...X]),U=async(V,X,ie,Q=!1)=>{O(V),E("");try{await X(),E(ie)}catch(Z){const ce=Z instanceof Error?Z.message:String(Z);if(Q)throw new Error(ce);E(ce)}finally{O("")}},I=async V=>{const X=f??null;await U(`${(X==null?void 0:X.jobId)??"new"}:save`,async()=>{const ie=X?await lCe(X.jobId,V):await aCe(V);L(ie),h(void 0),X&&d(ie.jobId)},Lt(X?"notices.updated":"notices.created"),!0)},H=V=>void U(`${V.jobId}:toggle`,async()=>L(await cCe(V.jobId,!V.enabled)),Lt(V.enabled?"notices.paused":"notices.enabled")),K=(V,X)=>U(`${V.jobId}:run`,async()=>{const ie=await uCe(V.jobId);L({...V,latestRun:ie}),u===V.jobId&&g(Q=>[ie,...Q.filter(Z=>Z.runId!==ie.runId)])},X),F=V=>void K(V,Lt("notices.queued")),W=()=>{if(!R)return;T("");const V=R;V.kind==="delete"?U(`${V.job.jobId}:delete`,async()=>{await fCe(V.job.jobId),n(X=>X.filter(ie=>ie.jobId!==V.job.jobId)),d(""),_(null)},Lt("notices.deleted"),!0).catch(X=>{T(X instanceof Error?X.message:String(X))}):U(`${V.job.jobId}:cancel`,async()=>{var ie;const X=await dCe(V.job.jobId,V.run.runId);g(Q=>Q.map(Z=>Z.runId===X.runId?X:Z)),L({...V.job,latestRun:((ie=V.job.latestRun)==null?void 0:ie.runId)===X.runId?X:V.job.latestRun}),_(null)},Lt("notices.cancelRequested"),!0).catch(X=>{T(X instanceof Error?X.message:String(X))})};return N?a.jsxs(Df,{className:"cronjobs-page","aria-label":Lt("detail.pageLabel"),children:[a.jsx(AGt,{job:N,runs:m,runsLoading:b,runsError:y,busyAction:w,onBack:()=>d(""),onEdit:()=>h(N),onToggle:()=>H(N),onRun:()=>F(N),onDelete:()=>{T(""),_({kind:"delete",job:N})},onCancel:V=>{T(""),_({kind:"cancel",job:N,run:V})},onRetryRun:()=>K(N,Lt("notices.requeued")),onRetryRuns:()=>void D(N.jobId)}),C?a.jsx("div",{className:"cronjobs-notice",role:"status",children:a.jsx(Oy,{color:"info",variant:"soft",description:C})}):null,f!==void 0?a.jsx(Mse,{job:f,runtimes:i,cloudProvider:e,busy:w.endsWith(":save"),onClose:()=>h(void 0),onSubmit:I}):null,R?a.jsx(Gu,{title:Lt(R.kind==="delete"?"confirm.deleteTitle":"confirm.cancelTitle"),description:R.kind==="delete"?Lt("confirm.deleteDescription",{name:R.job.name}):Lt("confirm.cancelDescription"),error:j,confirmLabel:Lt(R.kind==="delete"?"actions.deleteTask":"actions.stop"),variant:"danger",busy:w.endsWith(R.kind),onCancel:()=>{T(""),_(null)},onConfirm:W}):null]}):a.jsxs(Df,{className:"cronjobs-page","aria-label":Lt("page.title"),children:[a.jsx(Ky,{className:"cronjobs-page-head",title:Lt("page.title")}),a.jsx(Gy,{children:a.jsx(Xy,{idPrefix:"cronjobs-filter",ariaLabel:Lt("page.filterLabel"),value:S,items:[{id:"all",label:Lt("filters.all")},{id:"enabled",label:Lt("status.enabled")},{id:"paused",label:Lt("status.paused")}],onChange:k})}),C?a.jsx("div",{className:"cronjobs-banner",role:"status",children:a.jsx(Oy,{color:"info",variant:"soft",description:C})}):null,a.jsx(Rg,{"aria-label":Lt("page.listLabel"),children:s&&t.length===0?a.jsx(Fa,{}):l?a.jsxs(Pn,{className:"cronjobs-state",fill:"none",children:[a.jsx(Pn.Icon,{color:"danger",children:a.jsx(XU,{})}),a.jsx(Pn.Title,{color:"danger",children:Lt("page.loadFailed")}),a.jsx(Pn.Description,{children:l}),a.jsx(Pn.ActionRow,{children:a.jsxs(Dt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>void P(),children:[a.jsx(ZI,{}),Lt("actions.retry")]})})]}):a.jsx(TGt,{jobs:A,canCreate:!s&&i.length>0,onCreate:()=>h(null),onSelect:V=>d(V.jobId)})}),f!==void 0?a.jsx(Mse,{job:f,runtimes:i,cloudProvider:e,busy:w.endsWith(":save"),onClose:()=>h(void 0),onSubmit:I}):null]})}const jGt={volcengine:"https://console.volcengine.com",byteplus:"https://console.byteplus.com"};function zE(e){return e.trim()}function JH(e){return jGt[e]}function NGt(e){const t=zE(e);if(!t)return null;let n=t;try{n=new URL(t.includes("://")?t:`https://${t}`).hostname}catch{return null}const i=n.match(/^(.+)\.tos-([a-z0-9-]+)\.(?:volces|bytepluses)\.com$/i);return i?{bucket:i[1],region:i[2]}:null}function RGt(e,t){const n=NGt(t);if(!n)return null;const i=new URLSearchParams({id:n.bucket,region:n.region,type:"objects"});return`${JH(e)}/tos/bucket/setting?${i.toString()}`}function IGt(e,t,n){const i=zE(t),r=zE(n);return!i||!r?null:`${JH(e)}/agentkit/region:agentkit+${encodeURIComponent(i)}/builtintools/${encodeURIComponent(r)}/detail`}function PGt(e,t,n){const i=zE(t),r=zE(n);return!i||!r?null:`${JH(e)}/identity/region:identity+${encodeURIComponent(i)}/user-pools/${encodeURIComponent(r)}/info`}function OO({href:e,label:t,children:n}){return e?a.jsxs("a",{className:"system-info-resource-link",href:e,target:"_blank",rel:"noreferrer","aria-label":t,title:t,children:[a.jsx("span",{children:n}),a.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[a.jsx("path",{d:"M7.75 5.25h-2.5a1.5 1.5 0 0 0-1.5 1.5v8a1.5 1.5 0 0 0 1.5 1.5h8a1.5 1.5 0 0 0 1.5-1.5v-2.5"}),a.jsx("path",{d:"M10.25 3.75h6v6M16 4 9 11"})]})]}):a.jsx("span",{children:n})}function DGt(e){return e instanceof Error&&e.message.includes("Volcengine credentials not found")}function MGt({spinning:e}){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e?"is-spinning":"",children:a.jsx("path",{d:"M19.5 9A8 8 0 0 0 5 6L3 9m0-5v5h5M4.5 15A8 8 0 0 0 19 18l2-3m0 5v-5h-5"})})}function LGt(){return{busy:!1,error:"",message:""}}function $Gt({version:e,localMode:t,role:n,provider:i,region:r,onBack:s}){const{t:o}=Ae("ui"),l=n==="admin"||n==="super_admin",[c,u]=p.useState(""),[d,f]=p.useState([]),[h,m]=p.useState([]),[g,b]=p.useState(null),[v,y]=p.useState(!0),[x,w]=p.useState(""),[O,S]=p.useState(!0),[k,C]=p.useState(""),[E,R]=p.useState(!0),[_,j]=p.useState(""),[T,N]=p.useState(0),[A,P]=p.useState(0),[D,M]=p.useState(0),L=p.useRef(!1),[U,I]=p.useState({}),[H,K]=p.useState({}),[F,W]=p.useState(""),[V,X]=p.useState(!0),ie=p.useRef(new Set),Q=p.useRef(0),Z=`${i}:${r}`,ce=p.useRef(Z);ce.current=Z,p.useEffect(()=>{K({}),I({})},[Z]),p.useEffect(()=>(L.current=!0,()=>{L.current=!1}),[]);function Ee(G,te){I(ye=>({...ye,[G]:{...LGt(),...ye[G],...te}}))}async function Y(G){if(!G.toolId||ie.current.has(G.toolId))return;const te=Z;ie.current.add(G.toolId),Q.current+=1,Ee(G.toolId,{busy:!0,error:"",message:""});try{const ye=await ACe(G.kind);if(!L.current||ce.current!==te)return;Q.current+=1,K(Ne=>({...Ne,[G.toolId]:ye.state})),Ee(G.toolId,{busy:!1,error:"",message:ye.updated?o("systemInfo.modelEnvUpdated"):o("systemInfo.modelEnvAlreadyCurrent")})}catch{if(!L.current||ce.current!==te)return;Q.current+=1,Ee(G.toolId,{busy:!1,error:o("systemInfo.sandboxUpdateError"),message:""})}finally{ie.current.delete(G.toolId)}}return p.useEffect(()=>{if(!l)return;const G=new AbortController,te=++Q.current;return W(""),X(!0),TCe(G.signal).then(ye=>{G.signal.aborted||te!==Q.current||K(Object.fromEntries(ye.map(Ne=>[Ne.toolId,Ne])))}).catch(()=>{!G.signal.aborted&&te===Q.current&&W(o("systemInfo.versionCheckError"))}).finally(()=>{G.signal.aborted||X(!1)}),()=>G.abort()},[l,i,r,T]),p.useEffect(()=>{if(!Object.values(H).some(te=>te.status==="Updating"||te.status==="Creating"))return;const G=window.setTimeout(()=>N(te=>te+1),5e3);return()=>window.clearTimeout(G)},[H]),p.useEffect(()=>{if(!l){u(""),f([]),y(!1),w("");return}const G=new AbortController;return y(!0),w(""),TEe(G.signal).then(te=>{G.signal.aborted||(u(te.storage.tosAddress),f(te.sandboxTools))}).catch(te=>{(te==null?void 0:te.name)!=="AbortError"&&w(o("systemInfo.sandboxInfoError"))}).finally(()=>{G.signal.aborted||y(!1)}),()=>G.abort()},[l,i,r,T]),p.useEffect(()=>{if(!l){m([]),S(!1),C("");return}const G=new AbortController;return S(!0),C(""),PI(G.signal).then(te=>{m(te.filter(ye=>ye.isCurrent))}).catch(te=>{if((te==null?void 0:te.name)!=="AbortError"){if(t&&DGt(te)){m([]);return}C(o("systemInfo.userPoolError"))}}).finally(()=>{G.signal.aborted||S(!1)}),()=>G.abort()},[l,t,A]),p.useEffect(()=>{if(!l){b(null),R(!1),j("");return}const G=new AbortController;return R(!0),j(""),qEe(G.signal).then(b).catch(te=>{(te==null?void 0:te.name)!=="AbortError"&&j(o("systemInfo.environmentResourcesError"))}).finally(()=>{G.signal.aborted||R(!1)}),()=>G.abort()},[l,D]),a.jsxs("div",{className:"system-info-page",children:[a.jsxs("header",{className:"system-info-page-header",children:[a.jsx(YI,{label:o("common.back"),onClick:s}),a.jsxs("div",{children:[a.jsx("h1",{children:o("systemInfo.title")}),a.jsx("p",{children:o("systemInfo.description")})]})]}),a.jsxs("div",{className:"system-info-scroll",children:[a.jsxs("section",{className:"system-info-section","aria-labelledby":"studio-info-title",children:[a.jsx("h2",{id:"studio-info-title",children:o("systemInfo.general")}),a.jsx("dl",{className:"system-info-summary",children:a.jsxs("div",{children:[a.jsx("dt",{children:o("systemInfo.currentVersion")}),a.jsx("dd",{children:e||"—"})]})})]}),l?a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"system-info-section","aria-labelledby":"storage-info-title",children:[a.jsx("h2",{id:"storage-info-title",children:o("systemInfo.storage")}),v?a.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:o("systemInfo.loadingStorage")})}):x?a.jsxs("div",{className:"system-info-error",role:"alert",children:[a.jsx("p",{children:x}),a.jsx("button",{type:"button",onClick:()=>N(G=>G+1),children:o("common.reload")})]}):a.jsx("dl",{className:"system-info-summary",children:a.jsxs("div",{className:"system-info-resource-row",children:[a.jsx("dt",{children:o("systemInfo.tosAddress")}),a.jsx("dd",{className:`system-info-resource-value${c?"":" is-empty"}`,children:a.jsx(OO,{href:RGt(i,c),label:o("systemInfo.openTosConsole"),children:c||o("common.notConfigured")})})]})})]}),a.jsxs("section",{className:"system-info-section","aria-labelledby":"environment-build-info-title",children:[a.jsx("h2",{id:"environment-build-info-title",children:o("systemInfo.environmentBuild")}),E?a.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:o("systemInfo.loadingEnvironmentResources")})}):_?a.jsxs("div",{className:"system-info-error",role:"alert",children:[a.jsx("p",{children:_}),a.jsx("button",{type:"button",onClick:()=>M(G=>G+1),children:o("common.reload")})]}):g?a.jsxs("dl",{className:"system-info-summary",children:[a.jsxs("div",{className:"system-info-resource-row",children:[a.jsx("dt",{children:o("systemInfo.codePipelineWorkspace")}),a.jsx("dd",{className:"system-info-resource-value",children:a.jsx(OO,{href:g.codePipeline.consoleUrl||null,label:o("systemInfo.openCodePipelineWorkspace"),children:g.codePipeline.workspaceName||g.codePipeline.workspaceId||o("systemInfo.createdOnFirstBuild")})})]}),a.jsxs("div",{className:"system-info-resource-row",children:[a.jsx("dt",{children:o("systemInfo.codePipelinePipeline")}),a.jsx("dd",{className:"system-info-resource-value",children:g.codePipeline.pipelineName||g.codePipeline.pipelineId||o("systemInfo.createdOnFirstBuild")})]}),a.jsxs("div",{className:"system-info-resource-row",children:[a.jsx("dt",{children:o("systemInfo.containerRegistryRepository")}),a.jsx("dd",{className:"system-info-resource-value",children:a.jsx(OO,{href:g.containerRegistry.consoleUrl||null,label:o("systemInfo.openContainerRegistryRepository"),children:g.containerRegistry.imageRepository||[g.containerRegistry.registry,g.containerRegistry.namespace,g.containerRegistry.repository].filter(Boolean).join("/")||o("systemInfo.createdOnFirstBuild")})})]})]}):null]}),a.jsxs("section",{className:"system-info-section","aria-labelledby":"sandbox-tool-title",children:[a.jsx("h2",{id:"sandbox-tool-title",children:o("systemInfo.sandboxInfo")}),a.jsx("button",{type:"button",className:"system-info-refresh",disabled:V,onClick:()=>N(G=>G+1),children:o(V?"systemInfo.checkingVersions":"systemInfo.checkUpdates")}),v?a.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:o("systemInfo.loadingSandboxInfo")})}):x?a.jsxs("div",{className:"system-info-error",role:"alert",children:[a.jsx("p",{children:x}),a.jsx("button",{type:"button",onClick:()=>N(G=>G+1),children:o("common.reload")})]}):a.jsxs("div",{className:"system-info-tool-list",children:[F?a.jsx("span",{className:"system-info-inline-error",role:"alert",children:F}):null,d.map(G=>{var me;const te=H[G.toolId],ye=U[G.toolId],Ne=!!G.toolId&&!!(te!=null&&te.canUpdate),pe=(ye==null?void 0:ye.error)||(te!=null&&te.error?o("systemInfo.versionCheckError"):te!=null&&te.modelEnvError?o("systemInfo.modelEnvRepairUnavailable"):"");return a.jsx("dl",{className:"system-info-tool",children:a.jsxs("div",{className:"system-info-resource-row",children:[a.jsxs("dt",{className:"system-info-tool-label",children:[a.jsx("span",{children:G.label}),G.snapshot?a.jsx("span",{className:"system-info-tool-badge",children:o("systemInfo.snapshot")}):null]}),a.jsxs("dd",{className:`system-info-resource-value${G.toolId?"":" is-empty"}`,children:[a.jsx(OO,{href:IGt(i,(te==null?void 0:te.region)||r,G.toolId),label:o("systemInfo.openToolConsole",{name:G.label}),children:G.toolId||o("common.notConfigured")}),Ne?a.jsx("button",{type:"button",className:"system-info-resource-update",disabled:ye==null?void 0:ye.busy,"aria-busy":(ye==null?void 0:ye.busy)||void 0,"aria-label":o("systemInfo.updateSandbox",{name:G.label,variant:G.snapshot?o("systemInfo.snapshotWithSpace"):""}),title:o("systemInfo.updateSandbox",{name:G.label,variant:G.snapshot?o("systemInfo.snapshotWithSpace"):""}),onClick:()=>void Y(G),children:a.jsx(MGt,{spinning:(ye==null?void 0:ye.busy)||!1})}):null,te!=null&&te.currentImage?a.jsxs("span",{className:"system-info-inline-status",title:`${te.currentImage} → ${te.latestImage}`,children:[te.currentImage.split(":").pop(),te.needsImageUpdate?` → ${(me=te.latestImage)==null?void 0:me.split(":").pop()}`:"",te.status==="Updating"?` · ${o("systemInfo.updatingSandbox")}`:""]}):null,ye!=null&&ye.message?a.jsx("span",{className:"system-info-inline-status",role:"status",children:ye.message}):null,pe?a.jsx("span",{className:"system-info-inline-error",role:"alert",children:pe}):null]})]})},G.kind)})]})]}),a.jsxs("section",{className:"system-info-section","aria-labelledby":"user-pool-title",children:[a.jsx("h2",{id:"user-pool-title",children:o("systemInfo.userPool")}),O?a.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:a.jsx(yn,{as:"span",children:o("systemInfo.loadingUserPool")})}):k?a.jsxs("div",{className:"system-info-error",role:"alert",children:[a.jsx("p",{children:k}),a.jsx("button",{type:"button",onClick:()=>P(G=>G+1),children:o("common.reload")})]}):h.length>0?a.jsx("div",{className:"system-info-pool-list",children:h.map(G=>a.jsxs("dl",{className:"system-info-pool",children:[a.jsxs("div",{children:[a.jsx("dt",{children:o("common.name")}),a.jsx("dd",{className:"system-info-resource-value",children:a.jsx(OO,{href:PGt(i,G.region||r,G.uid),label:o("systemInfo.openUserPoolConsole",{name:G.name||""}),children:G.name||o("systemInfo.unnamedUserPool")})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("systemInfo.id")}),a.jsx("dd",{children:G.uid||"—"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("systemInfo.domain")}),a.jsx("dd",{children:G.domain||"—"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:o("systemInfo.region")}),a.jsx("dd",{children:G.region||"—"})]})]},G.uid))}):a.jsx("p",{className:"system-info-empty",children:o(t?"systemInfo.noLocalUserPool":"systemInfo.noUserPool")})]})]}):null]})]})}const FGt="_TextLink_16uec_1",BGt={TextLink:FGt},L2=e=>{const{children:t,primary:n=!1,underline:i=!n,className:r,target:s,forceExternal:o,as:l,href:c,to:u,...d}=e,f=o??/^https?:\/\//.test(c??u??""),h=q_e(),m=l||(f?"a":h),g={...d,className:Ti(BGt.TextLink,r),"data-primary":n?"":void 0,"data-underline":i?"":void 0};if(!c&&!u)return a.jsx("span",{...g,role:"button",children:t});const b={...f?{target:"_blank",rel:"noopener noreferrer",href:c??u}:{href:c,to:u},...g};return a.jsx(m,{...b,children:t})},UGt="/assets/media/article-agent-workflow-GXPkXUjV.webp",QGt="/assets/media/article-tool-debugging-BxiMDz_8.webp",zGt="/assets/media/showcase-a2ui-BgBnE9RT.webp",VGt="/assets/media/showcase-customer-service-DNw0mUH1.webp",HGt="/assets/media/showcase-multimodal-BRTl8NLI.webp",qGt="/assets/media/showcase-research-assistant-CbfMFfhS.webp",WGt="/assets/media/showcase-web-search-D2kl1imN.webp",KGt={volcengine:{console:"https://console.volcengine.com/agentkit",docs:"https://www.volcengine.com/docs/86681/1844823"},byteplus:{console:"https://console.byteplus.com/agentkit",docs:"https://docs.byteplus.com/en/docs/AgentKit"}};function GGt(e){return KGt[e]}const XGt=[{id:"documentation",titleKey:"developerResources.sections.documentation.title",descriptionKey:"developerResources.sections.documentation.description"},{id:"best-practices",titleKey:"developerResources.sections.bestPractices.title",descriptionKey:"developerResources.sections.bestPractices.description"},{id:"showcases",titleKey:"developerResources.sections.showcases.title",descriptionKey:"developerResources.sections.showcases.description"}],YGt="https://volcengine.github.io/veadk-python/",ZGt="https://volcengine.github.io/agentkit-sdk-python/content/2.agentkit-cli/1.overview.html",JGt=[{id:"veadk-development",titleKey:"developerResources.articles.veadkDevelopment.title",descriptionKey:"developerResources.articles.veadkDevelopment.description",meta:"AgentKit · VeADK",image:UGt,href:"https://docs.volcengine.com/docs/86681/2155817?lang=zh"},{id:"agentkit-cli-development",titleKey:"developerResources.articles.cliDevelopment.title",descriptionKey:"developerResources.articles.cliDevelopment.description",meta:"AgentKit · CLI",image:QGt,href:"https://docs.volcengine.com/docs/86681/1844871?lang=zh"}],eXt=[{id:"research-assistant",titleKey:"developerResources.showcases.researchAssistant.title",descriptionKey:"developerResources.showcases.researchAssistant.description",image:qGt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/06_multi_agent"},{id:"multimodal-analysis",titleKey:"developerResources.showcases.multimodalAnalysis.title",descriptionKey:"developerResources.showcases.multimodalAnalysis.description",image:HGt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/multimodal_agent"},{id:"customer-service",titleKey:"developerResources.showcases.customerService.title",descriptionKey:"developerResources.showcases.customerService.description",image:VGt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/basic-app"},{id:"web-search",titleKey:"developerResources.showcases.webSearch.title",descriptionKey:"developerResources.showcases.webSearch.description",image:WGt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/04_web_search"},{id:"a2ui-app",titleKey:"developerResources.showcases.a2uiApp.title",descriptionKey:"developerResources.showcases.a2uiApp.description",image:zGt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/a2ui_agent"}];function tXt({cloudProvider:e}){const{t}=Ae("workspaceTools"),n=GGt(e);return a.jsxs(Df,{className:"developer-resources","aria-label":t("developerResources.title"),children:[a.jsx(Ky,{title:t("developerResources.title")}),a.jsx("div",{className:"developer-resources__content",children:XGt.map(i=>a.jsxs("section",{className:"developer-resources__section","aria-labelledby":`developer-resources-${i.id}`,children:[a.jsxs("header",{className:"developer-resources__section-header",children:[a.jsx("h2",{id:`developer-resources-${i.id}`,children:t(i.titleKey)}),a.jsx("p",{children:t(i.descriptionKey)})]}),i.id==="documentation"?a.jsxs("ul",{className:"developer-resources__links",children:[a.jsx("li",{children:a.jsxs(L2,{className:"developer-resources__link",primary:!0,underline:!0,href:YGt,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.veadkDocs"),a.jsx(xA,{"aria-hidden":"true"})]})}),a.jsx("li",{children:a.jsxs(L2,{className:"developer-resources__link",primary:!0,underline:!0,href:ZGt,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.cliDocs"),a.jsx(xA,{"aria-hidden":"true"})]})}),a.jsx("li",{children:a.jsxs(L2,{className:"developer-resources__link",primary:!0,underline:!0,href:n.docs,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.platformDocs"),a.jsx(xA,{"aria-hidden":"true"})]})}),a.jsx("li",{children:a.jsxs(L2,{className:"developer-resources__link",primary:!0,underline:!0,href:n.console,target:"_blank",rel:"noreferrer",children:[t("developerResources.links.console"),a.jsx(xA,{"aria-hidden":"true"})]})})]}):i.id==="best-practices"?a.jsx("div",{className:"developer-resources__articles",children:JGt.map(r=>a.jsxs("a",{className:"developer-resources__article",href:r.href,target:"_blank",rel:"noreferrer",children:[a.jsx("img",{src:r.image,alt:t("developerResources.articles.coverAlt",{title:t(r.titleKey)}),loading:"lazy"}),a.jsxs("span",{className:"developer-resources__article-copy",children:[a.jsx("strong",{children:t(r.titleKey)}),a.jsx("span",{children:t(r.descriptionKey)}),a.jsx("small",{children:r.meta})]})]},r.id))}):i.id==="showcases"?a.jsx("div",{className:"developer-resources__showcases",children:eXt.map(r=>a.jsxs("a",{className:"developer-resources__showcase",href:r.href,target:"_blank",rel:"noreferrer",children:[a.jsx("span",{className:"developer-resources__showcase-media",children:a.jsx("img",{src:r.image,alt:t("developerResources.showcases.previewAlt",{title:t(r.titleKey)}),loading:"lazy"})}),a.jsx("strong",{children:t(r.titleKey)}),a.jsx("span",{children:t(r.descriptionKey)})]},r.id))}):null]},i.id))})]})}function nXt({cloudProvider:e,onPendingCountChange:t,onChanged:n}){const{t:i,i18n:r}=Ae("agentReviews"),[s,o]=p.useState(Ki(e)),[l,c]=p.useState([]),[u,d]=p.useState(!0),[f,h]=p.useState(""),[m,g]=p.useState(""),[b,v]=p.useState("all"),[y,x]=p.useState(0),[w,O]=p.useState(null);p.useEffect(()=>{o(Ki(e))},[e]),p.useEffect(()=>{const C=new AbortController;return d(!0),h(""),Sqt(s,C.signal).then(E=>{C.signal.aborted||(c(E.items),t(E.items.filter(R=>R.status==="pending").length))}).catch(E=>{C.signal.aborted||h(E instanceof Error?E.message:String(E))}).finally(()=>{C.signal.aborted||d(!1)}),()=>C.abort()},[s,y,t]);const S=p.useMemo(()=>l.filter(C=>(b==="all"||C.status===b)&&`${C.agent.name} ${C.submitter.name}`.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase())),[l,m,b]),k=[{key:"name",header:i("agent"),className:"review-column-name",render:C=>a.jsx("button",{type:"button",className:"agent-review-name",onClick:()=>O(C),children:C.agent.name})},{key:"submitter",header:i("submitter"),render:C=>a.jsx(LR,{person:C.submitter})},{key:"version",header:i("version"),render:C=>C.agent.version??"—"},{key:"submittedAt",header:i("submittedAt"),render:C=>a.jsx("time",{dateTime:C.submittedAt,children:new Date(C.submittedAt).toLocaleString(r.language)})},{key:"status",header:i("statusTitle"),render:C=>a.jsxs("div",{children:[i(`status.${C.status}`),C.reviewer?a.jsx(LR,{person:C.reviewer}):null]})},{key:"actions",header:i("actions"),render:C=>a.jsx("button",{type:"button",onClick:()=>O(C),children:i(C.status==="pending"?"review":"details")})}];return a.jsxs("div",{className:"agent-review-center","aria-label":i("title"),children:[f?a.jsxs("div",{className:"agent-review-error",role:"alert",children:[a.jsx("p",{children:f}),a.jsx("button",{type:"button",onClick:()=>x(C=>C+1),children:i("refresh")})]}):null,a.jsx(kz,{rows:S,rowKey:C=>`${C.region}:${C.id}`,columns:k,searchValue:m,onSearchChange:g,searchPlaceholder:i("search"),searchLabel:i("search"),toolbarActions:a.jsxs(a.Fragment,{children:[a.jsx(cg,{id:"agent-review-region",ariaLabel:i("region"),value:s,options:Jc(e),onChange:C=>{o(C),c([]),O(null)}}),a.jsx(cg,{id:"agent-review-status",ariaLabel:i("statusTitle"),value:b,options:["all","pending","approved","returned","withdrawn"].map(C=>({value:C,label:i(C==="all"?"all":`status.${C}`)})),onChange:v}),a.jsx("button",{type:"button",disabled:u,onClick:()=>x(C=>C+1),children:i("refresh")})]}),emptyLabel:u?a.jsx(Fa,{}):f?null:a.jsx("p",{className:"agent-review-empty",children:i(m||b!=="all"?"noMatches":"empty")})}),w?a.jsx(j6e,{runtimeId:w.runtimeId,region:w.region,name:w.agent.name,canPublish:!0,onClose:()=>O(null),onChanged:()=>{n==null||n(),x(C=>C+1)}},`${w.region}:${w.id}`):null]})}function iXt({application:e,decision:t,onClose:n,onDecided:i}){const{t:r}=Ae("reviews"),[s,o]=p.useState(""),[l,c]=p.useState(e.status==="approving"&&e.comment||""),[u,d]=p.useState(!1),[f,h]=p.useState(!1),m=p.useRef(!1),[g,b]=p.useState(null),v=t==="returned",y=v&&!s.trim(),x=p.useRef(document.activeElement instanceof HTMLElement?document.activeElement:null),w=async()=>{if(!m.current&&(d(!0),!y)){m.current=!0,h(!0),b(null);try{const O=await xPt({id:e.id,region:e.region,decision:t,reason:s.trim(),comment:l.trim()});i(O)}catch(O){b(vr(O,r("decision.failed")))}finally{m.current=!1,h(!1)}}};return a.jsx(DD,{open:!0,onOpenChange:O=>{!O&&!m.current&&n()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"review-backdrop"}),a.jsxs(ID,{className:"confirm-box review-decision",finalFocus:()=>{var O;return(O=x.current)!=null&&O.isConnected?x.current:document.getElementById("review-skill-tab")},children:[a.jsx(MD,{className:"confirm-title",children:r(v?"decision.returnTitle":"decision.approveTitle")}),a.jsx(RD,{className:"confirm-text",children:r(v?"decision.returnDescription":"decision.approveDescription",{name:e.name,version:e.version})}),v?a.jsxs("div",{className:"review-decision__field",children:[a.jsx("label",{className:"cw-label",htmlFor:"review-return-reason",children:r("decision.reason")}),a.jsx("textarea",{id:"review-return-reason",className:"cw-input",rows:4,maxLength:256,required:!0,disabled:f,value:s,onChange:O=>o(O.target.value),onBlur:()=>d(!0),"aria-invalid":u&&y,"aria-describedby":"review-return-help"}),a.jsx("span",{id:"review-return-help",className:u&&y?"cw-error-text":"cw-help",role:u&&y?"alert":void 0,children:r(u&&y?"decision.reasonRequired":"decision.reasonHelp")})]}):null,a.jsxs("div",{className:"review-decision__field",children:[a.jsx("label",{className:"cw-label",htmlFor:"review-decision-comment",children:r("decision.comment")}),a.jsx("textarea",{id:"review-decision-comment",className:"cw-input",rows:3,maxLength:256,disabled:f||e.status==="approving",value:l,onChange:O=>c(O.target.value),"aria-describedby":"review-comment-help"}),a.jsx("span",{id:"review-comment-help",className:"cw-help",children:r("decision.commentHelp")})]}),g?a.jsx("div",{role:"alert",className:"review-decision__error",children:a.jsx(ms,{error:g})}):null,a.jsxs("div",{className:"confirm-actions",children:[a.jsx(Dt,{color:"secondary",variant:"outline",size:"md",pill:!1,disabled:f,onClick:n,children:r("actions.cancel")}),a.jsx(Dt,{color:"primary",size:"md",pill:!1,disabled:f||y,onClick:()=>void w(),children:r(f?"decision.saving":v?"actions.confirmReturn":"actions.confirmApprove")})]})]})]})})}const rXt=p.lazy(()=>Vu(()=>Promise.resolve().then(()=>qVt),void 0).then(e=>({default:e.SkillFileTree})));function sXt({application:e,cloudProvider:t,onClose:n,onDecision:i,onScoreChanged:r}){var O;const{t:s,i18n:o}=Ae("reviews"),[l,c]=p.useState("overview"),[u,d]=p.useState([]),[f,h]=p.useState(!1),[m,g]=p.useState(null),[b,v]=p.useState(0),y=p.useRef(document.activeElement instanceof HTMLElement?document.activeElement:null);p.useEffect(()=>{if(l!=="files")return;const S=new AbortController;return h(!0),g(null),vPt({id:e.id,region:e.region,signal:S.signal}).then(k=>{S.signal.aborted||d(k.files)}).catch(k=>{S.signal.aborted||g(vr(k,s("detail.filesFailed")))}).finally(()=>{S.signal.aborted||h(!1)}),()=>S.abort()},[e.id,e.region,l,b,s]);const x=e.reviewedAt?new Date(e.reviewedAt).toLocaleString(o.language,{hour12:!1}):"—",w=e.submittedAt?new Date(e.submittedAt).toLocaleString(o.language,{hour12:!1}):"—";return a.jsx(DD,{open:!0,onOpenChange:S=>{S||n()},children:a.jsxs(PD,{children:[a.jsx(ND,{className:"review-backdrop"}),a.jsxs(ID,{className:"review-drawer",finalFocus:()=>{var S;return(S=y.current)!=null&&S.isConnected?y.current:document.getElementById("review-skill-tab")},children:[a.jsxs("header",{className:"review-drawer__header",children:[a.jsxs("div",{children:[a.jsx(MD,{children:s("detail.title")}),a.jsx(RD,{children:s("detail.versionFixed")})]}),a.jsx(MH,{className:"review-icon-button","aria-label":s("actions.close"),children:a.jsx(tD,{})})]}),a.jsxs("div",{className:"review-drawer__identity",children:[a.jsx("span",{className:"review-resource-icon",children:a.jsx(nje,{})}),a.jsxs("div",{children:[a.jsx("h2",{children:e.name}),a.jsxs("span",{children:[s("kind.skill")," · ",e.version]})]}),a.jsx(fT,{status:e.status})]}),a.jsx(Xy,{className:"review-drawer__tabs",idPrefix:"review-detail",ariaLabel:s("detail.sections"),value:l,items:[{id:"overview",label:s("detail.overview"),panelId:"review-detail-panel"},{id:"files",label:s("detail.filesTab"),panelId:"review-detail-panel"},{id:"score",label:s("score.title"),panelId:"review-detail-panel"}],onChange:c}),a.jsx("div",{className:"review-drawer__body",id:"review-detail-panel",role:"tabpanel","aria-labelledby":`review-detail-${l}-tab`,children:l==="score"?a.jsx(g6e,{application:e,canRetry:!0,onScoreChanged:r},`${e.region}:${e.id}`):l==="files"?f?a.jsx(Fa,{}):m?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:m}),a.jsx("button",{type:"button",onClick:()=>v(S=>S+1),children:s("space.retry")})]}):a.jsx("div",{className:"review-files",children:a.jsx(p.Suspense,{fallback:a.jsx(Fa,{}),children:a.jsx(rXt,{files:u})})}):a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"review-facts",children:[a.jsxs("div",{children:[a.jsx("dt",{children:s("columns.submitter")}),a.jsx("dd",{children:e.author||s("detail.unknownAuthor")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("columns.submittedAt")}),a.jsx("dd",{children:w})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("columns.version")}),a.jsx("dd",{children:e.version})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("detail.source")}),a.jsx("dd",{children:s("detail.source_skill",{name:e.author})})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("detail.destination")}),a.jsx("dd",{children:s("detail.destination_skill")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("detail.region")}),a.jsx("dd",{children:If(e.region,t)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:s("detail.visibility")}),a.jsx("dd",{children:s("detail.shared")})]})]}),a.jsxs("section",{className:"review-detail-section",children:[a.jsx("h3",{children:s("detail.description")}),a.jsx("p",{children:e.description||"—"})]}),a.jsxs("section",{className:"review-detail-section",children:[a.jsx("h3",{children:s("detail.result")}),a.jsx(FH,{application:e})]}),a.jsxs("section",{className:"review-detail-section review-history",children:[a.jsx("h3",{children:s("detail.history")}),a.jsxs("div",{children:[a.jsx("span",{className:"review-history__dot","aria-hidden":"true"}),a.jsxs("p",{children:[a.jsx("strong",{children:s("detail.submitted",{name:e.author})}),a.jsx("span",{children:w})]})]}),e.reviewedAt?a.jsxs("div",{children:[a.jsx("span",{className:"review-history__dot","aria-hidden":"true"}),a.jsxs("p",{children:[a.jsx("strong",{children:s(`detail.${e.status==="approved"?"approved":e.status==="returned"?"returned":"approving"}`,{name:((O=e.reviewer)==null?void 0:O.name)||e.reviewedBy||s("detail.unknownReviewer")})}),a.jsx("span",{children:x})]})]}):null]})]})}),a.jsxs("footer",{className:"review-drawer__footer",children:[e.status==="pending"?a.jsx(Dt,{color:"secondary",variant:"outline",size:"md",pill:!1,onClick:()=>i("returned"),children:s("actions.return")}):null,e.status==="pending"||e.status==="approving"?a.jsx(Dt,{color:"primary",size:"md",pill:!1,onClick:()=>i("approved"),children:s(e.status==="approving"?"actions.resumeApproval":"actions.approve")}):a.jsx("span",{children:s(`status.${e.status}`)})]})]})]})})}function oXt({cloudProvider:e,onAgentChanged:t}){const{t:n,i18n:i}=Ae("reviews"),[r,s]=p.useState([]),[o,l]=p.useState(null),[c,u]=p.useState("skill"),[d,f]=p.useState(Ki(e)),[h,m]=p.useState(!0),[g,b]=p.useState(null),[v,y]=p.useState(0),[x,w]=p.useState("all"),[O,S]=p.useState(""),[k,C]=p.useState(null),[E,R]=p.useState(null),[_,j]=p.useState(""),T=(D,M,L=!1)=>{C(null),j(""),R({application:D,value:M,fromDetails:L})};p.useEffect(()=>{if(c!=="skill")return;const D=new AbortController;let M,L=!1,U=!1;m(!0),b(null);const I=async()=>{if(!(L||D.signal.aborted)){L=!0;try{const K=await yPt({region:d,signal:D.signal});if(D.signal.aborted)return;s(K.items),C(F=>F&&K.items.find(W=>W.id===F.id)||null),U=K.items.some(F=>m6e(F.aiReview)),U&&document.visibilityState!=="hidden"&&(M=setTimeout(()=>void I(),5e3))}catch(K){D.signal.aborted||b(vr(K,n("space.failed"))),U=!1}finally{L=!1,D.signal.aborted||m(!1)}}},H=()=>{clearTimeout(M),U&&document.visibilityState!=="hidden"&&I()};return I(),document.addEventListener("visibilitychange",H),()=>{D.abort(),clearTimeout(M),document.removeEventListener("visibilitychange",H)}},[d,c,v,n]);const N=rHt(r,c,x,O),A=!!O.trim()||x!=="all",P=[{key:"name",header:n("columns.application"),className:"review-column-name",render:D=>a.jsxs("div",{className:"review-name",children:[a.jsx("span",{className:"review-resource-icon",children:a.jsx(nje,{})}),a.jsx("div",{children:a.jsx("button",{type:"button",title:D.name,onClick:()=>C(D),children:D.name})})]})},{key:"submitter",header:n("columns.submitter"),className:"review-column-submitter",render:D=>D.author||n("detail.unknownAuthor")},{key:"version",header:n("columns.version"),className:"review-column-version",render:D=>D.version},{key:"submitted",header:n("columns.submittedAt"),className:"review-column-time",render:D=>D.submittedAt?a.jsx("time",{dateTime:D.submittedAt,title:new Date(D.submittedAt).toLocaleString(i.language),children:new Date(D.submittedAt).toLocaleString(i.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"—"},{key:"status",header:n("columns.status"),className:"review-column-status",render:D=>a.jsxs("div",{className:"review-table-outcome",children:[a.jsx(fT,{status:D.status}),D.reviewer||D.reviewedBy?a.jsx($H,{compact:!0,person:D.reviewer,fallback:D.reviewedBy}):null]})},{key:"score",header:n("score.title"),className:"review-column-score",render:D=>a.jsx(LH,{score:D.aiReview})},{key:"actions",header:n("columns.actions"),className:"review-column-actions",render:D=>a.jsxs("div",{className:"review-row-actions",children:[a.jsx("button",{type:"button",onClick:()=>C(D),"aria-label":n("actions.detailsFor",{name:D.name}),children:n("actions.details")}),D.status==="pending"||D.status==="approving"?a.jsx("button",{type:"button",onClick:()=>T(D,"approved"),children:n(D.status==="approving"?"actions.resumeApproval":"actions.approve")}):null,D.status==="pending"?a.jsx("button",{type:"button",onClick:()=>T(D,"returned"),children:n("actions.return")}):null]})}];return a.jsxs(Df,{className:"review-center","aria-label":n("title"),children:[a.jsx(Ky,{title:n("title")}),a.jsx(Gy,{children:a.jsx(Xy,{idPrefix:"review",ariaLabel:n("category"),value:c,items:["skill","agent"].map(D=>({id:D,label:a.jsxs(a.Fragment,{children:[n(`kind.${D}`),D==="agent"?o===null?null:a.jsx("span",{className:"review-tab-count",children:o}):a.jsx("span",{className:"review-tab-count",children:r.filter(M=>M.kind===D&&(M.status==="pending"||M.status==="approving")).length})]}),panelId:"review-requests-panel"})),onChange:D=>{u(D),w("all"),S(""),C(null)}})}),a.jsx("div",{className:"review-center__panel",id:"review-requests-panel",role:"tabpanel","aria-labelledby":`review-${c}-tab`,children:c==="agent"?a.jsx(nXt,{cloudProvider:e,onPendingCountChange:l,onChanged:t}):a.jsxs(a.Fragment,{children:[c==="skill"&&g?a.jsxs("div",{role:"alert",children:[a.jsx(ms,{error:g}),a.jsx("button",{type:"button",onClick:()=>y(D=>D+1),children:n("space.retry")})]}):null,_?a.jsx("p",{role:"status",className:"review-notice",children:_}):null,a.jsx(kz,{rows:N,rowKey:D=>D.id,columns:P,searchValue:O,onSearchChange:S,searchPlaceholder:n("search"),searchLabel:n("search"),toolbarActions:a.jsxs(a.Fragment,{children:[c==="skill"?a.jsxs(a.Fragment,{children:[a.jsx(cg,{id:"review-region",ariaLabel:n("detail.region"),value:d,options:Jc(e),onChange:D=>{s([]),C(null),f(D)}}),a.jsx("button",{type:"button",disabled:h,onClick:()=>y(D=>D+1),children:n("actions.refresh")})]}):null,a.jsx(cg,{id:"review-status",ariaLabel:n("filterStatus"),value:x,options:["all","pending","approving","approved","returned"].map(D=>({value:D,label:n(`status.${D}`)})),onChange:w})]}),emptyLabel:c==="skill"&&h?a.jsx(Fa,{}):c==="skill"&&g?null:a.jsxs("div",{className:"review-empty",children:[a.jsx("strong",{children:n(A?"empty.filteredTitle":"empty.title")}),a.jsx("span",{children:n(A?"empty.filteredDescription":"empty.description")}),A?a.jsx("button",{type:"button",onClick:()=>{S(""),w("all")},children:n("actions.clearFilters")}):null]})}),a.jsx("div",{className:"review-center__count",children:n("total",{count:N.length})})]})}),k?a.jsx(sXt,{application:k,cloudProvider:e,onClose:()=>C(null),onDecision:D=>T(k,D,!0),onScoreChanged:(D,M)=>{const L=gHt(D);s(U=>U.map(I=>I.id===k.id?{...I,aiReview:L}:I)),M&&y(U=>U+1)}},k.id):null,E?a.jsx(iXt,{application:E.application,decision:E.value,onClose:()=>{E.fromDetails&&C(E.application),R(null),y(D=>D+1)},onDecided:D=>{s(M=>M.map(L=>L.id===D.id?D:L)),E.fromDetails&&C(D),j(n(D.status==="approved"?"decision.approved":"decision.returned",{name:D.name})),R(null)}},`${E.application.id}:${E.value}`):null]})}function aXt({role:e,cloudProvider:t,onAgentChanged:n}){const{t:i}=Ae("reviews");return e!=="admin"&&e!=="super_admin"?a.jsxs(Df,{className:"review-center",children:[a.jsx(Ky,{title:i("title")}),a.jsx("p",{role:"status",children:i("adminOnly")})]}):a.jsx(oXt,{cloudProvider:t,onAgentChanged:n},t)}const $2=10;function lXt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function cXt({hidden:e,...t}){return a.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[a.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),a.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?a.jsx("path",{d:"m4 4 12 12"}):null]})}function ab(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function uXt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function dXt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function kO(e,t,n){const i=t.trim();if(!i)return n?"github.validation.required":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(i))return"github.validation.repository";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(i)||i.includes("..")))return"github.validation.baseBranch";if(e==="projectPath"&&(i.startsWith("/")||i.split("/").includes("..")))return"github.validation.projectPath";if(e==="runtimeName")return b1(i,r=>`github.validation.runtimeName.${r}`)??"";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(i))return"github.validation.runtimeId";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(i))return"github.validation.modelName";if(e==="modelBaseUrl")try{const r=new URL(i);if(r.protocol!=="https:"||r.username||r.password||r.search||r.hash)return"github.validation.modelBaseUrlSafe"}catch{return"github.validation.modelBaseUrl"}return e==="pullRequestUrl"&&!/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*\/?$/.test(i)?"请输入完整的 GitHub Pull Request URL":""}function fXt(e){try{return`https://github.com/${XH(e)}`}catch{return""}}function hXt(e){return e==="started"?"评审中":e==="completed"?"已完成":e==="ignored"?"已忽略":"失败"}function pXt(e){return e==="webhook"?"自动触发":"手动发起"}function mXt(e){return e.reason?e.status!=="ignored"?e.reason:e.reason==="repository-review-disabled"?"忽略原因:仓库未开启自动评审":e.reason==="pull-request-not-reviewable"?"忽略原因:该 PR 事件不需要评审,仅评审新建、更新、重新打开和转为可评审的非 Draft、非 fork PR":e.reason==="review-settings-unavailable"?"忽略原因:自动评审设置不可用":e.reason==="unsupported-event"?"忽略原因:不是 Pull Request 事件":`忽略原因:${e.reason}`:""}function gXt(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Lse(e,t,n,i){if(n===0)return`第 ${e} 页`;const r=(e-1)*t+1,s=r+n-1;return`第 ${e} 页 · ${r}-${s}${i?"+":""}`}function bXt({automation:e,cloudProvider:t,onBack:n,onOpenSandboxSession:i}){const{t:r}=Ae("automations"),s=cGt(e),o=e==="review",l=Jc(t),c=s.secrets({cloudProvider:t}),[u,d]=p.useState(()=>({...s.initialValues({cloudProvider:t})})),f=l.find(Ge=>Ge.value===u.region),[h,m]=p.useState({}),[g,b]=p.useState(""),[v,y]=p.useState(!1),[x,w]=p.useState(!1),[O,S]=p.useState(!1),[k,C]=p.useState(null),[E,R]=p.useState(""),[_,j]=p.useState(null),[T,N]=p.useState(""),[A,P]=p.useState(!1),[D,M]=p.useState(null),[L,U]=p.useState(""),[I,H]=p.useState(o),[K,F]=p.useState([]),[W,V]=p.useState(o),[X,ie]=p.useState(""),[Q,Z]=p.useState(null),[ce,Ee]=p.useState(1),[Y,G]=p.useState(!1),[te,ye]=p.useState(""),[Ne,pe]=p.useState(""),[me,se]=p.useState(""),[Se,Le]=p.useState([]),[be,Ve]=p.useState(o),[ve,Re]=p.useState(""),[ne,ge]=p.useState(null),[Ce,ke]=p.useState(1),[Ke,it]=p.useState(!1),ue=p.useRef(null),xe=p.useRef(null),Te=p.useRef(null),qe=p.useRef(null),De=p.useRef(null),At=fXt(u.repository),It=At.replace("https://github.com/",""),lt=At?`${At}/settings/secrets/actions`:"",Ot=(D==null?void 0:D.appSlug)||"agentkit-veadk-studio",Ct=(D==null?void 0:D.installUrl)||`https://github.com/apps/${Ot}/installations/new`,dt=Rse(E),yt=K.filter(Ge=>Ge.reviewEnabled),Ie=dt?K.find(Ge=>Ge.fullName.toLowerCase()===dt.toLowerCase()):void 0,vt=ce>1||Y,jt=Ce>1||Ke;p.useEffect(()=>()=>{var Ge,bt,St,dn,Rt;(Ge=ue.current)==null||Ge.abort(),(bt=xe.current)==null||bt.abort(),(St=Te.current)==null||St.abort(),(dn=qe.current)==null||dn.abort(),(Rt=De.current)==null||Rt.abort()},[]),p.useEffect(()=>{var Ge,bt,St;d({...s.initialValues({cloudProvider:t})}),m({}),b(""),C(null),S(!1),(Ge=ue.current)==null||Ge.abort(),(bt=xe.current)==null||bt.abort(),(St=De.current)==null||St.abort(),j(null),N(""),Le([]),Re(""),ge(null),Ee(1),G(!1),ye(""),pe(""),ke(1),it(!1)},[e,t,s]),p.useEffect(()=>{var bt;if(!o)return;(bt=Te.current)==null||bt.abort();const Ge=new AbortController;Te.current=Ge,H(!0),U(""),BKt(Ge.signal).then(St=>{Te.current===Ge&&(M(St),St.configured||(V(!1),Ve(!1)))}).catch(St=>{Ge.signal.aborted||Te.current!==Ge||(U(St instanceof Error?St.message:String(St)),V(!1),Ve(!1))}).finally(()=>{Te.current===Ge&&(Te.current=null,H(!1))})},[o]);const Nt=(Ge=ce,bt=Ne)=>{var dn;(dn=qe.current)==null||dn.abort();const St=new AbortController;qe.current=St,V(!0),ie(""),UKt(St.signal,{page:Ge,pageSize:$2,query:bt}).then(Rt=>{if(qe.current===St){if(Rt.repositories.length===0&&Rt.page>1){Ee(Rt.page-1),Nt(Rt.page-1);return}F(Rt.repositories),Ee(Rt.page),G(Rt.hasNextPage),Z({reviewSettingsConfigured:Rt.reviewSettingsConfigured,reviewSettingsReason:Rt.reviewSettingsReason})}}).catch(Rt=>{St.signal.aborted||qe.current!==St||ie(Rt instanceof Error?Rt.message:String(Rt))}).finally(()=>{qe.current===St&&(qe.current=null,V(!1))})},ln=(Ge=Ce)=>{var St;(St=De.current)==null||St.abort();const bt=new AbortController;De.current=bt,Ve(!0),Re(""),QKt(bt.signal,{page:Ge,pageSize:$2}).then(dn=>{if(De.current===bt){if(dn.records.length===0&&dn.page>1){ke(dn.page-1),ln(dn.page-1);return}Le(dn.records),ke(dn.page),it(dn.hasNextPage),ge({reviewSettingsConfigured:dn.reviewSettingsConfigured,reviewSettingsReason:dn.reviewSettingsReason})}}).catch(dn=>{bt.signal.aborted||De.current!==bt||Re(dn instanceof Error?dn.message:String(dn))}).finally(()=>{De.current===bt&&(De.current=null,Ve(!1))})};p.useEffect(()=>{!o||(D==null?void 0:D.configured)!==!0||(Nt(1),ln(1))},[D==null?void 0:D.configured,o]);const He=()=>{const Ge=te.trim();pe(Ge),Ee(1),Nt(1,Ge)},Me=()=>{ye(""),pe(""),Ee(1),Nt(1,"")},We=(Ge,bt)=>{if(!(bt<1)){if(Ge==="repositories"){Ee(bt),Nt(bt,Ne);return}ke(bt),ln(bt)}},gt=async Ge=>{if((Q==null?void 0:Q.reviewSettingsConfigured)!==!0||me)return;const bt=new AbortController;se(Ge.fullName),ie("");try{const St=await zKt({repository:Ge.fullName,reviewEnabled:!Ge.reviewEnabled},bt.signal),dn=new Set(St.map(Rt=>Rt.toLowerCase()));F(Rt=>Rt.map($e=>({...$e,reviewEnabled:dn.has($e.fullName.toLowerCase())})))}catch(St){ie(St instanceof Error?St.message:String(St))}finally{se("")}},st=(Ge,bt)=>{d(St=>({...St,[Ge]:bt})),h[Ge]&&m(St=>({...St,[Ge]:""}))},xt=Ge=>{var Rt;const bt=!o&&Ge==="token"||Ge==="pullRequestUrl"||((Rt=s.fields.find($e=>$e.name===Ge))==null?void 0:Rt.required)===!0,St=Ge==="pullRequestUrl"?E:u[Ge],dn=kO(Ge,St,bt);m($e=>({...$e,[Ge]:dn}))},ft=async Ge=>{var dn;if(Ge.preventDefault(),o)return;const bt={};for(const Rt of s.fields){const $e=kO(Rt.name,u[Rt.name],Rt.required);$e&&(bt[Rt.name]=$e)}if(!o){const Rt=kO("token",u.token,!0);Rt&&(bt.token=Rt)}if(m(bt),Object.keys(bt).length)return;(dn=ue.current)==null||dn.abort();const St=new AbortController;ue.current=St,y(!0),b(""),C(null);try{const Rt=await s.submit(u,{cloudProvider:t},St.signal);if(ue.current!==St)return;C(Rt),d($e=>({...$e,token:""}))}catch(Rt){if(St.signal.aborted||ue.current!==St)return;b(Rt instanceof Error?Rt.message:String(Rt))}finally{ue.current===St&&(ue.current=null,y(!1))}},Ht=Ge=>{Ge.key==="Enter"&&(Ge.nativeEvent.isComposing||Ge.nativeEvent.keyCode===229)&&Ge.preventDefault()},cn=async()=>{var dn;const Ge={},bt=kO("pullRequestUrl",E,!0);if(bt&&(Ge.pullRequestUrl=bt),!bt){const Rt=Rse(E),$e=K.find(ot=>ot.fullName.toLowerCase()===Rt.toLowerCase());$e?$e.reviewEnabled||(Ge.pullRequestUrl=`请先在下方开启 ${$e.fullName} 的评审`):Ge.pullRequestUrl="PR URL 所属仓库尚未安装 GitHub App"}if(m(Ge),Object.keys(Ge).length)return;(dn=xe.current)==null||dn.abort();const St=new AbortController;xe.current=St,P(!0),N(""),j(null);try{const Rt=await FKt({pullRequestUrl:E.trim()},St.signal);if(xe.current!==St)return;j(Rt),d($e=>({...$e,token:""})),ln(),i==null||i(Rt.sessionId)}catch(Rt){if(St.signal.aborted||xe.current!==St)return;N(Rt instanceof Error?Rt.message:String(Rt))}finally{xe.current===St&&(xe.current=null,P(!1))}},hn=Ge=>{const{name:bt,placeholder:St,required:dn}=Ge,Rt=bt==="repository",$e=`cards.${e}.fields.${bt}`;return a.jsxs("div",{className:"github-field",children:[a.jsxs("div",{className:"github-field-label-row",children:[a.jsxs("label",{htmlFor:`github-${bt}`,children:[a.jsx("span",{children:r(`${$e}.label`)}),a.jsx("span",{className:`github-field-requirement${dn?" is-required":""}`,children:r(dn?"github.required":"github.optional")})]}),Rt?a.jsxs("a",{className:"github-field-action",href:"https://github.com/",target:"_blank",rel:"noreferrer",children:["https://github.com/",a.jsx(ab,{})]}):null]}),a.jsx("input",{id:`github-${bt}`,value:u[bt],onChange:ot=>st(bt,ot.target.value),onBlur:()=>xt(bt),placeholder:r(`${$e}.placeholder`,{defaultValue:St}),required:dn,"aria-invalid":!!h[bt],"aria-describedby":`github-${bt}-help${h[bt]?` github-${bt}-error`:""}`}),a.jsx("span",{id:`github-${bt}-help`,className:"github-field-help",children:Rt&&It?o?r("github.repositoryReviewHelp",{repository:It}):r("github.repositoryConfigHelp",{repository:It}):r(`${$e}.help`)}),h[bt]?a.jsx("span",{id:`github-${bt}-error`,className:"github-field-error",role:"alert",children:r(h[bt])}):null]},bt)};return a.jsxs("div",{className:"github-integration-page",children:[a.jsxs("header",{className:"github-integration-header",children:[a.jsx("button",{type:"button",className:"github-back",onClick:n,"aria-label":r("backToAutomations"),children:a.jsx(lXt,{})}),a.jsx(VH,{className:"github-integration-logo"}),a.jsxs("div",{children:[a.jsx("h1",{children:r(`cards.${e}.title`)}),a.jsx("p",{children:r(`cards.${e}.subtitle`)})]})]}),a.jsx("div",{className:"github-integration-layout",children:a.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[a.jsx("div",{className:"github-panel-heading",children:a.jsx("p",{children:r(`cards.${e}.panel`)})}),a.jsxs("form",{className:"github-release-form",onSubmit:ft,onKeyDown:Ht,noValidate:!0,children:[o?null:a.jsxs("div",{className:"github-field-grid",children:[s.fields.map(hn),a.jsxs("div",{className:"github-field",children:[a.jsxs("label",{id:"github-region-label",children:[a.jsx("span",{children:r("github.region")}),a.jsx("span",{className:"github-field-requirement is-required",children:r("github.required")})]}),a.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:Ge=>{Ge.key==="Escape"&&S(!1)},children:[a.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":O,onClick:()=>S(Ge=>!Ge),children:[a.jsx("span",{children:(f==null?void 0:f.label)??u.region}),a.jsx(uXt,{className:`pp-region-chevron${O?" is-open":""}`})]}),O?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"menu-scrim",onClick:()=>S(!1)}),a.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":r("github.region"),children:l.map(Ge=>{const bt=Ge.value===u.region;return a.jsxs("button",{type:"button",role:"option","aria-selected":bt,className:`pp-region-option${bt?" is-selected":""}`,onClick:()=>{st("region",Ge.value),S(!1)},children:[a.jsx("span",{children:Ge.label}),bt?a.jsx(dXt,{}):null]},Ge.value)})})]}):null]}),a.jsx("span",{className:"github-field-help",children:r(`cards.${e}.regionHelp`)})]})]}),o?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`github-app-card${D!=null&&D.configured?" is-ready":""}`,children:[a.jsxs("div",{children:[a.jsx("strong",{children:"GitHub App 授权"}),a.jsx("span",{children:I?"正在检查中心服务配置...":D!=null&&D.configured?`安装 ${Ot} 到目标仓库后,可在下方开启自动评审。`:L||(D==null?void 0:D.reason)||"管理员未配置 GitHub App。"})]}),a.jsxs("a",{className:"github-app-install-link",href:Ct,target:"_blank",rel:"noreferrer",children:["安装 GitHub App",a.jsx(ab,{})]})]}),a.jsxs("section",{className:"github-review-section github-app-repositories","aria-labelledby":"github-app-repositories-title",children:[a.jsxs("div",{className:"github-review-section-header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"github-app-repositories-title",children:"已安装仓库"}),a.jsx("p",{children:"只有开启评审的仓库会响应 GitHub webhook 自动触发。"})]}),a.jsx("button",{type:"button",onClick:()=>Nt(),disabled:!(D!=null&&D.configured)||W,children:W?"刷新中...":"刷新"})]}),X?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:X}):null,(Q==null?void 0:Q.reviewSettingsConfigured)===!1&&!X?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:Q.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法保存启用评审设置。"}):null,a.jsxs("div",{className:"github-app-repository-search",children:[a.jsx("input",{type:"search",value:te,onChange:Ge=>ye(Ge.target.value),onKeyDown:Ge=>{Ge.key==="Enter"&&(Ge.preventDefault(),He())},placeholder:"搜索 owner 或仓库名","aria-label":"搜索已安装仓库"}),a.jsx("button",{type:"button",onClick:He,disabled:!(D!=null&&D.configured)||W,children:"搜索"}),Ne?a.jsx("button",{type:"button",onClick:Me,disabled:W,children:"清除"}):null]}),W&&K.length===0?a.jsx("div",{className:"github-app-repository-empty",children:"正在读取 GitHub App 安装仓库..."}):null,!W&&K.length===0&&!X?a.jsx("div",{className:"github-app-repository-empty",children:Ne?`没有匹配 “${Ne}” 的已安装仓库。`:"GitHub App 尚未安装到任何仓库。"}):null,K.length>0?a.jsx("div",{className:"github-app-repository-list",children:K.map(Ge=>{const bt=me===Ge.fullName,St=(Q==null?void 0:Q.reviewSettingsConfigured)!==!0||!!me;return a.jsxs("div",{className:"github-app-repository-row",children:[a.jsxs("div",{className:"github-app-repository-main",children:[a.jsxs("a",{href:Ge.htmlUrl,target:"_blank",rel:"noreferrer",title:Ge.fullName,children:[Ge.fullName,a.jsx(ab,{})]}),a.jsxs("span",{children:[Ge.private?"Private":"Public"," · Installation ",Ge.installationId]})]}),a.jsx("button",{type:"button",className:`github-review-switch${Ge.reviewEnabled?" is-on":""}`,role:"switch","aria-checked":Ge.reviewEnabled,disabled:St,onClick:()=>{gt(Ge)},children:a.jsx("span",{children:bt?"保存中":Ge.reviewEnabled?"已启用":"未启用"})})]},Ge.fullName)})}):null,vt?a.jsxs("div",{className:"github-list-pagination","aria-label":"已安装仓库分页",children:[a.jsx("span",{children:Lse(ce,$2,K.length,Y)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>We("repositories",ce-1),disabled:ce<=1||W,children:"上一页"}),a.jsx("button",{type:"button",onClick:()=>We("repositories",ce+1),disabled:!Y||W,children:"下一页"})]})]}):null]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"github-field github-token-field",children:[a.jsxs("div",{className:"github-token-label-row",children:[a.jsxs("label",{htmlFor:"github-token",children:[a.jsx("span",{children:r("github.tokenLabel")}),a.jsx("span",{className:"github-field-requirement is-required",children:r("github.required")})]}),a.jsxs("a",{className:"github-field-action",href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write&workflows=write",target:"_blank",rel:"noreferrer",children:[r("github.createToken"),a.jsx(ab,{})]})]}),a.jsxs("div",{className:"github-token-input",children:[a.jsx("input",{id:"github-token",type:x?"text":"password",value:u.token,onChange:Ge=>st("token",Ge.target.value),onBlur:()=>xt("token"),autoComplete:"off",required:!0,placeholder:r("github.tokenWorkflowPlaceholder"),"aria-invalid":!!h.token,"aria-describedby":`github-token-help${h.token?" github-token-error":""}`}),a.jsx("button",{type:"button",onClick:()=>w(Ge=>!Ge),"aria-label":r(x?"github.hideToken":"github.showToken"),title:r(x?"github.hideToken":"github.showToken"),children:a.jsx(cXt,{hidden:x})})]}),a.jsx("span",{id:"github-token-help",className:"github-field-help",children:r("github.tokenWorkflowHelp")}),h.token?a.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r(h.token)}):null]}),g?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:g}):null,k?a.jsxs("div",{className:"github-submit-message is-success github-result-message",role:"status",children:[a.jsxs("div",{children:[a.jsx("strong",{children:r("github.configPrCreated",{number:k.number})}),a.jsx("span",{children:r("github.configPrNextStep")})]}),a.jsxs("a",{className:"github-result-link",href:k.url,target:"_blank",rel:"noreferrer",children:[r("github.viewConfigPr"),a.jsx(ab,{})]})]}):null,a.jsxs("div",{className:"github-form-actions",children:[a.jsxs("div",{className:"github-secrets-note",children:[a.jsxs("div",{className:"github-secrets-header",children:[a.jsx("strong",{children:r("github.secretsConfigHeading")}),lt?a.jsxs("a",{className:"github-secrets-link",href:lt,target:"_blank",rel:"noreferrer",children:[r("github.openSecrets"),a.jsx(ab,{})]}):null]}),a.jsx("span",{className:"github-secrets-path",children:r("github.secretsPath")}),a.jsx("ul",{children:c.map(Ge=>{const[bt,...St]=Ge.split(":");return a.jsxs("li",{children:[a.jsx("code",{children:bt}),St.length?a.jsx("span",{children:St.join(":")}):null]},Ge)})})]}),a.jsx("button",{type:"submit",disabled:v,children:r(v?"github.submitting":`cards.${e}.submitLabel`)})]})]})]}),o?a.jsxs("div",{className:"github-pr-review-sections",children:[a.jsxs("section",{className:"github-review-section github-review-now","aria-labelledby":"github-review-now-title",children:[a.jsx("div",{className:"github-review-section-header",children:a.jsxs("div",{children:[a.jsx("h2",{id:"github-review-now-title",children:"立刻评审"}),a.jsx("p",{children:"输入已安装且已启用仓库的 PR URL,立即创建 Sandbox 评审任务。"})]})}),a.jsxs("div",{className:"github-review-section-body",children:[a.jsxs("div",{className:"github-field",children:[a.jsx("input",{id:"github-pull-request-url","aria-label":"Pull Request URL",value:E,onChange:Ge=>{R(Ge.target.value),h.pullRequestUrl&&m(bt=>({...bt,pullRequestUrl:""}))},onBlur:()=>m(Ge=>({...Ge,pullRequestUrl:kO("pullRequestUrl",E,!0)})),placeholder:"https://github.com/owner/repository/pull/123","aria-invalid":!!h.pullRequestUrl,"aria-describedby":h.pullRequestUrl?"github-pull-request-url-error":void 0}),h.pullRequestUrl?a.jsx("span",{id:"github-pull-request-url-error",className:"github-field-error",role:"alert",children:h.pullRequestUrl}):null,!h.pullRequestUrl&&dt?a.jsx("span",{className:"github-field-help",children:Ie!=null&&Ie.reviewEnabled?`将使用 GitHub App 评审 ${Ie.fullName}`:Ie?`请先在下方开启 ${Ie.fullName} 的评审`:`PR URL 所属仓库 ${dt} 尚未安装 GitHub App`}):null,!h.pullRequestUrl&&!dt&&yt.length>0?a.jsxs("span",{className:"github-field-help",children:["已启用仓库:",yt.map(Ge=>Ge.fullName).join("、")]}):null]}),T?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:T}):null,_?a.jsx("div",{className:"github-submit-message is-success",role:"status",children:a.jsxs("span",{children:["已发起评审,Session ",_.sessionId," 正在运行。"]})}):null,a.jsx("div",{className:"github-review-section-actions",children:a.jsx("button",{type:"button",onClick:cn,disabled:A,children:A?"发起评审中…":"立即发起评审"})})]})]}),a.jsxs("section",{className:"github-review-section github-review-records","aria-labelledby":"github-review-records-title",children:[a.jsxs("div",{className:"github-review-section-header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"github-review-records-title",children:"评审记录"}),a.jsx("p",{children:"展示最近自动触发和手动发起的评审任务。"})]}),a.jsx("button",{type:"button",onClick:()=>ln(),disabled:!(D!=null&&D.configured)||be,children:be?"刷新中...":"刷新"})]}),ve?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:ve}):null,(ne==null?void 0:ne.reviewSettingsConfigured)===!1&&!ve?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:ne.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法读取评审记录。"}):null,be&&Se.length===0?a.jsx("div",{className:"github-app-repository-empty",children:"正在读取 PR 评审记录..."}):null,!be&&Se.length===0&&!ve?a.jsx("div",{className:"github-app-repository-empty",children:"暂无 PR 评审记录。"}):null,Se.length>0?a.jsx("div",{className:"github-review-record-list",children:Se.map(Ge=>{const bt=mXt(Ge),St=Ge.status==="completed"?"":Ge.sessionId;return a.jsxs("div",{className:"github-review-record-row",children:[a.jsxs("div",{className:"github-review-record-main",children:[a.jsxs("div",{className:"github-review-record-title",children:[a.jsxs("a",{href:Ge.pullRequestUrl,target:"_blank",rel:"noreferrer",children:[Ge.repository,"#",Ge.pullRequestNumber,a.jsx(ab,{})]}),a.jsx("span",{className:`github-review-record-status is-${Ge.status}`,children:hXt(Ge.status)})]}),a.jsxs("span",{children:[pXt(Ge.trigger),Ge.action?` · ${Ge.action}`:""," · ",gXt(Ge.createdAt),bt?` · ${bt}`:""]})]}),a.jsx("div",{className:"github-review-record-actions",children:St&&i?a.jsx("button",{type:"button",onClick:()=>i(St),children:"打开 Session"}):null})]},Ge.id)})}):null,jt?a.jsxs("div",{className:"github-list-pagination","aria-label":"评审记录分页",children:[a.jsx("span",{children:Lse(Ce,$2,Se.length,Ke)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>We("records",Ce-1),disabled:Ce<=1||be,children:"上一页"}),a.jsx("button",{type:"button",onClick:()=>We("records",Ce+1),disabled:!Ke||be,children:"下一页"})]})]}):null]})]}):null]})})]})}async function a0(e){var i;const t=await e.json().catch(()=>null),n=(i=t==null?void 0:t.detail)==null?void 0:i.message;return new Error(n||`GitLab MR 评审请求失败(HTTP ${e.status})。`)}function $se(e,t){const n=e.trim().replace(/\/+$/,"");if(!n)return"";const i=`${n}/`,r=t.trim();if(!r.startsWith(i))return"";const s=r.slice(i.length).replace(/\/+$/,""),o="/-/merge_requests/",l=s.indexOf(o);if(l<=0)return"";const c=s.slice(l+o.length);return/^[1-9][0-9]*$/.test(c)?s.slice(0,l):""}async function Fse(e){const t=await gn("/web/gitlab/app/config",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await a0(t);const n=await t.json();if(typeof n.configured!="boolean"||typeof n.baseUrl!="string"||typeof n.webhookUrl!="string"||typeof n.reason!="string"||typeof n.oauthConfigured!="boolean"||typeof n.oauthConnected!="boolean"||n.oauthUser!==null&&n.oauthUser!==void 0&&(typeof n.oauthUser!="object"||typeof n.oauthUser.credentialId!="string"||typeof n.oauthUser.ownerId!="string"||typeof n.oauthUser.baseUrl!="string"||typeof n.oauthUser.gitlabUserId!="number"||typeof n.oauthUser.gitlabUsername!="string"||typeof n.oauthUser.gitlabName!="string"||typeof n.oauthUser.expiresAt!="number"))throw new Error("GitLab 集成配置响应格式无效。");return n}async function yXt(e,t){var s;const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)});(s=t.query)!=null&&s.trim()&&n.set("q",t.query.trim());const i=await gn(`/web/gitlab/app/projects?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await a0(i);const r=await i.json();if(!Array.isArray(r.projects)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.projects.some(o=>typeof o!="object"||o===null||typeof o.instanceId!="string"||typeof o.baseUrl!="string"||typeof o.projectId!="number"||typeof o.pathWithNamespace!="string"||typeof o.name!="string"||typeof o.namespace!="string"||typeof o.webUrl!="string"||typeof o.private!="boolean"||typeof o.reviewEnabled!="boolean"||typeof o.permissionsNote!="string"||typeof o.accessLevel!="number"||typeof o.canManageWebhooks!="boolean"||typeof o.reviewBindingStatus!="string"||typeof o.reviewBindingReason!="string"||typeof o.reviewCredentialOwner!="string"||typeof o.reviewCredentialType!="string"))throw new Error("GitLab 集成项目列表响应格式无效。");return r}async function vXt(e,t){const n=await gn("/web/gitlab/app/review-projects",{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await a0(n);const i=await n.json();if(!Array.isArray(i.projects)||i.projects.some(r=>typeof r!="object"||r===null||typeof r.projectId!="number"))throw new Error("GitLab 集成评审项目保存响应格式无效。");return i.projects}async function xXt(e){const t=await gn("/web/gitlab/oauth/disconnect",{method:"POST",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await a0(t)}async function wXt(e){const t=await gn("/web/gitlab/oauth/start-url",{method:"GET",headers:{Accept:"application/json"},signal:e});if(!t.ok)throw await a0(t);const n=await t.json();if(typeof n.authorizationUrl!="string"||!n.authorizationUrl)throw new Error("GitLab OAuth 授权地址响应格式无效。");return n.authorizationUrl}async function OXt(e,t){const n=new URLSearchParams({page:String(t.page),pageSize:String(t.pageSize)}),i=await gn(`/web/gitlab/app/review-records?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"},signal:e});if(!i.ok)throw await a0(i);const r=await i.json();if(!Array.isArray(r.records)||typeof r.page!="number"||typeof r.pageSize!="number"||typeof r.hasNextPage!="boolean"||typeof r.reviewSettingsConfigured!="boolean"||typeof r.reviewSettingsReason!="string"||r.records.some(s=>typeof s!="object"||s===null||typeof s.id!="string"||typeof s.projectId!="number"||typeof s.pathWithNamespace!="string"||typeof s.mergeRequestUrl!="string"||typeof s.mergeRequestIid!="number"||!["started","completed","ignored","failed"].includes(String(s.status))||!["manual","webhook"].includes(String(s.trigger))||typeof s.createdAt!="string"||typeof s.deliveryId!="string"||typeof s.action!="string"||typeof s.sessionId!="string"||typeof s.displayName!="string"||typeof s.reason!="string"))throw new Error("GitLab MR 评审记录响应格式无效。");return r}async function kXt(e,t){const n=await gn("/web/gitlab/merge-request-reviews",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw await a0(n);const i=await n.json();if(i.status!=="started"||typeof i.sessionId!="string"||!i.sessionId||typeof i.displayName!="string")throw new Error("GitLab MR 评审服务返回了无效结果。");return i}const F2=10;function B2(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M6.5 4H4a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M9 3h4v4M8.5 7.5 13 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function SXt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function EXt(e){return a.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:a.jsx("path",{d:"m22.54 9.64-.03-.08-2.2-6.81a.76.76 0 0 0-1.43-.08l-2.1 4.31H7.22l-2.1-4.31a.76.76 0 0 0-1.43.08l-2.2 6.81-.03.08a5.15 5.15 0 0 0 1.7 5.79l.01.01.02.01 8.81 6.58 8.81-6.58.02-.01.01-.01a5.15 5.15 0 0 0 1.7-5.79ZM12 20.08 8.65 8.59h6.7L12 20.08Z"})})}function CXt(e){return e==="started"?"进行中":e==="completed"?"已完成":e==="ignored"?"已忽略":"失败"}function TXt(e){return e==="webhook"?"自动触发":"手动发起"}function AXt(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function _Xt(e){return e.reason==="project-review-disabled"?"项目未启用":e.reason==="merge-request-not-reviewable"?"MR 不满足评审条件":e.reason}function Bse(e,t,n,i){const r=(e-1)*t+1,s=(e-1)*t+n;return i?`${r}-${s}`:`${r}-${s} / ${s}`}function jXt({onBack:e,onOpenSandboxSession:t}){const[n,i]=p.useState(null),[r,s]=p.useState(""),[o,l]=p.useState(!0),[c,u]=p.useState([]),[d,f]=p.useState(!0),[h,m]=p.useState(""),[g,b]=p.useState(null),[v,y]=p.useState(1),[x,w]=p.useState(!1),[O,S]=p.useState(""),[k,C]=p.useState(""),[E,R]=p.useState(null),[_,j]=p.useState(""),[T,N]=p.useState(!1),[A,P]=p.useState(""),[D,M]=p.useState(null),[L,U]=p.useState([]),[I,H]=p.useState(!0),[K,F]=p.useState(""),[W,V]=p.useState(1),[X,ie]=p.useState(!1),[Q,Z]=p.useState(null),[ce,Ee]=p.useState(!1),[Y,G]=p.useState(!1),te=p.useRef(null),ye=p.useRef(null),Ne=p.useRef(null),pe=n?$se(n.baseUrl,_):"",me=pe?c.find(ke=>ke.pathWithNamespace.toLowerCase()===pe.toLowerCase()):void 0,se=v>1||x,Se=W>1||X,Le=(n==null?void 0:n.configured)===!0&&n.oauthConnected,be=(ke=v,Ke=k)=>{var ue;(ue=ye.current)==null||ue.abort();const it=new AbortController;ye.current=it,f(!0),m(""),yXt(it.signal,{page:ke,pageSize:F2,query:Ke}).then(xe=>{if(ye.current===it){if(xe.projects.length===0&&xe.page>1){y(xe.page-1),be(xe.page-1,Ke);return}u(xe.projects),y(xe.page),w(xe.hasNextPage),b({reviewSettingsConfigured:xe.reviewSettingsConfigured,reviewSettingsReason:xe.reviewSettingsReason})}}).catch(xe=>{it.signal.aborted||ye.current!==it||m(xe instanceof Error?xe.message:String(xe))}).finally(()=>{ye.current===it&&(ye.current=null,f(!1))})},Ve=(ke=W)=>{var it;(it=Ne.current)==null||it.abort();const Ke=new AbortController;Ne.current=Ke,H(!0),F(""),OXt(Ke.signal,{page:ke,pageSize:F2}).then(ue=>{if(Ne.current===Ke){if(ue.records.length===0&&ue.page>1){V(ue.page-1),Ve(ue.page-1);return}U(ue.records),V(ue.page),ie(ue.hasNextPage),Z({reviewSettingsConfigured:ue.reviewSettingsConfigured,reviewSettingsReason:ue.reviewSettingsReason})}}).catch(ue=>{Ke.signal.aborted||Ne.current!==Ke||F(ue instanceof Error?ue.message:String(ue))}).finally(()=>{Ne.current===Ke&&(Ne.current=null,H(!1))})};p.useEffect(()=>{var Ke;(Ke=te.current)==null||Ke.abort();const ke=new AbortController;return te.current=ke,l(!0),s(""),Fse(ke.signal).then(it=>{te.current===ke&&(i(it),(!it.configured||it.oauthConfigured&&!it.oauthConnected)&&(f(!1),H(!1)))}).catch(it=>{ke.signal.aborted||te.current!==ke||(s(it instanceof Error?it.message:String(it)),f(!1),H(!1))}).finally(()=>{te.current===ke&&(te.current=null,l(!1))}),()=>{var it,ue;ke.abort(),(it=ye.current)==null||it.abort(),(ue=Ne.current)==null||ue.abort()}},[]),p.useEffect(()=>{Le&&(be(1,""),Ve(1))},[Le]);const ve=()=>{const ke=O.trim();C(ke),y(1),be(1,ke)},Re=async ke=>{if((g==null?void 0:g.reviewSettingsConfigured)!==!0||E!==null)return;if(!ke.reviewEnabled&&!Le){m("请先连接 GitLab 后再启用自动评审。");return}const Ke=new AbortController;R(ke.projectId),m("");try{await vXt({projectId:ke.projectId,reviewEnabled:!ke.reviewEnabled},Ke.signal),u(it=>it.map(ue=>ue.projectId===ke.projectId?{...ue,reviewEnabled:!ke.reviewEnabled}:ue))}catch(it){m(it instanceof Error?it.message:String(it))}finally{R(null)}},ne=async()=>{const ke=new AbortController;G(!0),s("");try{await xXt(ke.signal);const Ke=await Fse(ke.signal);i(Ke),u([]),b(null)}catch(Ke){s(Ke instanceof Error?Ke.message:String(Ke))}finally{G(!1)}},ge=async()=>{const ke=new AbortController;Ee(!0),s("");try{window.location.href=await wXt(ke.signal)}catch(Ke){s(Ke instanceof Error?Ke.message:String(Ke)),Ee(!1)}},Ce=async()=>{const ke=_.trim();if(!ke){P("请输入 GitLab Merge Request URL。");return}if(!(n!=null&&n.configured)){P("管理员未配置 GitLab OAuth。");return}if(!Le){P("请先连接 GitLab 后再发起评审。");return}if(!$se(n.baseUrl,ke)){P("请输入当前 GitLab 实例下的完整 Merge Request URL。");return}N(!0),P(""),M(null);const Ke=new AbortController;try{const it=await kXt({mergeRequestUrl:ke},Ke.signal);M(it),Ve(1)}catch(it){P(it instanceof Error?it.message:String(it))}finally{N(!1)}};return a.jsxs("div",{className:"github-integration-page",children:[a.jsxs("header",{className:"github-integration-header",children:[a.jsx("button",{type:"button",className:"github-back",onClick:e,"aria-label":"返回自动化",children:a.jsx(SXt,{})}),a.jsx(EXt,{className:"github-integration-logo"}),a.jsxs("div",{children:[a.jsx("h1",{children:"GitLab MR Review"}),a.jsx("p",{children:"通过 GitLab webhook 触发 Sandbox 评审,并将结果写回 Merge Request。"})]})]}),a.jsx("div",{className:"github-integration-layout",children:a.jsxs("section",{className:"github-section-panel",children:[a.jsx("div",{className:"github-panel-heading",children:a.jsx("p",{children:"请先为目标项目开启自动评审,再通过 webhook 或手动 URL 发起 MR 评审。"})}),a.jsxs("div",{className:"github-release-form",children:[a.jsxs("div",{className:`github-app-card${n!=null&&n.configured?" is-ready":""}`,children:[a.jsxs("div",{children:[a.jsx("strong",{children:"GitLab 集成配置"}),a.jsx("span",{children:o?"正在检查中心服务配置...":n!=null&&n.configured?n.oauthConnected&&n.oauthUser?`已连接 ${n.oauthUser.gitlabName||n.oauthUser.gitlabUsername} · ${n.baseUrl}`:`当前实例:${n.baseUrl}`:r||(n==null?void 0:n.reason)||"管理员未配置 GitLab OAuth。"})]}),n!=null&&n.oauthConfigured&&!n.oauthConnected?a.jsxs("button",{type:"button",className:"github-app-install-link",onClick:()=>{ge()},disabled:ce,children:[ce?"连接中...":"连接 GitLab",a.jsx(B2,{})]}):n!=null&&n.oauthConnected?a.jsx("button",{type:"button",className:"github-app-install-link",onClick:()=>{ne()},disabled:Y,children:Y?"断开中...":"断开授权"}):n!=null&&n.webhookUrl?a.jsxs("a",{className:"github-app-install-link",href:n.webhookUrl,target:"_blank",rel:"noreferrer",children:["Webhook",a.jsx(B2,{})]}):null]}),a.jsxs("section",{className:"github-review-section github-app-repositories","aria-labelledby":"gitlab-projects-title",children:[a.jsxs("div",{className:"github-review-section-header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"gitlab-projects-title",children:"可访问项目"}),a.jsx("p",{children:"只有开启评审的项目会响应 GitLab webhook 自动触发。"})]}),a.jsx("button",{type:"button",onClick:()=>be(),disabled:!Le||d,children:d?"刷新中...":"刷新"})]}),h?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:h}):null,(g==null?void 0:g.reviewSettingsConfigured)===!1&&!h?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:g.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法保存启用评审设置。"}):null,a.jsxs("div",{className:"github-app-repository-search",children:[a.jsx("input",{type:"search",value:O,onChange:ke=>S(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&(ke.preventDefault(),ve())},placeholder:"搜索 group 或项目名","aria-label":"搜索 GitLab 项目"}),a.jsx("button",{type:"button",onClick:ve,disabled:!Le||d,children:"搜索"}),k?a.jsx("button",{type:"button",onClick:()=>{S(""),C(""),y(1),be(1,"")},disabled:d||!Le,children:"清除"}):null]}),!Le&&!o?a.jsx("div",{className:"github-app-repository-empty",children:"请先连接 GitLab。"}):null,d&&c.length===0&&Le?a.jsx("div",{className:"github-app-repository-empty",children:"正在读取 GitLab 项目..."}):null,!d&&c.length===0&&!h&&Le?a.jsx("div",{className:"github-app-repository-empty",children:k?`没有匹配 “${k}” 的 GitLab 项目。`:"GitLab 集成暂无可访问项目。"}):null,c.length>0?a.jsx("div",{className:"github-app-repository-list",children:c.map(ke=>{const Ke=E===ke.projectId,it=(g==null?void 0:g.reviewSettingsConfigured)!==!0||E!==null||!ke.reviewEnabled&&!Le;return a.jsxs("div",{className:"github-app-repository-row",children:[a.jsxs("div",{className:"github-app-repository-main",children:[a.jsxs("a",{href:ke.webUrl,target:"_blank",rel:"noreferrer",title:ke.pathWithNamespace,children:[ke.pathWithNamespace,a.jsx(B2,{})]}),a.jsxs("span",{children:[ke.private?"Private":"Public"," · Project ",ke.projectId,ke.permissionsNote?` · ${ke.permissionsNote}`:"",ke.reviewBindingStatus&&ke.reviewBindingStatus!=="active"&&ke.reviewBindingStatus!=="disabled"?` · ${ke.reviewBindingReason||"授权失效"}`:""]})]}),a.jsx("button",{type:"button",className:`github-review-switch${ke.reviewEnabled?" is-on":""}`,role:"switch","aria-checked":ke.reviewEnabled,disabled:it,onClick:()=>{Re(ke)},children:a.jsx("span",{children:Ke?"保存中":ke.reviewEnabled?"已启用":"未启用"})})]},`${ke.instanceId}:${ke.projectId}`)})}):null,se?a.jsxs("div",{className:"github-list-pagination","aria-label":"GitLab 项目分页",children:[a.jsx("span",{children:Bse(v,F2,c.length,x)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>{y(v-1),be(v-1,k)},disabled:v<=1||d,children:"上一页"}),a.jsx("button",{type:"button",onClick:()=>{y(v+1),be(v+1,k)},disabled:!x||d,children:"下一页"})]})]}):null]})]}),a.jsxs("div",{className:"github-pr-review-sections",children:[a.jsxs("section",{className:"github-review-section github-review-now","aria-labelledby":"gitlab-review-now-title",children:[a.jsx("div",{className:"github-review-section-header",children:a.jsxs("div",{children:[a.jsx("h2",{id:"gitlab-review-now-title",children:"立刻评审"}),a.jsx("p",{children:"输入当前 GitLab 实例下的 MR URL,立即创建 Sandbox 评审任务。"})]})}),a.jsxs("div",{className:"github-review-section-body",children:[a.jsxs("div",{className:"github-field",children:[a.jsx("input",{"aria-label":"Merge Request URL",value:_,onChange:ke=>j(ke.target.value),placeholder:`${(n==null?void 0:n.baseUrl)||"https://gitlab.example.com"}/group/project/-/merge_requests/123`}),pe?a.jsx("span",{className:"github-field-help",children:me?`将使用 GitLab 授权评审 ${me.pathWithNamespace}`:`MR URL 所属项目 ${pe} 不在当前项目列表中`}):null]}),A?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:A}):null,D?a.jsx("div",{className:"github-submit-message is-success",role:"status",children:a.jsxs("span",{children:["已发起评审,Session ",D.sessionId," 正在运行。"]})}):null,a.jsx("div",{className:"github-review-section-actions",children:a.jsx("button",{type:"button",onClick:Ce,disabled:T||!Le,children:T?"发起评审中...":"立即发起评审"})})]})]}),a.jsxs("section",{className:"github-review-section github-review-records","aria-labelledby":"gitlab-review-records-title",children:[a.jsxs("div",{className:"github-review-section-header",children:[a.jsxs("div",{children:[a.jsx("h2",{id:"gitlab-review-records-title",children:"评审记录"}),a.jsx("p",{children:"展示最近自动触发和手动发起的评审任务。"})]}),a.jsx("button",{type:"button",onClick:()=>Ve(),disabled:!Le||I,children:I?"刷新中...":"刷新"})]}),K?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:K}):null,(Q==null?void 0:Q.reviewSettingsConfigured)===!1&&!K?a.jsx("div",{className:"github-submit-message is-error",role:"alert",children:Q.reviewSettingsReason||"管理员未配置 Studio 持久化存储,无法读取评审记录。"}):null,I&&L.length===0?a.jsx("div",{className:"github-app-repository-empty",children:"正在读取 MR 评审记录..."}):null,!I&&L.length===0&&!K?a.jsx("div",{className:"github-app-repository-empty",children:"暂无 MR 评审记录。"}):null,L.length>0?a.jsx("div",{className:"github-review-record-list",children:L.map(ke=>{const Ke=_Xt(ke),it=ke.status==="completed"?"":ke.sessionId;return a.jsxs("div",{className:"github-review-record-row",children:[a.jsxs("div",{className:"github-review-record-main",children:[a.jsxs("div",{className:"github-review-record-title",children:[a.jsxs("a",{href:ke.mergeRequestUrl,target:"_blank",rel:"noreferrer",children:[ke.pathWithNamespace,"!",ke.mergeRequestIid,a.jsx(B2,{})]}),a.jsx("span",{className:`github-review-record-status is-${ke.status}`,children:CXt(ke.status)})]}),a.jsxs("span",{children:[TXt(ke.trigger),ke.action?` · ${ke.action}`:""," · ",AXt(ke.createdAt),Ke?` · ${Ke}`:""]})]}),a.jsx("div",{className:"github-review-record-actions",children:it&&t?a.jsx("button",{type:"button",onClick:()=>t(it),children:"打开 Session"}):null})]},ke.id)})}):null,Se?a.jsxs("div",{className:"github-list-pagination","aria-label":"GitLab 评审记录分页",children:[a.jsx("span",{children:Bse(W,F2,L.length,X)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>{V(W-1),Ve(W-1)},disabled:W<=1||I,children:"上一页"}),a.jsx("button",{type:"button",onClick:()=>{V(W+1),Ve(W+1)},disabled:!X||I,children:"下一页"})]})]}):null]})]})]})})]})}const NXt=1050062,Use="1.0",RXt="https://lf-static.applogcdn.com/obj/applog-sdk-static/log-sdk/collect/5/collect.js";class IXt{constructor(){rn(this,"enabled",!1);rn(this,"initialized",!1);rn(this,"pending",[]);rn(this,"userUniqueId","");rn(this,"initPromise")}init(t){return this.enabled=t.enabled,this.enabled?this.initPromise?this.initPromise:(this.initPromise=Promise.resolve().then(()=>{const n=this.bootstrapCollector();n("init",{app_id:NXt,channel:"cn",disable_auto_pv:1}),this.userUniqueId&&n("config",{user_unique_id:this.userUniqueId}),n("config",{_staging_flag:t.environment==="prod"?0:1}),n("start"),this.initialized=!0;const i=this.pending;this.pending=[];for(const[r,s]of i)this.collect(r,s)}),this.initPromise):(this.pending=[],Promise.resolve())}identify(t){this.userUniqueId=t,this.initialized&&this.collect("config",{user_unique_id:t})}emit(t,n){if(this.enabled){if(this.initialized){this.collect(t,n);return}this.pending=[...this.pending.slice(-49),[t,n]]}}bootstrapCollector(){if(window.collectEvent)return window.collectEvent;window.LogAnalyticsObject="collectEvent";const t=function(){var r;(r=t.q)==null||r.push(arguments)};t.q=[],t.l=Date.now(),window.collectEvent=t;const n=document.createElement("script");return n.async=!0,n.src=RXt,n.onerror=()=>{this.enabled=!1,t.q=[],console.warn("[telemetry] TEA SDK script failed to load")},document.head.appendChild(n),t}collect(t,n){var i;(i=window.collectEvent)==null||i.call(window,t,n)}}const PXt=256,aFe=1024,g4="[REDACTED]";function DXt(e){if(typeof e!="string"&&typeof e!="number")return;const t=String(e).trim();return/^[A-Za-z0-9_.:-]{1,64}$/.test(t)?t:void 0}function dh(e,t){return t===void 0?{errorKind:e}:{errorKind:e,errorCode:t}}function lFe(e,t,n={}){if(e.length<=t)return e;if(n.preserveEnd){const r="[truncated] ...";return`${r}${e.slice(-Math.max(0,t-r.length))}`}const i="... [truncated]";return`${e.slice(0,Math.max(0,t-i.length))}${i}`}function MXt(e){return e.replace(/\b(Authorization\s*[:=]\s*)(Bearer\s+)?[^\s"',;&]+/gi,(t,n,i)=>`${n}${i??""}${g4}`).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi,`Bearer ${g4}`).replace(/\b([\w.-]*(?:token|password|passwd|secret|api[_-]?key|access[_-]?key|secret[_-]?key|cookie)[\w.-]*\s*[:=]\s*)(["']?)[^\s"',;&]+/gi,(t,n,i)=>`${n}${i}${g4}`)}function Qb(e,t={}){const n=e!==null&&typeof e=="object"?e:{},r=(typeof n.message=="string"?n.message:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):"").replace(/\s+/g," ").trim();if(r)return lFe(MXt(r),aFe,t)}function Aa(e,t={}){const n=e!==null&&typeof e=="object"?e:{},i=DXt(n.code),r=typeof n.name=="string"?n.name:"";if(r==="RuntimeProbeError")return dh("runtime_probe_error",i);if(r==="AbortError")return dh("abort",i);if(r==="RuntimeAccessDeniedError"||r==="AuthError")return dh("auth",i);if(t.phase==="build")return dh("build_failed",i);if(r==="TimeoutError")return dh("timeout",i);if(r==="NetworkError"||r==="TypeError")return dh("network",i);if(r==="ValidationError")return dh("validation",i);if(r==="ServerError")return dh("server",i);const s=typeof n.status=="number"&&Number.isInteger(n.status)?n.status:void 0;if(s===void 0||s<400||s>599)return dh("unknown",i);const o=String(s);return s===401||s===403?{errorKind:"auth",errorCode:o}:s===400||s===409||s===422?{errorKind:"validation",errorCode:o}:s>=500?{errorKind:"server",errorCode:o}:{errorKind:"unknown",errorCode:o}}const LXt=["schema_version","event_id","operation_id","user_pool_id","studio_deploy_id","vefaas_application_id","vefaas_function_id","studio_region","studio_project","studio_version","environment","cloud_provider","account_id","account_id_resolution_error","user_role","user_source","page_instance_id"],$Xt={studio_entry_viewed:["auth_state"],studio_session_started:["agents_source"],studio_agent_deploy:["status","agent_id","deploy_action","deploy_source","create_mode","ai_assisted","deploy_region","runtime_network_type","feishu_enabled","runtime_id","duration_ms","failed_phase","error_kind","error_code","error_message"],studio_sandbox_create:["status","sandbox_kind","sandbox_source","sandbox_id","duration_ms","error_kind","error_code"],studio_agent_debug:["status","agent_id","variant_type","debug_run_id","duration_ms","failed_phase","error_kind","error_code"],studio_agent_connect:["status","target_id","agent_kind","connect_source","runtime_region","runtime_is_mine","sandbox_status","duration_ms","error_kind","error_code"],studio_agent_message:["status","agent_id","agent_kind","message_source","session_state","session_id","duration_ms","failed_phase","error_kind","error_code"],studio_agent_source_download:["status","agent_id","deploy_action","deploy_source","create_mode","ai_assisted","duration_ms","file_count","zip_size_bytes","error_kind","error_code"]};function FXt(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function Qse(e,t){const n=new Set([...LXt,...$Xt[e]]),i={};for(const[r,s]of Object.entries(t))!n.has(r)||!FXt(s)||(typeof s=="string"?i[r]=lFe(s,r==="error_message"?aFe:PXt):i[r]=s);return i}function BXt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function UXt(){return typeof performance<"u"?performance.now():Date.now()}function K0(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}class QXt{constructor(t){rn(this,"sink");rn(this,"createId");rn(this,"now");rn(this,"pageInstanceId");rn(this,"context");rn(this,"identity");rn(this,"entryViewed",!1);rn(this,"sessionStarted",!1);this.sink=t.sink,this.createId=t.createId??BXt,this.now=t.now??UXt,this.pageInstanceId=this.createId()}setContext(t){var n,i;this.context={...t,accountId:((n=t.accountId)==null?void 0:n.trim())??"",accountIdResolutionError:((i=t.accountIdResolutionError)==null?void 0:i.trim())??""}}identify(t){var i,r,s;const n=t.userUniqueId.trim();n&&(this.identity&&this.identity.userUniqueId!==n&&(this.pageInstanceId=this.createId(),this.sessionStarted=!1),this.identity={...t,userUniqueId:n,accountId:((i=t.accountId)==null?void 0:i.trim())??""},(s=(r=this.sink).identify)==null||s.call(r,n))}trackStudioSessionStarted(t){this.sessionStarted||!this.context||!this.identity||(this.sessionStarted=!0,this.emit("studio_session_started",{agents_source:t.agentsSource}))}trackStudioEntryViewed(t){if(this.entryViewed||!this.context)return;this.entryViewed=!0;const n=Qse("studio_entry_viewed",K0({schema_version:Use,event_id:this.createId(),user_pool_id:this.context.userPoolId,studio_deploy_id:this.context.studioDeployId,vefaas_application_id:this.context.applicationId,vefaas_function_id:this.context.functionId,studio_region:this.context.studioRegion,studio_project:this.context.studioProject,studio_version:this.context.studioVersion,environment:this.context.environment,cloud_provider:this.context.cloudProvider,account_id:this.context.accountId,account_id_resolution_error:this.context.accountIdResolutionError||void 0,page_instance_id:this.pageInstanceId,auth_state:t.authState}));this.sink.emit("studio_entry_viewed",n)}beginAgentDeploy(t){return this.beginOperation("studio_agent_deploy",{agent_id:t.agentId,deploy_action:t.deployAction,deploy_source:t.deploySource,create_mode:t.createMode,ai_assisted:t.aiAssisted,deploy_region:t.deployRegion,runtime_network_type:t.runtimeNetworkType,feishu_enabled:t.feishuEnabled},n=>({runtime_id:n.runtimeId}),n=>({failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode,error_message:n.errorMessage}))}beginSandboxCreate(t){return this.beginOperation("studio_sandbox_create",{sandbox_kind:t.sandboxKind,sandbox_source:t.sandboxSource},n=>({sandbox_id:n.sandboxId}),n=>({error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentDebug(t){return this.beginOperation("studio_agent_debug",{agent_id:t.agentId,variant_type:t.variantType},n=>({debug_run_id:n.debugRunId}),n=>({failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentConnect(t){return this.beginOperation("studio_agent_connect",{target_id:t.targetId,agent_kind:t.agentKind,connect_source:t.connectSource},n=>K0({runtime_region:n.runtimeRegion,runtime_is_mine:n.runtimeIsMine,sandbox_status:n.sandboxStatus}),n=>K0({error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentMessage(t){return this.beginOperation("studio_agent_message",K0({agent_id:t.agentId,agent_kind:t.agentKind,message_source:t.messageSource,session_state:t.sessionState,session_id:t.sessionId}),n=>({session_id:n.sessionId}),n=>K0({session_id:n.sessionId,failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentSourceDownload(t){return this.beginOperation("studio_agent_source_download",{agent_id:t.agentId,deploy_action:t.deployAction,deploy_source:t.deploySource,create_mode:t.createMode,ai_assisted:t.aiAssisted},n=>({file_count:n.fileCount,zip_size_bytes:n.zipSizeBytes}),n=>({file_count:n.fileCount,error_kind:n.errorKind,error_code:n.errorCode}))}beginOperation(t,n,i,r){const s=this.createId(),o=this.now(),l=!!(this.context&&this.identity);let c=!1;l&&this.emit(t,{...n,status:"started"},s);const u=(d,f)=>{c||(c=!0,l&&this.emit(t,{...n,...f,status:d,duration_ms:Math.max(0,this.now()-o)},s))};return{operationId:s,succeed:d=>u("succeeded",i(d)),fail:d=>u("failed",r(d))}}emit(t,n,i){if(!this.context||!this.identity)return;const r=Qse(t,K0({schema_version:Use,event_id:this.createId(),operation_id:i,user_pool_id:this.context.userPoolId,studio_deploy_id:this.context.studioDeployId,vefaas_application_id:this.context.applicationId,vefaas_function_id:this.context.functionId,studio_region:this.context.studioRegion,studio_project:this.context.studioProject,studio_version:this.context.studioVersion,environment:this.context.environment,cloud_provider:this.context.cloudProvider,account_id:this.identity.accountId,account_id_resolution_error:this.context.accountIdResolutionError||void 0,user_role:this.identity.userRole,user_source:this.identity.userSource,page_instance_id:this.pageInstanceId,...n}));this.sink.emit(t,r)}}const cFe=new IXt,Kf=new QXt({sink:cFe});function zXt(e){return cFe.init(e)}function VXt(e){Kf.setContext(e)}function HXt(e){Kf.identify(e)}function qXt(e){Kf.trackStudioEntryViewed(e)}function WXt(e){Kf.trackStudioSessionStarted(e)}function uFe(e){return Kf.beginAgentDeploy(e)}function KXt(e){return Kf.beginSandboxCreate(e)}function GXt(e){return Kf.beginAgentDebug(e)}function U2(e){return Kf.beginAgentConnect(e)}function zse(e){return Kf.beginAgentMessage(e)}function dFe(e){return Kf.beginAgentSourceDownload(e)}const XXt=/^[A-Za-z_][A-Za-z0-9_]*$/;function pT(e,t=n=>Kt(`validation.agentName.${n}`)){return e.trim().length===0?t("required"):e==="user"?t("reserved"):XXt.test(e)?null:t("characters")}function YXt(e){const t=new Set,n=new Set,i=r=>{pT(r.name)===null&&(t.has(r.name)?n.add(r.name):t.add(r.name)),r.subAgents.forEach(i)};return i(e),n}function ZXt(e){return{...eu(),name:e,description:$f("feishu.generatedAgent.description"),instruction:$f("feishu.generatedAgent.instruction"),deployment:{feishuEnabled:!0}}}async function JXt(e){const t=ZXt(e.agentName),n=await Dk(t);return Qy(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const nf=["cn-beijing","cn-shanghai"],fFe=["prepare","build","deploy","publish"];function eYt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function tYt(e){return a.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vse(e){return a.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function nYt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function iYt(e){if(!e||e==="upload")return 0;const t=fFe.findIndex(n=>n===e);return t<0?0:t}function b4(e){switch(e){case"prepare":case"upload":case"build":case"deploy":case"publish":case"update":case"evaluation":return e;default:return"unknown"}}function Hse(e){const t=pT(e,n=>n);return t?`feishu.validation.agentName.${t}`:""}function rYt({onBack:e}){const{t}=Ae("automations"),[n,i]=p.useState("feishu_assistant"),[r,s]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState("cn-beijing"),[h,m]=p.useState(!1),[g,b]=p.useState(""),[v,y]=p.useState(""),[x,w]=p.useState(""),[O,S]=p.useState("idle"),[k,C]=p.useState(null),[E,R]=p.useState(""),[_,j]=p.useState(null),T=p.useRef(null),N=p.useRef(null),A=p.useRef([]),P=p.useRef(0),D=p.useRef(null),M=p.useRef(null),L=p.useRef("prepare"),U=p.useRef(!1),I=p.useRef(!0),H=["preparing","running","cancelling"].includes(O);p.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]),p.useEffect(()=>{var Ee;if(!h)return;(Ee=A.current[P.current])==null||Ee.focus();const Z=Y=>{Y.target instanceof Node&&T.current&&!T.current.contains(Y.target)&&m(!1)},ce=Y=>{var G;Y.key==="Escape"&&(m(!1),(G=N.current)==null||G.focus())};return window.addEventListener("pointerdown",Z),window.addEventListener("keydown",ce),()=>{window.removeEventListener("pointerdown",Z),window.removeEventListener("keydown",ce)}},[h]);const K=Z=>{Z.key==="Enter"&&(Z.nativeEvent.isComposing||Z.nativeEvent.keyCode===229)&&Z.preventDefault()},F=()=>{const Z=Hse(n.trim()),ce=r.trim()?"":"feishu.validation.appId",Ee=o.trim()?"":"feishu.validation.appSecret";return b(Z),y(ce),w(Ee),!Z&&!ce&&!Ee},W=async Z=>{if(Z.preventDefault(),!F()||H)return;const ce=crypto.randomUUID();D.current=ce,L.current="prepare",U.current=!1,S("preparing"),C(null),R(""),j(null);const Ee=uFe({agentId:String(n.trim()),deployAction:"create",deploySource:"feishu_automation",createMode:"feishu_template",aiAssisted:0,deployRegion:String(d),runtimeNetworkType:"public",feishuEnabled:1});M.current=Ee;try{const Y=await JXt({agentName:n.trim(),appId:r.trim(),appSecret:o.trim(),region:d,taskId:ce,onStage:G=>{L.current=G.phase||"deploy",!(!I.current||U.current)&&(S("running"),C(G))}});if(U.current){Ee.fail({failedPhase:b4(L.current),errorKind:"abort",errorMessage:Qb("User cancelled deployment")});return}if(Ee.succeed({runtimeId:String(Y.runtimeId||"")}),!I.current)return;j(Y),l(""),u(!1),S("succeeded")}catch(Y){if(Ee.fail({failedPhase:b4(L.current),...U.current?{errorKind:"abort"}:Aa(Y,{phase:L.current}),errorMessage:Qb(Y)}),!I.current||U.current)return;S("failed"),R(Y instanceof Error?Y.message:String(Y))}finally{D.current===ce&&(D.current=null),M.current===Ee&&(M.current=null)}},V=async()=>{var ce;const Z=D.current;if(!(!Z||O!=="running")&&window.confirm(t("feishu.confirmCancel"))){U.current=!0,S("cancelling"),R("");try{await JEe(Z),(ce=M.current)==null||ce.fail({failedPhase:b4(L.current),errorKind:"abort",errorMessage:Qb("User cancelled deployment")}),I.current&&S("cancelled")}catch(Ee){if(U.current=!1,!I.current)return;S("failed"),R(Ee instanceof Error?Ee.message:String(Ee))}}},X=iYt((k==null?void 0:k.phase)??null),ie=!!(n.trim()&&r.trim()&&o.trim()&&!H),Q=t(`feishu.regions.${d}`);return a.jsxs("div",{className:"feishu-integration-page",children:[a.jsxs("header",{className:"feishu-integration-header",children:[a.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":t("backToAutomations"),disabled:H,children:a.jsx(eYt,{})}),a.jsx("img",{className:"feishu-integration-logo",src:BD,alt:"","aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("h1",{children:t("feishu.title")}),a.jsx("p",{children:t("feishu.description")})]})]}),a.jsx("div",{className:"feishu-integration-layout",children:a.jsxs("section",{className:"feishu-section-panel",children:[a.jsx("p",{className:"feishu-panel-description",children:t("feishu.panel")}),a.jsxs("form",{className:"feishu-form",onSubmit:W,onKeyDown:K,noValidate:!0,children:[a.jsxs("div",{className:"feishu-field-grid",children:[a.jsxs("div",{className:"feishu-field",children:[a.jsx("label",{htmlFor:"feishu-agent-name",children:t("feishu.agentName")}),a.jsx("input",{id:"feishu-agent-name",value:n,maxLength:64,disabled:H,onChange:Z=>{i(Z.target.value),g&&b("")},onBlur:()=>b(Hse(n.trim())),"aria-invalid":!!g,"aria-describedby":`feishu-agent-name-help${g?" feishu-agent-name-error":""}`}),a.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:t("feishu.agentNameHelp")}),g?a.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:t(g)}):null]}),a.jsxs("div",{className:"feishu-field",children:[a.jsx("label",{id:"feishu-region-label",children:t("feishu.region")}),a.jsxs("div",{className:"feishu-region-picker",ref:T,children:[a.jsxs("button",{ref:N,type:"button",className:"feishu-region-trigger",disabled:H,"aria-haspopup":"listbox","aria-expanded":h,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{P.current=nf.findIndex(Z=>Z===d),m(Z=>!Z)},onKeyDown:Z=>{Z.key!=="ArrowDown"&&Z.key!=="ArrowUp"||(Z.preventDefault(),P.current=Z.key==="ArrowUp"?nf.length-1:nf.findIndex(ce=>ce===d),m(!0))},children:[a.jsx("span",{id:"feishu-region-value",children:Q}),a.jsx(tYt,{})]}),h?a.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":t("feishu.region"),onKeyDown:Z=>{var Y;const ce=A.current.findIndex(G=>G===document.activeElement);let Ee=null;Z.key==="ArrowDown"?Ee=(ce+1)%nf.length:Z.key==="ArrowUp"?Ee=(ce-1+nf.length)%nf.length:Z.key==="Home"?Ee=0:Z.key==="End"?Ee=nf.length-1:Z.key==="Tab"&&m(!1),Ee!==null&&(Z.preventDefault(),(Y=A.current[Ee])==null||Y.focus())},children:nf.map(Z=>a.jsx("button",{ref:ce=>{const Ee=nf.findIndex(Y=>Y===Z);A.current[Ee]=ce},type:"button",role:"option","aria-selected":d===Z,className:`feishu-region-option${d===Z?" is-selected":""}`,onClick:()=>{var ce;f(Z),m(!1),(ce=N.current)==null||ce.focus()},children:t(`feishu.regions.${Z}`)},Z))}):null]}),a.jsx("span",{className:"feishu-field-help",children:t("feishu.regionHelp")})]}),a.jsxs("div",{className:"feishu-field",children:[a.jsx("label",{htmlFor:"feishu-app-id",children:t("feishu.appId")}),a.jsx("input",{id:"feishu-app-id",value:r,maxLength:128,autoComplete:"off",disabled:H,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:Z=>{s(Z.target.value),v&&y("")},onBlur:()=>y(r.trim()?"":"feishu.validation.appId"),"aria-invalid":!!v,"aria-describedby":`feishu-app-id-help${v?" feishu-app-id-error":""}`}),a.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:t("feishu.appIdHelp")}),v?a.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:t(v)}):null]}),a.jsxs("div",{className:"feishu-field",children:[a.jsx("label",{htmlFor:"feishu-app-secret",children:t("feishu.appSecret")}),a.jsxs("div",{className:"feishu-secret-input",children:[a.jsx("input",{id:"feishu-app-secret",type:c?"text":"password",value:o,maxLength:256,autoComplete:"off",disabled:H,placeholder:t("feishu.appSecretPlaceholder"),onChange:Z=>{l(Z.target.value),x&&w("")},onBlur:()=>w(o.trim()?"":"feishu.validation.appSecret"),"aria-invalid":!!x,"aria-describedby":`feishu-app-secret-help${x?" feishu-app-secret-error":""}`}),a.jsx("button",{type:"button",disabled:H,onClick:()=>u(Z=>!Z),"aria-label":t(c?"feishu.hideSecret":"feishu.showSecret"),children:t(c?"feishu.hide":"feishu.show")})]}),a.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:t("feishu.appSecretHelp")}),x?a.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:t(x)}):null]})]}),O!=="idle"?a.jsxs("div",{className:`feishu-deployment-status is-${O}`,role:O==="failed"?"alert":"status",children:[a.jsxs("div",{className:"feishu-deployment-heading",children:[O==="preparing"?a.jsx(yn,{as:"strong",children:t("feishu.status.preparing")}):null,O==="running"?a.jsx(yn,{as:"strong",children:k?FD(k):t("feishu.status.running")}):null,O==="cancelling"?a.jsx(yn,{as:"strong",children:t("feishu.status.cancelling")}):null,O==="succeeded"?a.jsxs("strong",{children:[a.jsx(Vse,{}),t("feishu.status.succeeded")]}):null,O==="cancelled"?a.jsx("strong",{children:t("feishu.status.cancelled")}):null,O==="failed"?a.jsx("strong",{children:t("feishu.status.failed")}):null]}),O==="preparing"||O==="running"||O==="cancelling"?a.jsx("ol",{className:"feishu-deployment-steps",children:fFe.map((Z,ce)=>{const Ee=O==="running"&&cevoid V(),children:t("feishu.cancelDeployment")}):null,a.jsx("button",{type:"submit",className:"feishu-submit",disabled:!ie,children:t(H?"feishu.creating":"feishu.create")})]})]})]})]})})]})}async function eq(e,t,n,i=Ba){var s;const r=await gn(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},i);if(!r.ok){let o="";try{o=((s=(await r.json()).detail)==null?void 0:s.trim())||""}catch{}throw new Error(o||z("common.requestFailed",{status:r.status}))}return r.json()}function sYt(e){return eq("/web/coding-agents/capabilities",{method:"GET"},e,tU)}function oYt(e,t){return eq(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function aYt(e,t){return eq("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const lYt="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function cYt(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function qse(){return a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[a.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),a.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function Wse(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function uYt(e){return e instanceof DOMException&&e.name==="AbortError"}function dYt(e){return e instanceof Error&&e.message?e.message:""}function fYt(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function hYt(e){const t=e.split("/");return t[t.length-1]??e}function pYt(e){const t=new Map;for(const n of e){const i=n.path.split("/"),r=i.length>1?i.slice(0,-1).join("/"):"";t.set(r,[...t.get(r)??[],n])}return Array.from(t,([n,i])=>({directory:n,files:i})).sort((n,i)=>n.directory?i.directory?n.directory.localeCompare(i.directory):1:-1)}function mYt({skill:e,onClose:t}){const{t:n}=Ae("automations"),i=p.useRef(null),r=p.useRef(null),s=p.useId(),o=p.useId(),[l,c]=p.useState(null),[u,d]=p.useState(""),[f,h]=p.useState(!0),[m,g]=p.useState(""),[b,v]=p.useState(0);p.useEffect(()=>{r.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const O=i.current;return O&&!O.open&&O.showModal(),()=>{var S;O!=null&&O.open&&O.close(),(S=r.current)==null||S.focus()}},[]),p.useEffect(()=>{const O=new AbortController;return h(!0),g(""),c(null),d(""),oYt(e.id,O.signal).then(S=>{if(O.signal.aborted)return;c(S);const k=S.files.find(C=>C.path==="SKILL.md")??S.files[0];d((k==null?void 0:k.path)??"")}).catch(S=>{!O.signal.aborted&&!uYt(S)&&g(dYt(S))}).finally(()=>{O.signal.aborted||h(!1)}),()=>O.abort()},[b,e.id]);const y=p.useMemo(()=>pYt((l==null?void 0:l.files)??[]),[l]),x=(l==null?void 0:l.files.find(O=>O.path===u))??null,w=n(`codingAgents.skills.items.${e.id}.name`,{defaultValue:e.name});return a.jsxs("dialog",{ref:i,className:"coding-agents-preview-dialog","aria-labelledby":s,"aria-describedby":o,onCancel:O=>{O.preventDefault(),t()},onMouseDown:O=>{const S=O.currentTarget.getBoundingClientRect();(O.clientXS.right||O.clientYS.bottom)&&t()},children:[a.jsxs("header",{className:"coding-agents-preview-header",children:[a.jsx("span",{className:"coding-agents-preview-mark",children:a.jsx(Wse,{})}),a.jsxs("div",{children:[a.jsx("h2",{id:s,children:w}),a.jsx("p",{id:o,children:n("codingAgents.preview.description")})]}),a.jsx("button",{type:"button",autoFocus:!0,"aria-label":n("codingAgents.preview.close"),onClick:t,children:a.jsx(cYt,{})})]}),f?a.jsxs("div",{className:"coding-agents-preview-state",children:[a.jsx("i",{}),n("codingAgents.preview.loading")]}):m?a.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[a.jsx("span",{children:m||n("codingAgents.preview.error")}),a.jsx("button",{type:"button",onClick:()=>v(O=>O+1),children:n("codingAgents.retry")})]}):a.jsxs("div",{className:"coding-agents-preview-layout",children:[a.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":n("codingAgents.preview.skillFiles",{name:w}),children:[a.jsxs("div",{className:"coding-agents-preview-tree-title",children:[a.jsx("span",{children:n("codingAgents.preview.files")}),a.jsx("small",{children:(l==null?void 0:l.files.length)??0})]}),a.jsx("div",{className:"coding-agents-preview-tree-scroll",children:y.map(O=>O.directory?a.jsxs("details",{open:!0,children:[a.jsxs("summary",{children:[a.jsx(Wse,{}),a.jsx("span",{children:O.directory})]}),a.jsx("div",{children:O.files.map(S=>a.jsxs("button",{type:"button",className:u===S.path?"is-selected":"","aria-current":u===S.path?"true":void 0,onClick:()=>d(S.path),children:[a.jsx(qse,{}),a.jsx("span",{children:hYt(S.path)})]},S.path))})]},O.directory):O.files.map(S=>a.jsxs("button",{type:"button",className:u===S.path?"is-selected":"","aria-current":u===S.path?"true":void 0,onClick:()=>d(S.path),children:[a.jsx(qse,{}),a.jsx("span",{children:S.path})]},S.path)))})]}),a.jsx("section",{className:"coding-agents-preview-file","aria-label":n("codingAgents.preview.fileContent"),children:x?a.jsxs(a.Fragment,{children:[a.jsxs("header",{children:[a.jsx("strong",{children:x.path}),a.jsx("span",{children:fYt(x.size)})]}),x.previewable&&x.content!==null?a.jsx("pre",{tabIndex:0,children:a.jsx("code",{children:x.content})}):a.jsx("div",{className:"coding-agents-preview-unavailable",children:n("codingAgents.preview.notPreviewable")})]}):a.jsx("div",{className:"coding-agents-preview-unavailable",children:n("codingAgents.preview.noFiles")})})]})]})}function gYt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function bYt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function yYt(e){return a.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:a.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[a.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),a.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),a.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),a.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),a.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),a.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function vYt(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kse(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function xYt(e){return a.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[a.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),a.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function wYt({agentId:e}){return e==="trae"?a.jsx("img",{src:lYt,alt:"","aria-hidden":"true"}):e==="claude-code"?a.jsx(yYt,{}):a.jsx(vYt,{})}function Gse(e){return e instanceof DOMException&&e.name==="AbortError"}function Xse(e,t){return e instanceof Error&&e.message?e.message:t}function OYt({onBack:e}){var j;const{t}=Ae("automations"),[n,i]=p.useState(null),[r,s]=p.useState(!0),[o,l]=p.useState(null),[c,u]=p.useState(0),[d,f]=p.useState(new Set),[h,m]=p.useState(new Set),[g,b]=p.useState(null),[v,y]=p.useState(!1),[x,w]=p.useState(null),O=p.useRef(null);p.useEffect(()=>{const T=new AbortController;return s(!0),l(null),sYt(T.signal).then(N=>{if(T.signal.aborted)return;i(N);const A=N.agents.filter(P=>P.available);f(P=>{const D=A.filter(M=>P.has(M.id));return new Set((D.length?D:A.slice(0,1)).map(M=>M.id))}),m(P=>{const D=N.skills.filter(M=>P.has(M.id));return new Set((D.length?D:N.skills).map(M=>M.id))})}).catch(N=>{!Gse(N)&&!T.signal.aborted&&(i(null),l(Xse(N,"")))}).finally(()=>{T.signal.aborted||s(!1)}),()=>T.abort()},[c]),p.useEffect(()=>()=>{var T;return(T=O.current)==null?void 0:T.abort()},[]);const S=p.useMemo(()=>(n==null?void 0:n.agents.filter(T=>T.available&&d.has(T.id)))||[],[n,d]),k=p.useMemo(()=>(n==null?void 0:n.skills.filter(T=>h.has(T.id)))||[],[n,h]),C=!!(!v&&S.length&&k.length),E=(T,N)=>{!N||v||(w(null),f(A=>{const P=new Set(A);return P.has(T)?P.delete(T):P.add(T),P}))},R=T=>{v||(w(null),m(N=>{const A=new Set(N);return A.has(T)?A.delete(T):A.add(T),A}))},_=async()=>{var N;if(!C)return;(N=O.current)==null||N.abort();const T=new AbortController;O.current=T,y(!0),w(null);try{const A=await aYt({agents:S.map(D=>D.id),skills:k.map(D=>D.id)},T.signal);if(T.signal.aborted)return;const P=A.installations;w({tone:"success",agentCount:S.length,skillCount:k.length,installations:P})}catch(A){!Gse(A)&&!T.signal.aborted&&w({tone:"error",message:Xse(A,"")})}finally{O.current===T&&(O.current=null),T.signal.aborted||y(!1)}};return a.jsxs("section",{className:"coding-agents-page",children:[a.jsxs("header",{className:"coding-agents-header",children:[a.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:v,"aria-label":t("backToAutomations"),children:a.jsx(gYt,{})}),a.jsx(bYt,{className:"coding-agents-logo"}),a.jsxs("div",{children:[a.jsx("h1",{children:t("codingAgents.title")}),a.jsx("p",{children:t("codingAgents.description")})]})]}),a.jsx("div",{className:"coding-agents-scroll",children:a.jsxs("div",{className:"coding-agents-content",children:[a.jsxs("section",{className:"coding-agents-section","aria-label":t("codingAgents.clients.ariaLabel"),children:[a.jsxs("div",{className:"coding-agents-section-heading",children:[a.jsxs("div",{children:[a.jsx("span",{children:"1"}),a.jsx("h2",{children:t("codingAgents.clients.title")})]}),a.jsx("button",{type:"button",onClick:()=>u(T=>T+1),disabled:r||v,children:t("codingAgents.clients.detectAgain")})]}),r?a.jsxs("div",{className:"coding-agents-inline-state",children:[a.jsx("i",{}),t("codingAgents.clients.detecting")]}):o!==null?a.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[a.jsx("span",{children:o||t("codingAgents.errors.detect")}),a.jsx("button",{type:"button",onClick:()=>u(T=>T+1),children:t("codingAgents.retry")})]}):a.jsx("div",{className:"coding-agents-agent-grid",children:n==null?void 0:n.agents.map(T=>a.jsxs("button",{type:"button",className:`coding-agents-agent ${d.has(T.id)?"is-selected":""}`,"aria-pressed":d.has(T.id),disabled:!T.available||v,onClick:()=>E(T.id,T.available),title:T.available?T.name:T.reason,children:[a.jsx("span",{className:`coding-agents-agent-mark is-${T.id}`,children:a.jsx(wYt,{agentId:T.id})}),a.jsxs("span",{className:"coding-agents-agent-copy",children:[a.jsx("strong",{children:T.name}),a.jsx("small",{children:T.available?T.version||t("codingAgents.clients.detected"):T.reason})]}),a.jsx("span",{className:`coding-agents-status ${T.available?"is-ready":""}`,children:T.available?t("codingAgents.clients.available"):t("codingAgents.clients.unavailable")}),a.jsx("span",{className:"coding-agents-check",children:a.jsx(Kse,{})})]},T.id))})]}),a.jsxs("section",{className:"coding-agents-section","aria-label":t("codingAgents.skills.ariaLabel"),children:[a.jsx("div",{className:"coding-agents-section-heading",children:a.jsxs("div",{children:[a.jsx("span",{children:"2"}),a.jsx("h2",{children:t("codingAgents.skills.title")})]})}),a.jsx("div",{className:"coding-agents-skill-list",children:n==null?void 0:n.skills.map(T=>a.jsxs("div",{className:`coding-agents-skill ${h.has(T.id)?"is-selected":""}`,children:[a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:h.has(T.id),onChange:()=>R(T.id),disabled:v}),a.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:a.jsx(Kse,{})}),a.jsxs("span",{children:[a.jsx("strong",{children:t(`codingAgents.skills.items.${T.id}.name`,{defaultValue:T.name})}),a.jsx("small",{children:t(`codingAgents.skills.items.${T.id}.description`,{defaultValue:T.description})})]})]}),a.jsx("button",{type:"button",onClick:()=>b(T),children:t("codingAgents.skills.viewFiles")})]},T.id))}),a.jsxs("div",{className:"coding-agents-global","aria-label":t("codingAgents.global.ariaLabel"),children:[a.jsxs("div",{className:"coding-agents-global-heading",children:[a.jsx(xYt,{}),a.jsxs("div",{children:[a.jsx("strong",{children:t("codingAgents.global.title")}),a.jsx("span",{children:t("codingAgents.global.description")})]})]}),S.length?a.jsx("dl",{children:S.map(T=>a.jsxs("div",{children:[a.jsx("dt",{children:T.name}),a.jsx("dd",{children:T.globalSkillsPath})]},T.id))}):a.jsx("p",{children:t("codingAgents.global.empty")})]})]}),x?a.jsxs("div",{className:`coding-agents-result is-${x.tone}`,role:x.tone==="error"?"alert":"status",children:[a.jsx("strong",{children:x.tone==="success"?t("codingAgents.success",{agentCount:x.agentCount,skillCount:x.skillCount}):x.message||t("codingAgents.errors.configure")}),(j=x.installations)!=null&&j.length?a.jsx("ul",{children:x.installations.map(T=>a.jsxs("li",{children:[T.agentName," · ",t(`codingAgents.skills.items.${T.skillId}.name`,{defaultValue:T.skill})," → ",T.displayPath]},`${T.agent}:${T.skillId}`))}):null]}):null,a.jsxs("div",{className:"coding-agents-actions",children:[a.jsx("span",{children:S.length?t("codingAgents.selection",{agentCount:S.length,skillCount:k.length}):t("codingAgents.selectClient")}),a.jsx("button",{type:"button",onClick:()=>void _(),disabled:!C,children:t(v?"codingAgents.configuring":"codingAgents.configure")})]})]})}),g?a.jsx(mYt,{skill:g,onClose:()=>b(null)}):null]})}async function tq(e,t){const n=await e.json().catch(()=>null),i=typeof(n==null?void 0:n.detail)=="string"?n.detail:"";return new Error(i||z("common.fallbackWithHttpStatus",{fallback:t,status:e.status}))}async function kYt(e){const t=await gn("/web/website-integrations",{cache:"no-store",signal:e});if(!t.ok)throw await tq(t,z("websiteIntegration.listFailed"));return(await t.json()).integrations??[]}async function SYt(e){const t=await gn("/web/website-integrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await tq(t,z("websiteIntegration.createFailed"));return t.json()}async function EYt(e){const t=await gn(`/web/website-integrations/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await tq(t,z("websiteIntegration.deleteFailed"))}function CYt(e){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:a.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Yse(e){return a.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[a.jsx("rect",{x:"3.5",y:"5",width:"20",height:"17",rx:"3.5",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M4.5 10h18M8.5 7.5h.1M11.5 7.5h.1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M17 18.5a5 5 0 0 1 5-5h1.5a5 5 0 0 1 5 5V23a5 5 0 0 1-5 5H22l-3.5 2.5v-3.3A5 5 0 0 1 17 23v-4.5Z",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),a.jsx("path",{d:"M21 19h4M21 22.5h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function TYt(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(t,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}async function AYt(e){const t=[];let n="";for(let i=0;i<10;i+=1){const r=await Fw({nextToken:n||void 0,pageSize:100,region:"all",scope:"all"});if(e.aborted)return[];if(t.push(...r.runtimes),n=r.nextToken,!n)break}return t}function _Yt({onBack:e}){const{t,i18n:n}=Ae("websiteIntegration"),[i,r]=p.useState([]),[s,o]=p.useState([]),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(""),[m,g]=p.useState(!0),[b,v]=p.useState(!1),[y,x]=p.useState(""),[w,O]=p.useState("");p.useEffect(()=>{const j=new AbortController;return g(!0),O(""),Promise.all([kYt(j.signal),AYt(j.signal)]).then(([T,N])=>{var P;if(j.signal.aborted)return;r(T),o(N),d(((P=T[0])==null?void 0:P.id)??"");const A=N[0];A&&c(`${A.region}::${A.runtimeId}`)}).catch(T=>{j.signal.aborted||O(T instanceof Error?T.message:t("errors.load"))}).finally(()=>{j.signal.aborted||g(!1)}),()=>j.abort()},[t]);const S=p.useMemo(()=>s.map(j=>({value:`${j.region}::${j.runtimeId}`,label:j.name||j.runtimeId,description:`${j.region} · ${j.status}`,runtime:j})),[s]),k=p.useMemo(()=>new Map(S.map(j=>[j.value,j.runtime])),[S]),C=i.find(j=>j.id===u)??i[0],E=C?` + diff --git a/veadk/webui/website-integration.js b/veadk/webui/website-integration.js index 665f11a68..89b145968 100644 --- a/veadk/webui/website-integration.js +++ b/veadk/webui/website-integration.js @@ -52,7 +52,7 @@ Error generating stack: `+n.message+` Raw response: {{response}}`,errorWithRawResponse:`{{context}} Raw response: -{{response}}`,loadArkApiKeysFailed:"Failed to load Ark API keys",loadModelsFailed:"Failed to load models",runtimeAccessDenied:"This account cannot access the Runtime. Refresh the list or sign in again.",privateRuntimeUnavailable:"The Runtime was deployed, but this Studio cannot access the private Runtime. Use a Studio connected to the same VPC, or deploy with public or public plus VPC access.",runtimeTemporarilyUnavailable:"The Runtime was deployed, but Studio cannot connect yet. The gateway domain may still be propagating, or the current network or DNS cannot reach it. Try connecting again later from Manage Agents.",runtimeConnectionUnsupported:"The Runtime Agent Server does not provide a connection endpoint. Confirm that the Runtime is ready and compatible.",runtimeConnectionDenied:"The Runtime rejected the connection request. Check its authentication configuration.",listAgentsFailed:"Failed to load Agents",invalidListAppsJson:"Runtime /list-apps returned unreadable JSON.",invalidListAppsFormat:"Runtime /list-apps returned an invalid format; expected a non-empty string array.",createSessionFailedWithStatus:"Failed to create session ({{status}})",createSessionFailed:"Failed to create session",getSessionFailed:"Failed to load session",getSessionFailedWithDetail:"Failed to load session ({{status}}): {{detail}}",feedbackRuntimeOnly:"Feedback sync is supported only for sessions connected to an AgentKit Runtime",feedbackRegionMissing:"The Runtime region is missing, so feedback cannot be submitted",submitFeedbackFailed:"Failed to submit feedback",loadEvaluationSetsFailed:"Failed to load evaluation sets",loadAutoEvaluationStatusFailed:"Failed to load automatic evaluation status",loadOptimizationsFailed:"Failed to load optimization suggestions",deleteEvaluationCaseFailed:"Failed to delete the evaluation case",downloadFileFailed:"Failed to download the file",fileUnavailable:"File content is unavailable",uploadFileFailed:"File upload failed",traceDisabled:"Tracing is not enabled for this Agent. Enable it in the console first.",loadTraceFailed:"Failed to load trace data",contentTypeMissing:"Content-Type missing",traceNonJson:"Trace failed: the server returned a non-JSON response ({{contentType}}). Check the Studio API proxy configuration",invalidTraceFormat:"Trace failed: invalid response format",submitIssueFeedbackFailed:"Failed to submit issue feedback",issueFeedbackNotConfirmed:"Failed to submit issue feedback: the server did not confirm the submission",noPreviewableAgent:"This Runtime does not provide an Agent that can be previewed.",agentSearchFailed:"Agent search failed",emptySseBody:"HTTP 200 with an empty SSE response body.",noDisplayableSseReply:"HTTP 200, but the SSE response did not contain a displayable model reply.",firstSseEventTimeout:"No SSE event was received within 60 seconds. Try again later, and review the Runtime, model, or gateway logs.",runSessionFailed:"Session run failed",runSseFailedWithDetail:"run_sse failed ({{status}}): {{detail}}",checkRuntimeNameFailed:"Failed to check the Runtime name",invalidRuntimeNameCheck:"Failed to check the Runtime name: invalid response format",loadCloudResourcesFailed:"Failed to load cloud resources",invalidCloudResources:"The cloud resource list response has an invalid format",invalidEnvironmentMount:"The environment mount response has an invalid format",environmentMountMismatch:"The environment mount response does not match the request",environmentMountNetworkFailed:"Unable to connect to Studio, so the environment was not mounted. Check your network and try again.",environmentMountFailed:"Failed to mount the environment",clipboardUnsupported:"This browser does not support writing to the clipboard.",clipboardWriteFailed:"Unable to write to the clipboard. Check clipboard permissions.",loadSystemInfoFailed:"Failed to load system information",invalidSystemInfo:"The system information response has an invalid format",invalidEnvironmentBuild:"The environment build response has an invalid format",invalidEnvironmentBuildStep:"The environment build step response has an invalid format",invalidEnvironmentManifest:"The environment manifest response has an invalid format",invalidImageRepository:"The environment image repository response has an invalid format",invalidCodeRepository:"The environment code repository response has an invalid format",invalidImageSource:"The environment image source response has an invalid format",invalidEnvironment:"The environment response has an invalid format",invalidWorkspace:"The workspace response has an invalid format",loadWorkspacesFailed:"Failed to load workspaces",invalidWorkspaceList:"The workspace list response has an invalid format",saveWorkspaceFailed:"Failed to save the workspace",deleteWorkspaceFailed:"Failed to delete the workspace",loadEnvironmentsFailed:"Failed to load environments",invalidEnvironmentList:"The environment list response has an invalid format",probeRepositoryFailed:"Failed to inspect the code repository",invalidRepositoryProbe:"The code repository inspection response has an invalid format",exportEnvironmentCodeFailed:"Failed to export the environment share code",invalidEnvironmentCode:"The environment share code response has an invalid format",inspectEnvironmentCodeFailed:"Failed to inspect the environment share code",invalidEnvironmentCodeInspection:"The environment share code inspection response has an invalid format",importEnvironmentCodeFailed:"Failed to import the environment share code",invalidEnvironmentCodeImport:"The environment share code import response has an invalid format",studioUnavailable:"Unable to connect to Studio. Confirm that the backend is running and try again.",saveEnvironmentFailed:"Failed to save the environment",deleteEnvironmentFailed:"Failed to delete the environment",startEnvironmentBuildFailed:"Failed to start the environment build",loadEnvironmentBuildFailed:"Failed to load environment build details",loadEnvironmentManifestFailed:"Failed to load the environment manifest",invalidEnvironmentResource:"The environment resource response has an invalid format",loadEnvironmentResourcesFailed:"Failed to load environment build resources",updateCodexSandboxFailed:"Failed to update Codex Sandbox",invalidCodexSandboxUpdate:"The Codex Sandbox update response has an invalid format",loadUserPoolsFailed:"Failed to load user pools",invalidUserPoolList:"The user pool list response has an invalid format",syncGithubFailed:"Failed to sync GitHub code ({{status}})",validatingMigrationArtifact:"Validating migration artifact",uploadingCodePackage:"Uploading code package",migrationArtifactValidated:"Migration artifact validated",codePackageUploaded:"Code package uploaded",deploymentProgress:{preparing:"Preparing deployment",uploading:"Uploading the code package",building:"Building the image",buildLogsSyncing:"Building the image. Build logs are up to date.",buildLogsComplete:"Build log sync complete.",buildFailedLogsSynced:"Image build failed. Final build logs are available.",buildLogsUnavailable:"Build logs are temporarily unavailable.",finalBuildLogsUnavailable:"Final build logs are temporarily unavailable.",deploying:"Deploying the service",publishing:"Publishing the service",evaluating:"Creating evaluation sets",updating:"Updating the Runtime configuration",completing:"Finalizing deployment",github:"Configuring GitHub delivery",inProgress:"Deployment in progress"},deploymentFailed:"Deployment failed",deploymentDisconnected:"Deployment failed: connection interrupted",deploymentMissingAgentName:"Deployment failed: Agent name missing from response",deploymentMissingConnection:"Deployment failed: AgentKit connection information missing from response",cancelDeploymentFailed:"Failed to cancel deployment ({{status}})",loadFailed:"Failed to load ({{status}})",loadPermissionsFailed:"Failed to load permissions ({{status}})",invalidPermissionResponse:"The permission service returned an unreadable response",checkStudioUpdateFailed:"Failed to check for Studio updates ({{status}})",studioUpdatePreflightFailed:"Studio update permission check failed ({{status}})",submitStudioUpdateFailed:"Failed to submit the Studio update ({{status}})",loadAgentUsageFailed:"Failed to load Agent usage",notProvided:"Not provided",agentUsageNonJson:"Failed to load Agent usage: the server returned a non-JSON response (HTTP {{status}}, Content-Type: {{contentType}}). ",checkStudioGateway:"Confirm that the current service is running in Studio mode and check the proxy or gateway configuration.",agentUsageInvalidJson:"Failed to load Agent usage: the server returned invalid JSON (HTTP {{status}}, Content-Type: {{contentType}}). ",retryCheckGateway:"Try again later. If the problem persists, check the proxy or gateway configuration.",loadCronJobsFailed:"Failed to load scheduled tasks",loadCronJobFailed:"Failed to load scheduled task details",createCronJobFailed:"Failed to create the scheduled task",updateCronJobFailed:"Failed to update the scheduled task",enableCronJobFailed:"Failed to enable the scheduled task",pauseCronJobFailed:"Failed to pause the scheduled task",runCronJobFailed:"Failed to run the scheduled task now",loadCronHistoryFailed:"Failed to load execution history",stopCronRunFailed:"Failed to stop the execution",deleteCronJobFailed:"Failed to delete the scheduled task",loadRuntimeFailed:"Failed to load the Runtime",loadLocalToolsFailed:"Failed to load local tools",connectDynamicRouteFailed:"Failed to connect the Studio dynamic route",a2aProbeDenied:"The Runtime rejected the A2A probe. Check the Runtime authentication configuration.",loadA2aCardFailed:"Failed to load the A2A Agent Card",loadRuntimeApiKeyFailed:"Failed to load the Runtime API key",runtimeApiKeyMissing:"The Runtime did not return a usable API key",loadMcpCredentialsFailed:"Failed to load MCP authentication",invalidMcpCredentials:"Studio returned invalid MCP authentication data",deleteFailed:"Delete failed ({{status}})",runtimeManageForbidden:"This account cannot manage the Runtime.",runtimeNotFound:"The Runtime does not exist or has been deleted.",runtimeUnavailable:"This account cannot access the Runtime.",checkRuntimeUpdateFailed:"Failed to check Runtime update capability (HTTP {{status}}). Try again later.",loadRuntimeDetailFailed:"Failed to load Runtime details",generateProjectFailed:"Failed to generate the project",generateAgentConfigFailed:"Failed to generate the Agent configuration",createDebugRunFailed:"Failed to create the debug run",createDebugSessionFailed:"Failed to create the debug session",loadDebugTraceFailed:"Failed to load the debug trace",invalidDebugTrace:"Failed to load the debug trace: invalid response format",debugRunFailed:"Debug run failed",cleanupDebugRunFailed:"Failed to clean up the debug run"},j8e={loadFailed:"Failed to load conversation mode capabilities (HTTP {{status}})",invalidResponse:"The conversation mode capabilities response has an invalid format"},X8e={nonJson:"{{fallback}}: the server returned a non-JSON response (HTTP {{status}}, {{contentType}}){{detail}}"},K8e={busy:"The workspace is busy. Try again shortly",notFound:"Workspace not found",duplicates:"Multiple personal workspace sessions were found. Contact your administrator",timeout:"Workspace recovery timed out. Your projects are retained. Try again",unavailable:"The workspace cannot be restored right now. Your projects are retained. Try again",persistence:"Persistence is not enabled for this Sandbox. Check the workspace configuration",startup:"Workspace startup failed. Check the Sandbox status",exists:"This project already exists. Open it from the project list",directory:"Project directory not found",configuration:"Configure the workspace Sandbox image first",state:"Could not check workspace status. Try again",list:"Could not restore the workspace or load projects. Try again",create:"Project initialization failed. Check that the image is available and try again",open:"Could not restore the workspace or open the project. Try again",connection:"Could not connect to the workspace. Try again",invalidWorkspaceUrl:"The workspace returned an invalid URL",operation:"Project operation failed. Try again",invalidProjectUrl:"The project URL is invalid",listFallback:"Could not load projects",connectionState:"Could not connect to the workspace. Try again"},Z8e={reporting:"Completing delivery details",packaging:"Preparing artifacts",savingVersion:"Saving version",finishing:"Finishing request",submitResult:"Submit build result",requestFailed:"Task request failed. Please retry.",invalidResponse:"Invalid task state response.",eventGap:"Restoring missing task output.",reconnecting:"Reconnecting. Existing output is preserved.",input:{pending:"Queued",sending:"Confirming delivery",delivered:"Delivered",withdrawn:"Not sent"},plan:"Execution plan",diff:"File changes",preparing:"Preparing task",preparingEnvironment:"Preparing development environment…",connectingEnvironment:"Connecting to development environment…",processing:"Processing request",thinking:"Thinking",read:"Read file · {{target}}",listFiles:"List directory · {{target}}",search:"Search · {{target}}",command:"Run command · {{target}}",editFiles:"Edit files · {{target}}",webSearch:"Search web · {{target}}",processSummary:"Processed {{count}} items",duration:"{{seconds}}s",durationUnits:{milliseconds:"{{value}} ms",hours:"{{value}} h",minutes:"{{value}} min",seconds:"{{value}} s"},failedTools:"{{count}} tools failed",toolFailed:"Failed",toolCalls:"{{count}} tool calls",turnDuration:"Turn elapsed {{duration}}",toolDuration:"Tool time {{duration}}",toolDurationPartial:"Recorded tool time {{duration}}",toolDurationHelp:"Sum of tool durations. Parallel calls can exceed turn elapsed time.",turnStatus:{completed:"Completed",failed:"Failed",interrupted:"Interrupted",cancelled:"Interrupted",unavailable:"Task ended"},notReported:"Not reported",partial:"Recorded",partialHelp:"Usage for this turn may be incomplete.",tokenDetails:"Turn token usage",model:"Turn model",totalTokens:"Total",inputTokens:"Input",cachedInputTokens:"Cached input",uncachedInputTokens:"Uncached input",cacheWriteInputTokens:"Cache write",outputTokens:"Output",reasoningOutputTokens:"Reasoning output",cacheHitRate:"Input cache hit rate",tokenHelp:"Cached input and reasoning output are subsets of input and output. Uncached input = input − cached input."},J8e={common:_8e,agentkitCli:R8e,cloudRegion:D8e,connections:L8e,feishuBot:M8e,requestError:I8e,runSse:P8e,runtimeLogs:N8e,search:B8e,skills:$8e,sse:F8e,identity:z8e,github:U8e,video:V8e,websiteIntegration:Q8e,knowledge:G8e,intelligentDevelopment:H8e,migrations:W8e,sandbox:Y8e,client:q8e,newChatCapabilities:j8e,jsonResponse:X8e,workspaceProjects:K8e,developmentRuns:Z8e},Ycr=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:R8e,client:q8e,cloudRegion:D8e,common:_8e,connections:L8e,default:J8e,developmentRuns:Z8e,feishuBot:M8e,github:U8e,identity:z8e,intelligentDevelopment:H8e,jsonResponse:X8e,knowledge:G8e,migrations:W8e,newChatCapabilities:j8e,requestError:I8e,runSse:P8e,runtimeLogs:N8e,sandbox:Y8e,search:B8e,skills:$8e,sse:F8e,video:V8e,websiteIntegration:Q8e,workspaceProjects:K8e},Symbol.toStringTag,{value:"Module"})),eBe="Agent reviews",tBe="Request access for everyone in your organization",rBe="Close",nBe="Refresh",iBe="Status",aBe="Applicant",oBe="Submitted",sBe="Current version",lBe="Model",cBe="Returned by",uBe="Approved by",hBe="Reviewed",dBe="Agent description",fBe="Application notes",pBe="Return reason",gBe="Review comment",mBe="Return reason (required)",vBe="Content changed after submission; return and submit again",yBe="Withdraw to edit this Agent, then submit a new request to publish it",bBe="Other users will lose access to this Agent. Unpublish it?",xBe="Cancel",wBe="Confirm",ABe="Saving",SBe="Unpublish",TBe="Withdraw request",CBe="Approve",OBe="Publish for everyone",kBe="Request publication",EBe="Everyone",_Be={pending:"Pending",approved:"Approved",returned:"Returned",withdrawn:"Withdrawn"},RBe="Search agents or applicants",DBe="Region",LBe="All statuses",MBe="Agent",IBe="Actions",PBe="Review application",NBe="Application details",BBe="No matching applications",$Be="No Agent review requests",FBe="{{count}} / {{limit}} characters",qcr=Object.freeze(Object.defineProperty({__proto__:null,actions:IBe,agent:MBe,all:LBe,approve:CBe,approvedBy:uBe,cancel:xBe,close:rBe,comment:gBe,confirm:wBe,contentChanged:vBe,default:{title:eBe,dialogDescription:tBe,close:rBe,refresh:nBe,statusTitle:iBe,submitter:aBe,submittedAt:oBe,version:sBe,model:lBe,returnedBy:cBe,approvedBy:uBe,reviewedAt:hBe,description:dBe,message:fBe,reason:pBe,comment:gBe,reasonRequired:mBe,contentChanged:vBe,withdrawConfirm:yBe,unpublishConfirm:bBe,cancel:xBe,confirm:wBe,saving:ABe,unpublish:SBe,withdraw:TBe,return:"Return",approve:CBe,publish:OBe,submit:kBe,private:"Private",enterprise:EBe,status:_Be,search:RBe,region:DBe,all:LBe,agent:MBe,actions:IBe,review:PBe,details:NBe,noMatches:BBe,empty:$Be,textCount:FBe},description:dBe,details:NBe,dialogDescription:tBe,empty:$Be,enterprise:EBe,message:fBe,model:lBe,noMatches:BBe,publish:OBe,reason:pBe,reasonRequired:mBe,refresh:nBe,region:DBe,returnedBy:cBe,review:PBe,reviewedAt:hBe,saving:ABe,search:RBe,status:_Be,statusTitle:iBe,submit:kBe,submittedAt:oBe,submitter:aBe,textCount:FBe,title:eBe,unpublish:SBe,unpublishConfirm:bBe,version:sBe,withdraw:TBe,withdrawConfirm:yBe},Symbol.toStringTag,{value:"Module"})),zBe={backToEvaluationCase:"Back to evaluation case",cancel:"Cancel",copied:"Copied",copy:"Copy",exportConversation:"Export conversation",retry:"Retry"},UBe={title:"How would you like to add an Agent?",subtitle:"Choose the approach that best fits your project.",quickCreate:{title:"Create from scratch",description:"Build an Agent with intelligent, custom, template, or workflow modes."},intelligent:{title:"Intelligent mode",description:"Describe your goal, then build, debug, and validate the Agent interactively."},package:{title:"Add and deploy a code package",description:"Upload an Agent project archive, review the code, and deploy it to AgentKit Runtime."},migrate:{title:"Migrate an existing project",description:"Migrate an existing LangChain, Dify, or similar project to AgentKit Runtime."}},VBe={subject:{file:"file changes",command:"command execution"},decision:{accept:"Allowed {{subject}} once",acceptForSession:"Allowed {{subject}} for this session",decline:"Declined {{subject}}",cancel:"Cancelled approval for {{subject}}"},details:{command:"Command",grantRoot:"Authorized path",cwd:"Working directory"}},QBe={noDescription:"No description",region:"Region",unknownAgent:"Unknown Agent"},GBe={agentTransfer:"Agent handoff",annotationHint:"Model response; select text to add an annotation",continueBranch:"Continue with “{{branch}}”",emptyResponse:"This response has no displayable content.",subagentDescription:"Working on a task handed off by the primary Agent."},HBe={title:"Configure {{provider}} credentials",prefix:"Agent Workspace requires {{provider}} credentials. Set",and:"and",suffix:"in the runtime environment, then retry."},WBe={buildRunning:{title:"A build is still running",description:"Leaving will stop this build. The session will remain available in your history.",confirm:"Stop and leave"},deleteThread:{title:"Delete Codex session",description:"Delete “{{name}}” and remove it from your session history?",confirm:"Delete"},returnToCreate:{title:"Return to the create page?",description:"Your current entries will be lost.",confirm:"Return"}},YBe={additionalAgentDeleteFailures:"; {{count}} more failed",agentDeleteFailures:"Failed to delete {{count}} Agents: {{failures}}{{suffix}}",agentToolsMissing:"This Agent is missing required tools: {{tools}}",buildStopUnconfirmed:"You left the development environment, but Studio could not confirm that the build stopped. It may still be running; check its status in session history later.",builtinAgentSendFailed:"Failed to send to the built-in Agent: {{message}}",bytePlusEvaluationUnsupported:"AgentKit evaluation sets are not currently supported on BytePlus",clipboardUnsupported:"This browser does not support writing to the clipboard.",cloudCodexEmptyReply:"The cloud Codex task ended without a response. Send the task again.",cloudCodexSessionMissing:"The cloud Codex session has not appeared in the list yet. Try again shortly.",deploymentRuntimeIdMissing:"Deployment completed without returning a Runtime ID.",environmentExpired:"The selected environment is no longer available. Refresh and select it again.",environmentsLoadFailed:"Failed to load environments",evaluationCaseSessionMissing:"This evaluation case has no session reference and cannot be opened.",evaluationUnsupportedForReply:"This response cannot be added to an evaluation set",firstFrameRequired:"Add a first-frame image before generating from first and last frames.",incompletePromptOptimization:"The prompt optimization result is incomplete. Run the optimization again.",intelligentCapabilityCheckFailed:"Failed to check intelligent development capabilities (HTTP {{status}})",intelligentSessionCreateFailed:"Failed to create the intelligent development session",invalidIntelligentCapability:"The intelligent development capability response is invalid.",localBffToolsNotConfigured:"No tools are configured for the local Studio BFF.",localToolsLoadFailed:"Failed to load local tools",loginPopupBlocked:"The browser blocked the sign-in window. Allow pop-ups and try again.",loginPopupClosed:"The sign-in window was closed. Sign in again to continue.",mediaTooLarge:"{{fileName}} exceeds this platform's media size limit.",mountEnvironmentFailed:"Failed to mount the environment",noConnectedSandbox:"No Sandbox is currently connected.",noCreateAgentPermission:"Your account does not have permission to add Agents.",noManageAgentPermission:"Your account does not have permission to manage Agents.",noOptimizationBaseline:"There is no pre-optimization version available for comparison.",oauthUrlMissing:"The event does not include an authorization URL.",onlyCloudAgentUpdatable:"Only deployed cloud Agents can be updated.",optimizationVersionMissing:"The project version for this optimization could not be found. It may have been deleted.",persistentStorageNotConfigured:"Persistent storage has not been configured by an administrator",readDraftFailed:"Unable to read local drafts. Try again.",runtimeAgentNameMissing:"The Runtime is missing an Agent name and cannot be updated.",runtimeBffToolsDisabled:"BFF tool capabilities are not enabled for this Runtime Agent.",runtimeDeploymentConfigUnavailable:"The Runtime's original deployment configuration cannot be restored, so it cannot be updated safely.",runtimeMissingForConnection:"Runtime information is missing, so the Agent cannot be connected.",runtimeRegionMissingForDelete:"The Runtime is missing region information and cannot be deleted.",runtimeRegionMissingForUpdate:"The Runtime is missing region information and cannot be updated.",runtimeUpdateUnsupported:"This Runtime does not support in-place updates.",sandboxRuntimeUnavailable:"This Agent does not have an available Sandbox Runtime.",sandboxToolsUnavailable:"The current Studio BFF does not provide Sandbox execution tools.",saveDraftLocationRejected:"The browser could not save the current draft location. Check site storage permissions and try again.",saveDraftRejected:"The browser could not save the draft. Try again.",selectSkillToOptimize:"Select a Skill to optimize first.",sessionMissingForMount:"The current session does not exist, so an environment cannot be mounted.",sessionNotReady:"The session is not ready yet.",sessionUnavailable:"The current session is unavailable. Close it and try again.",sourceNotReady:"The source is not ready yet. Return to the conversation to continue.",textVideoRejectsReferences:"Text-to-video does not use reference media. Remove the images or videos first.",videoEditRequiresVideo:"Add the video you want to edit first.",videoExtendRequiresVideo:"Add a source video before extending it.",videoGenerationFailed:"Video generation failed. Try again later.",videoModeUnsupported:"The selected video mode is not supported on this platform.",videoPreviewMissing:"The video task completed, but the server did not return a preview URL.",videoReferenceRequired:"Add at least one reference image or video."},qBe={like:"Like",removeLike:"Remove like",dislike:"Dislike",removeDislike:"Remove dislike",reportIssue:"Report an issue",traceFlameGraph:"Tracing flame graph"},jBe={0:"What would you like to work on today?",1:"How can I help?",2:"What would you like me to look into?",3:"Ask me anything",4:"Hi, let's get started",5:"Start a new conversation",6:"What should we tackle first?",7:"Tell me what you have in mind",8:"Where should we begin?",9:"What can I help you with?",10:"Ready to move this forward?",11:"What's most important right now?",12:"Let's get something done today",13:"I'm ready when you are",intelligentDevelopment:"Give your ideas room to grow"},XBe={agentCapabilities:"Checking Agent capabilities…",session:"Loading session…"},KBe={cancelled:"Authorization was cancelled.",pasteCallbackUrl:"After authorization, paste the full callback URL from your browser's address bar:",popupBlocked:"The browser blocked the authorization window. Allow pop-ups and try again.",unsupportedUrl:"The authorization URL is not HTTP or HTTPS and was blocked."},ZBe={volcengine:"Volcengine"},JBe={checkingPersistence:"Checking persistent storage…",exitDevelopment:"Exit development",fileUploaded:"Uploaded a file to the Sandbox",filesUploaded:"Uploaded {{count}} files to the Sandbox",intelligentDevelopment:"Intelligent development",mode:{readOnly:"Read only",workspaceWrite:"Workspace write",fullAccess:"Full access"},approvalPolicy:{untrusted:"Untrusted commands only",onRequest:"Ask when needed",never:"Never ask"},reviewer:{user:"Ask me",autoReview:"Automatic review"},labels:{approvalPolicy:"Approval policy",file:"File",fileNumber:"File {{number}}",mode:"Sandbox mode",networkAccess:"Network access",reviewer:"Approval method",workingDirectory:"Working directory"},network:{allowed:"Allowed",disabled:"Off"},permissionsUpdated:"Updated Codex permissions for this Sandbox session",persistenceUnknown:"Unable to verify persistent storage",stoppedReady:"Stopped. You can continue typing.",uploadedFilesPrompt:"The following files were uploaded to the current Sandbox workspace. Use them in this task:",workspaceUpdated:"Workspace updated"},e7e={addAgent:"Add Agent",addFromPackage:"Add from code package",agent:"Agent",automations:"Automations",createAgent:"Create Agent",createSkill:"Create Skill",cronJobs:"Cronjob",issueFeedback:"Issue feedback",library:"Library",migrateAgent:"Migrate Agent",newConversation:"New conversation",optimizeSkill:"Optimize {{name}}",search:"Search",skill:"Skill",skillLibrary:"Skill library",systemInfo:"System information",updateAgent:"Update {{name}}",codeProjects:"Code projects",reviewCenter:"Review center"},t7e={title:"Create from workspace",description:"Create and manage code projects, then develop and debug in VS Code"},r7e={actions:zBe,addAgent:UBe,approval:VBe,common:QBe,conversation:GBe,credentials:HBe,dialogs:WBe,errors:YBe,feedback:qBe,greetings:jBe,loading:XBe,oauth:KBe,providers:ZBe,sandbox:JBe,titles:e7e,workspaceProjectEntry:t7e},jcr=Object.freeze(Object.defineProperty({__proto__:null,actions:zBe,addAgent:UBe,approval:VBe,common:QBe,conversation:GBe,credentials:HBe,default:r7e,dialogs:WBe,errors:YBe,feedback:qBe,greetings:jBe,loading:XBe,oauth:KBe,providers:ZBe,sandbox:JBe,titles:e7e,workspaceProjectEntry:t7e},Symbol.toStringTag,{value:"Module"})),n7e="Automations",i7e="Connect development tools and extend your Agents with automated workflows",a7e="Search automations",o7e="Automation categories",s7e={development:"Development",channels:"Messaging channels"},l7e="{{category}} automations",c7e="Open {{name}}",u7e="Available only in local deployments",h7e="No matching automations",d7e="Try searching for another name",f7e="Back to automations",p7e={"coding-agents":{name:"Configure coding agents",badge:"Local",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},template:{name:"Import starter project",description:"Create a minimal Agent project in your repository with continuous delivery to AgentKit Runtime.",title:"Import starter project",subtitle:"Add a ready-to-run basic Agent and continuous delivery configuration to your repository",panel:"This creates a pull request containing the basic project and AgentKit Runtime delivery workflow.",submitLabel:"Import template and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: import AgentKit basic template",description:"Import a basic Agent project with the AgentKit Studio App Server and add continuous delivery to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:"agentkit-basic-agent",help:"The basic project will be added here; app.py mounts the complete Studio App Server and serves as the entry point"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},delivery:{name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: continuously publish to AgentKit Runtime",description:"Add a GitHub Actions workflow that continuously publishes updates from the target branch to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},review:{name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",regionHelp:"",pullRequest:{title:"chore: configure automated PR review",description:"Add a GitHub Actions workflow that reviews same-repository pull requests in an isolated Sandbox and publishes the result as a GitHub review. Configure the required workflow secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},sandboxToolId:{label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"The AgentKit CodeEnv used for each review"},modelName:{label:"Review model",placeholder:"review-model",help:"The code review model name injected into the Sandbox"},modelBaseUrl:{label:"Model API URL",placeholder:"https://ark.example.com/api/v3",help:"Must be an OpenAI-compatible HTTPS endpoint"}}},"gitlab-review":{name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."},feishu:{name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},"website-integration":{name:"Website integration",description:"Embed an AgentKit Runtime on your website as a floating chat window."}},g7e={required:"Required",optional:"Optional",region:"Region",tokenLabel:"GitHub Token",getToken:"Get token",createToken:"Create GitHub token",tokenPlaceholder:"Requires write access to repository contents and pull requests",tokenWorkflowPlaceholder:"Requires write access to contents, pull requests, and workflows",hideToken:"Hide token",showToken:"Show token",tokenHelp:"The token is used only for this submission. It is not stored in the browser or written to the pull request.",tokenWorkflowHelp:"This token is used only to create the configuration PR. It is not a general Sandbox requirement and is not stored in the browser or written to the PR.",prCreated:"PR #{{number}} created",configPrCreated:"Configuration PR #{{number}} created",configPrNextStep:"After it is merged, later pull requests in the same repository will trigger reviews automatically.",viewOnGitHub:"View on GitHub",viewConfigPr:"View configuration PR",secretsHeading:"Before merging the pull request, configure these GitHub Actions secrets in the repository:",secretsConfigHeading:"Before merging the configuration PR, add runtime secrets to the target repository",openSecrets:"Open Secrets settings",secretsPath:"Path: Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"A PR review configuration will be added for {{repository}}",repositoryReviewHelp:"GitHub App will validate pull requests for {{repository}}",secretPair:"{{accessKey}}, {{secretKey}} (required)",sessionToken:"{{sessionToken}} (required when using temporary credentials)",requiredSecret:"{{name}} (required)",temporaryCredentialRequired:" (required when using temporary credentials)",requiredSuffix:" (required)",submitting:"Creating PR…",validation:{required:"This field is required",repository:"Enter owner/repository or a full GitHub repository URL",baseBranch:"The target branch format is invalid",projectPath:"Enter a relative path within the repository",runtimeId:"The Runtime ID format is invalid",sandboxToolId:"The Sandbox Tool ID format is invalid",modelName:"The model name format is invalid",modelBaseUrlSafe:"Enter an HTTPS URL without credentials, query parameters, or fragments",modelBaseUrl:"Enter a valid HTTPS URL",runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}}},m7e={title:"Configure coding agents",description:"Install the AgentKit skills bundled with Studio globally for local coding clients.",retry:"Retry",clients:{ariaLabel:"Select coding agents",title:"Local clients",detectAgain:"Detect again",detecting:"Detecting local clients…",detected:"Client detected",available:"Available",unavailable:"Not detected"},skills:{ariaLabel:"Select bundled skills",title:"Bundled skills",viewFiles:"View files",items:{"veadk-agent-development":{name:"VeADK Agent development",description:"Build and refine Agents with VeADK."},"agentkit-cli":{name:"AgentKit CLI",description:"Manage and deploy AgentKit resources with AgentKit CLI."}}},global:{ariaLabel:"Global installation directories",title:"Global installation",description:"Available to other local projects after configuration",empty:"Select a client to see its installation directory."},success:"Configured {{skillCount}} skill(s) for {{agentCount}} client(s)",selection:"{{agentCount}} client(s) and {{skillCount}} skill(s) selected",selectClient:"Select a client first",configuring:"Configuring…",configure:"Configure",errors:{detect:"Failed to detect local clients",configure:"Configuration failed. Check permissions for your user directory and try again."},preview:{description:"Browse the skill files bundled with Studio in read-only mode",close:"Close file preview",loading:"Loading files…",error:"Failed to load skill files",skillFiles:"{{name}} files",files:"Files",fileContent:"File contents",notPreviewable:"This file is not previewable UTF-8 text.",noFiles:"No previewable files."}},v7e={title:"Feishu bot",description:"Create a Feishu Agent powered by AgentKit Runtime",panel:"Enter the credentials for a published Feishu app. Studio will generate a basic Agent, create a dedicated Runtime, and enable the persistent Feishu messaging connection.",agentName:"Agent name",agentNameHelp:"Used as the root Agent name in the new Runtime",region:"Deployment region",regionHelp:"The Runtime and build artifacts will be created in this region",regions:{"cn-beijing":"Beijing","cn-shanghai":"Shanghai"},appId:"Feishu App ID",appIdHelp:"Application credential from the Feishu Open Platform",appSecret:"Feishu App Secret",appSecretPlaceholder:"Enter the App Secret",appSecretHelp:"Written only to the environment variables of the new Runtime",hideSecret:"Hide App Secret",showSecret:"Show App Secret",hide:"Hide",show:"Show",confirmCancel:"Cancelling will stop the task and clean up any Runtime already created. Continue?",status:{preparing:"Generating the basic Agent",running:"Creating Runtime",cancelling:"Cancelling deployment",succeeded:"Feishu bot Runtime created",cancelled:"Deployment cancelled",failed:"Creation failed"},steps:{prepare:"Generate Agent",build:"Build image",deploy:"Create Runtime",publish:"Publish service"},openConsole:"Open Runtime console",credentials:{title:"Credential handling",description:"The App Secret is used only for this deployment. It is never written to generated source code or browser storage."},cancelDeployment:"Cancel deployment",creating:"Creating…",create:"Create Feishu bot Runtime",validation:{appId:"Enter the Feishu App ID",appSecret:"Enter the Feishu App Secret",agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name",characters:"Name must start with a letter or underscore and contain only letters, numbers, and underscores"}},generatedAgent:{description:"A helpful assistant that receives messages through Feishu.",instruction:"You are a helpful assistant serving users through Feishu. Understand each request accurately and provide concise, reliable answers. Ask clarifying questions when information is missing, and never invent facts."}},Xcr=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:f7e,cards:p7e,categories:s7e,categoriesLabel:o7e,codingAgents:m7e,default:{title:n7e,description:i7e,search:a7e,categoriesLabel:o7e,categories:s7e,resultsLabel:l7e,open:c7e,localOnly:u7e,emptyTitle:h7e,emptyDescription:d7e,backToAutomations:f7e,cards:p7e,github:g7e,codingAgents:m7e,feishu:v7e},description:i7e,emptyDescription:d7e,emptyTitle:h7e,feishu:v7e,github:g7e,localOnly:u7e,open:c7e,resultsLabel:l7e,search:a7e,title:n7e},Symbol.toStringTag,{value:"Module"})),y7e={"zh-CN":"简体中文","en-US":"English"},Kcr=Object.freeze(Object.defineProperty({__proto__:null,default:{languageNames:y7e},languageNames:y7e},Symbol.toStringTag,{value:"Module"})),b7e={selectedExcerptLabel:"Selected excerpt",commentLabel:"Annotation",commentSeparator:": ",successTitle:"Added to the Bad Case evaluation set",successDescription:"This annotation is linked to the current question and the complete model response.",done:"Done",ariaLabel:"Annotate the selected model response",title:"Add annotation",content:"Annotation",placeholder:"Describe the issue or the expected change",retryError:"{{error}}. Please try again.",cancel:"Cancel",submit:"Add to Bad Case"},x7e={attachment:"attachment",image:"image",preview:"Preview {{name}}",uploading:"Uploading",uploadFailed:"Upload failed",remove:"Remove {{name}}",previewDialog:"{{name}} preview",download:"Download",close:"Close",reading:"Loading document…",loadFailed:"Failed to load document: {{error}}"},w7e={errorTitle:"Cloud log error",copyError:"Copy complete error details",retry:"Retry",statuses:{live:"Live",connecting:"Connecting",retrying:"Reconnecting",idle:"Disconnected"},title:"Instance logs",description:"The VeFaaS instance handling the current conversation request",close:"Close instance logs",instanceId:"Instance ID",waitingInstance:"Waiting for instance",request:"Request {{id}}",ariaLabel:"Live VeFaaS instance logs",notCapturedTitle:"No instance captured yet",notCapturedDescription:"Send a message to see the instance that handles it and its live logs.",connectingTitle:"Connecting to instance logs",connectingDescription:"Establishing a secure log stream through the Studio BFF.",emptyTitle:"No logs yet",emptyDescription:"Connected to the instance and waiting for new log output.",retention:"Logs refresh automatically. Only the latest {{count}} lines are kept."},A7e={title:"Trace",statuses:{loading:"Loading",ready:"",collecting:"Collecting",disabled:"Disabled",forbidden:"Permission required",error:"Failed to load"},errors:{collecting:"The trace is still being collected. Please wait.",disabled:"Tracing is not enabled for this agent. Enable it in the console and try again.",forbidden:"Your account cannot read APMPlus traces. Ask an administrator for read access.",error:"Failed to load the trace. Please try again later."},callCount:"{{count}} calls · {{duration}} ms",close:"Close",loading:"Loading trace…",retryNow:"Retry now",reload:"Reload",empty:"No trace is available for this session yet.",attributes:"Attributes",selectCall:"Select a call on the left to view its details"},S7e={exportNote:"This conversation was exported from AgentKit Studio for reference only.",imageFailed:"Failed to generate the image. Please try again.",browserUnsupported:"This browser cannot generate a conversation image. Please try again.",copyUnsupported:"This browser cannot copy images. Download the image instead.",exportFailed:"Export failed. Please try again.",title:"Export conversation",description:"Choose a format and download all inputs and outputs through the current response.",close:"Close",generatingContent:"Preparing export…",retry:"Try again",previewPage:"Previewing page 1 of {{count}}",previewAlt:"Conversation export page 1 of {{count}}",format:"Export format",generatingFormat:"Generating {{format}}…",copying:"Copying…",copiedFirst:"First page copied",copied:"Copied",copyFirst:"Copy first page",copyImage:"Copy image",generating:"Generating…",downloadArchive:"Download PNG archive ({{count}} pages)",downloadFormat:"Download {{format}}"},T7e={unsupportedComponent:"Unsupported component: {{component}}",sandboxIdentity:"Codex Sandbox execution identifiers",useSkill:"Use the {{name}} skill",thinkingDone:"Finished thinking",thinking:"Thinking",justNow:"Just now",sourceUnavailable:"The generated source is temporarily unavailable. Please try again later.",downloadStarted:"Download started",verifiedDelivery:"Verified deliverable",generatedSource:"Generated agent source",entryPoint:"Entry point",fileCount:"Files",size:"Size",validationTime:"Validated",generationTime:"Generated",checksPassed:"{{count}} checks passed",sourceReady:"Source is ready to deploy",sourceGuidance:"The source is ready to view, download, or deploy. Confirm the runtime configuration before deployment.",viewSource:"View source",preparing:"Preparing…",viewChanges:"View changes",downloadSource:"Download source",sourceNotReady:"The source is not ready yet",manualDeploy:"Deploy manually to Runtime",deployAgent:"Deploy Agent",beforeOptimization:"Before optimization",afterOptimization:"After optimization",planStatuses:{pending:"Pending",in_progress:"In progress",completed:"Completed",failed:"Incomplete"},renderUi:"Render UI",truncated:"… (truncated)",agentAdjusting:"Agent is adjusting",sandboxDetails:"Detailed Codex Sandbox output",waitingCodex:"Waiting for Codex output",arguments:"Arguments",result:"Result",artifacts:"Artifacts",downloadNamed:"Download {{name}}",powerpoint:"PowerPoint presentation",preview:"Preview",download:"Download",previewDialog:"{{name}} preview",closePreview:"Close preview",slidePreview:"{{name}} slide preview",mcpToolset:"MCP toolset",authorized:"Authorized · {{tool}}",authorizationRequired:"{{tool}} requires authorization",oauthDescription:"The {{tool}} toolset is protected by OAuth and requires sign-in before use.",oauthProvider:"You will be redirected to {{provider}} to sign in.",oauthContinue:"The conversation will continue automatically after authorization.",waitingAuthorization:"Waiting for authorization…",authorize:"Authorize",missingAuthorizationUrl:"No authorization URL was found in the event.",tools:{web_search:{running:"Searching the web",done:"Web search complete"},link_reader:{running:"Reading webpage",done:"Webpage read complete"},run_code:{running:"Running code in the AgentKit sandbox",done:"Code execution completed in the AgentKit sandbox"},list_envs:{running:"Checking available environments",done:"Available environments loaded"},get_env_manifest:{running:"Loading the environment manifest",done:"Environment manifest loaded"},execute_in_sandbox:{running:"Running a command in the environment",done:"Command completed in the environment"},delegate_to_codex_sandbox:{running:"Codex Sandbox is running",done:"Codex Sandbox completed",failed:"Codex Sandbox failed"},image_generate:{running:"Generating image",done:"Image generated"},video_generate:{running:"Generating video",done:"Video generated"},ppt_generate:{running:"Generating presentation",done:"Presentation generated"},load_memory:{running:"Searching long-term memory",done:"Memory search complete"},load_knowledgebase:{running:"Searching the knowledge base",done:"Knowledge base search complete"},load_skill:{running:"Loading skill",done:"Skill loaded"},collect_resources:{running:"Collecting available resources",done:"Resource collection complete",failed:"Resource collection failed"},create_agents:{running:"Creating and running agents",done:"Agent creation complete",failed:"Agent creation failed"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit Skill Center",knowledge_base:"Knowledge base",tool:"Tools"},agentTypes:{llm:"LLM Agent",sequential:"Sequential Agent",parallel:"Parallel Agent",loop:"Loop Agent",workflow:"Workflow"},skill:"Skill",subAgents:"Sub-agents",builtinTool:"Built-in tool",skillCenter:"AgentKit Skill Center",selfAuthoredTools:"Custom tools",dependencies:"Dependencies: {{items}}",fullCode:"Complete code for {{name}}",itemCount:"{{label}}: {{count}} items",collectionAria:"Retrieved resource information",retrieving:"Retrieving resources",retrievalFailed:"Resource retrieval did not complete",checkConfig:"Check the resource service configuration and try again.",notSearched:"Not searched",notConfigured:"Not configured",resourceList:"{{label}} resource list",searchKeywords:"Search keywords",skillHubSkipped:"No search keywords were provided, so Skill Hub was not searched.",sourceSkipped:"{{label}} is not configured, so this source was not searched.",noResources:"No resources in this category were returned.",resultAria:"Agent creation results",creationFailed:"Agent creation did not complete",agentResources:"Resources available to {{name}}",knowledgeBase:"Knowledge base",toolsLabel:"Tools",creating:"Creating agents",noAgents:"No agents to display",noAgentResult:"The tool response did not include an agent configuration or execution result.",sourceLabels:{tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknown:"Unknown source"},unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"},branchCompare:{ariaLabel:"Compare branches",selectDirection:"Select a direction",continue:"Continue in this direction"},codexProgress:{planTitle:"Codex execution plan",fallback:{fileChange:"Modify files",approval:"Waiting for approval",status:"Codex status",command:"Run command"},planSummary:"{{completed}}/{{total}} completed",command:{running:"Running command",completed:"Command completed",failed:"Command failed"},projectFiles:"{{count}} project files",projectFile:"project files",fileChange:{running:"Updating {{subject}}",completed:"Updated {{subject}}",failed:"Failed to update {{subject}}"},externalTool:"external tool",mcp:{running:"Calling {{tool}}",completed:"Called {{tool}}",failed:"{{tool}} call did not complete"},collaboration:{spawn_agent:{running:"Starting subtask",completed:"Subtask started",failed:"Failed to start subtask"},send_input:{running:"Sending information to subtask",completed:"Information sent to subtask",failed:"Failed to send information to subtask"},wait:{running:"Waiting for subtask",completed:"Subtask wait complete",failed:"Subtask wait failed"},close_agent:{running:"Ending subtask",completed:"Subtask ended",failed:"Failed to end subtask"},default:{running:"Coordinating subtasks",completed:"Subtask collaboration complete",failed:"Subtask collaboration failed"}},webSearch:{running:"Searching the web",completed:"Web search complete",failed:"Web search did not complete"},errorDetail:"Codex execution did not complete.",errorTitle:"Codex encountered an error"}},C7e={segments:{system:"System and tools",input:"Input and history",output:"Output and reasoning",remaining:"Remaining"},modelUnavailable:"Model information unavailable",promptWithSystem:"Prompt (including system)",systemUnknown:"System and tool usage unknown",systemApprox:"System and tools approximately {{count}} tokens",ariaKnown:"Context {{percentage}}% used, {{system}}, {{inputLabel}} {{input}} tokens, output and reasoning {{output}} tokens, remaining {{remaining}} tokens",ariaUnknown:"{{model}}, context window unknown, {{count}} cumulative session tokens used",composition:"Context composition",percentageUsed:"{{percentage}}% used",gridAria:"100-cell context composition chart. Each cell represents one percent of the context window.",estimated:"Estimated",unknown:"Unknown",summaryPercentage:"{{used}} used, {{remaining}} remaining",summaryTokens:"{{used}} used, {{remaining}} remaining, {{total}} total",overflow:"Context exceeded by {{count}} tokens",title:"Context usage",unknownModel:"The context window for this model is not available",unknownRuntime:"The current runtime did not provide model information"},O7e={title:"Add AgentKit agent",noAgents:"Connected successfully, but no agents were found at this address (/list-apps was empty).",connectionFailed:"Connection failed: {{error}}. Check the URL, API key, and whether the gateway allows cross-origin requests.",description:"Enter the URL and API key of an AgentKit deployment to connect through the ADK protocol. Connected agents will appear in the selector in the upper-left corner.",url:"Endpoint URL",apiKeyHint:"Connect using Authorization: Bearer",displayName:"Display name (optional)",displayNameHint:"Uses the URL hostname by default",cancel:"Cancel",connecting:"Connecting…",connect:"Connect and add"},k7e={placeholder:"Type a message…",inputAria:"Message",generating:"Generating",send:"Send"},E7e={ariaLabel:"Invocation context for this turn",removeSkill:"Remove skill {{name}}",removeAgent:"Remove agent {{name}}"},_7e={cardAria:"{{label}} chart",viewAria:"{{label}} display mode",preview:"Preview",code:"Code",invalidEcharts:"The ECharts configuration is not a valid, safe data object. Switch to Code to inspect it.",renderFailed:"The chart cannot be rendered right now. Switch to Code to inspect it.",echartsAria:"ECharts preview",rendering:"Rendering chart…",mermaidFailed:"The chart cannot be rendered right now. Switch to Code to inspect the Mermaid source.",mermaidAria:"Mermaid preview"},R7e={playVideo:"Play video: {{name}}",enlargeImage:"Enlarge image preview: {{name}}",image:"image",enlargeVideo:"Enlarge video",videoPreview:"Video preview",downloadVideo:"Download video",close:"Close"},D7e={annotation:b7e,media:x7e,runtimeLogs:w7e,trace:A7e,share:S7e,blocks:T7e,tokenUsage:C7e,addAgentKit:O7e,composer:k7e,invocation:E7e,visualization:_7e,markdown:R7e},Zcr=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:O7e,annotation:b7e,blocks:T7e,composer:k7e,default:D7e,invocation:E7e,markdown:R7e,media:x7e,runtimeLogs:w7e,share:S7e,tokenUsage:C7e,trace:A7e,visualization:_7e},Symbol.toStringTag,{value:"Module"})),L7e={back:"Back",cancel:"Cancel",deploy:"Deploy",delete:"Delete",loading:"Loading…",next:"Next",notSupported:"Not supported",previous:"Previous",required:"Required",retry:"Retry",actions:"Actions",value:"Value",disabled:"Off",enabled:"Enabled",none:"None",close:"Close",name:"Name",description:"Description",send:"Send"},M7e={heading:"VeADK agent structure configuration",importHint:"Reload this file from Import YAML on the Create Agent page."},I7e={agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name.",characters:"Start with a letter or underscore and use only letters, numbers, and underscores"},runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}},P7e={description:"A VeADK-powered assistant that understands user intent and uses the right tools to complete tasks.",instruction:`You are a professional and reliable assistant. +{{response}}`,loadArkApiKeysFailed:"Failed to load Ark API keys",loadModelsFailed:"Failed to load models",runtimeAccessDenied:"This account cannot access the Runtime. Refresh the list or sign in again.",privateRuntimeUnavailable:"The Runtime was deployed, but this Studio cannot access the private Runtime. Use a Studio connected to the same VPC, or deploy with public or public plus VPC access.",runtimeTemporarilyUnavailable:"The Runtime was deployed, but Studio cannot connect yet. The gateway domain may still be propagating, or the current network or DNS cannot reach it. Try connecting again later from Manage Agents.",runtimeConnectionUnsupported:"The Runtime Agent Server does not provide a connection endpoint. Confirm that the Runtime is ready and compatible.",runtimeConnectionDenied:"The Runtime rejected the connection request. Check its authentication configuration.",listAgentsFailed:"Failed to load Agents",invalidListAppsJson:"Runtime /list-apps returned unreadable JSON.",invalidListAppsFormat:"Runtime /list-apps returned an invalid format; expected a non-empty string array.",createSessionFailedWithStatus:"Failed to create session ({{status}})",createSessionFailed:"Failed to create session",getSessionFailed:"Failed to load session",getSessionFailedWithDetail:"Failed to load session ({{status}}): {{detail}}",feedbackRuntimeOnly:"Feedback sync is supported only for sessions connected to an AgentKit Runtime",feedbackRegionMissing:"The Runtime region is missing, so feedback cannot be submitted",submitFeedbackFailed:"Failed to submit feedback",loadEvaluationSetsFailed:"Failed to load evaluation sets",loadAutoEvaluationStatusFailed:"Failed to load automatic evaluation status",loadOptimizationsFailed:"Failed to load optimization suggestions",deleteEvaluationCaseFailed:"Failed to delete the evaluation case",downloadFileFailed:"Failed to download the file",fileUnavailable:"File content is unavailable",uploadFileFailed:"File upload failed",traceDisabled:"Tracing is not enabled for this Agent. Enable it in the console first.",loadTraceFailed:"Failed to load trace data",contentTypeMissing:"Content-Type missing",traceNonJson:"Trace failed: the server returned a non-JSON response ({{contentType}}). Check the Studio API proxy configuration",invalidTraceFormat:"Trace failed: invalid response format",submitIssueFeedbackFailed:"Failed to submit issue feedback",issueFeedbackNotConfirmed:"Failed to submit issue feedback: the server did not confirm the submission",noPreviewableAgent:"This Runtime does not provide an Agent that can be previewed.",agentSearchFailed:"Agent search failed",emptySseBody:"HTTP 200 with an empty SSE response body.",noDisplayableSseReply:"HTTP 200, but the SSE response did not contain a displayable model reply.",firstSseEventTimeout:"No SSE event was received within 60 seconds. Try again later, and review the Runtime, model, or gateway logs.",runSessionFailed:"Session run failed",runSseFailedWithDetail:"run_sse failed ({{status}}): {{detail}}",checkRuntimeNameFailed:"Failed to check the Runtime name",invalidRuntimeNameCheck:"Failed to check the Runtime name: invalid response format",loadCloudResourcesFailed:"Failed to load cloud resources",invalidCloudResources:"The cloud resource list response has an invalid format",invalidEnvironmentMount:"The environment mount response has an invalid format",environmentMountMismatch:"The environment mount response does not match the request",environmentMountNetworkFailed:"Unable to connect to Studio, so the environment was not mounted. Check your network and try again.",environmentMountFailed:"Failed to mount the environment",clipboardUnsupported:"This browser does not support writing to the clipboard.",clipboardWriteFailed:"Unable to write to the clipboard. Check clipboard permissions.",loadSystemInfoFailed:"Failed to load system information",invalidSystemInfo:"The system information response has an invalid format",invalidEnvironmentBuild:"The environment build response has an invalid format",invalidEnvironmentBuildStep:"The environment build step response has an invalid format",invalidEnvironmentManifest:"The environment manifest response has an invalid format",invalidImageRepository:"The environment image repository response has an invalid format",invalidCodeRepository:"The environment code repository response has an invalid format",invalidImageSource:"The environment image source response has an invalid format",invalidEnvironment:"The environment response has an invalid format",invalidWorkspace:"The workspace response has an invalid format",loadWorkspacesFailed:"Failed to load workspaces",invalidWorkspaceList:"The workspace list response has an invalid format",saveWorkspaceFailed:"Failed to save the workspace",deleteWorkspaceFailed:"Failed to delete the workspace",loadEnvironmentsFailed:"Failed to load environments",invalidEnvironmentList:"The environment list response has an invalid format",probeRepositoryFailed:"Failed to inspect the code repository",invalidRepositoryProbe:"The code repository inspection response has an invalid format",exportEnvironmentCodeFailed:"Failed to export the environment share code",invalidEnvironmentCode:"The environment share code response has an invalid format",inspectEnvironmentCodeFailed:"Failed to inspect the environment share code",invalidEnvironmentCodeInspection:"The environment share code inspection response has an invalid format",importEnvironmentCodeFailed:"Failed to import the environment share code",invalidEnvironmentCodeImport:"The environment share code import response has an invalid format",studioUnavailable:"Unable to connect to Studio. Confirm that the backend is running and try again.",saveEnvironmentFailed:"Failed to save the environment",deleteEnvironmentFailed:"Failed to delete the environment",startEnvironmentBuildFailed:"Failed to start the environment build",loadEnvironmentBuildFailed:"Failed to load environment build details",loadEnvironmentManifestFailed:"Failed to load the environment manifest",invalidEnvironmentResource:"The environment resource response has an invalid format",loadEnvironmentResourcesFailed:"Failed to load environment build resources",updateCodexSandboxFailed:"Failed to update Codex Sandbox",invalidCodexSandboxUpdate:"The Codex Sandbox update response has an invalid format",loadUserPoolsFailed:"Failed to load user pools",invalidUserPoolList:"The user pool list response has an invalid format",syncGithubFailed:"Failed to sync GitHub code ({{status}})",validatingMigrationArtifact:"Validating migration artifact",uploadingCodePackage:"Uploading code package",migrationArtifactValidated:"Migration artifact validated",codePackageUploaded:"Code package uploaded",deploymentProgress:{preparing:"Preparing deployment",uploading:"Uploading the code package",building:"Building the image",buildLogsSyncing:"Building the image. Build logs are up to date.",buildLogsComplete:"Build log sync complete.",buildFailedLogsSynced:"Image build failed. Final build logs are available.",buildLogsUnavailable:"Build logs are temporarily unavailable.",finalBuildLogsUnavailable:"Final build logs are temporarily unavailable.",deploying:"Deploying the service",publishing:"Publishing the service",evaluating:"Creating evaluation sets",updating:"Updating the Runtime configuration",completing:"Finalizing deployment",github:"Configuring GitHub delivery",inProgress:"Deployment in progress"},deploymentFailed:"Deployment failed",deploymentDisconnected:"Deployment failed: connection interrupted",deploymentMissingAgentName:"Deployment failed: Agent name missing from response",deploymentMissingConnection:"Deployment failed: AgentKit connection information missing from response",cancelDeploymentFailed:"Failed to cancel deployment ({{status}})",loadFailed:"Failed to load ({{status}})",loadPermissionsFailed:"Failed to load permissions ({{status}})",invalidPermissionResponse:"The permission service returned an unreadable response",checkStudioUpdateFailed:"Failed to check for Studio updates ({{status}})",studioUpdatePreflightFailed:"Studio update permission check failed ({{status}})",submitStudioUpdateFailed:"Failed to submit the Studio update ({{status}})",loadAgentUsageFailed:"Failed to load Agent usage",notProvided:"Not provided",agentUsageNonJson:"Failed to load Agent usage: the server returned a non-JSON response (HTTP {{status}}, Content-Type: {{contentType}}). ",checkStudioGateway:"Confirm that the current service is running in Studio mode and check the proxy or gateway configuration.",agentUsageInvalidJson:"Failed to load Agent usage: the server returned invalid JSON (HTTP {{status}}, Content-Type: {{contentType}}). ",retryCheckGateway:"Try again later. If the problem persists, check the proxy or gateway configuration.",loadCronJobsFailed:"Failed to load scheduled tasks",loadCronJobFailed:"Failed to load scheduled task details",createCronJobFailed:"Failed to create the scheduled task",updateCronJobFailed:"Failed to update the scheduled task",enableCronJobFailed:"Failed to enable the scheduled task",pauseCronJobFailed:"Failed to pause the scheduled task",runCronJobFailed:"Failed to run the scheduled task now",loadCronHistoryFailed:"Failed to load execution history",stopCronRunFailed:"Failed to stop the execution",deleteCronJobFailed:"Failed to delete the scheduled task",loadRuntimeFailed:"Failed to load the Runtime",loadLocalToolsFailed:"Failed to load local tools",connectDynamicRouteFailed:"Failed to connect the Studio dynamic route",a2aProbeDenied:"The Runtime rejected the A2A probe. Check the Runtime authentication configuration.",loadA2aCardFailed:"Failed to load the A2A Agent Card",loadRuntimeApiKeyFailed:"Failed to load the Runtime API key",runtimeApiKeyMissing:"The Runtime did not return a usable API key",loadMcpCredentialsFailed:"Failed to load MCP authentication",invalidMcpCredentials:"Studio returned invalid MCP authentication data",deleteFailed:"Delete failed ({{status}})",runtimeManageForbidden:"This account cannot manage the Runtime.",runtimeNotFound:"The Runtime does not exist or has been deleted.",runtimeUnavailable:"This account cannot access the Runtime.",checkRuntimeUpdateFailed:"Failed to check Runtime update capability (HTTP {{status}}). Try again later.",loadRuntimeDetailFailed:"Failed to load Runtime details",generateProjectFailed:"Failed to generate the project",generateProjectTimedOut:"Generating the publish preview project timed out. Please try again.",generateAgentConfigFailed:"Failed to generate the Agent configuration",createDebugRunFailed:"Failed to create the debug run",createDebugSessionFailed:"Failed to create the debug session",loadDebugTraceFailed:"Failed to load the debug trace",invalidDebugTrace:"Failed to load the debug trace: invalid response format",debugRunFailed:"Debug run failed",cleanupDebugRunFailed:"Failed to clean up the debug run"},j8e={loadFailed:"Failed to load conversation mode capabilities (HTTP {{status}})",invalidResponse:"The conversation mode capabilities response has an invalid format"},X8e={nonJson:"{{fallback}}: the server returned a non-JSON response (HTTP {{status}}, {{contentType}}){{detail}}"},K8e={busy:"The workspace is busy. Try again shortly",notFound:"Workspace not found",duplicates:"Multiple personal workspace sessions were found. Contact your administrator",timeout:"Workspace recovery timed out. Your projects are retained. Try again",unavailable:"The workspace cannot be restored right now. Your projects are retained. Try again",persistence:"Persistence is not enabled for this Sandbox. Check the workspace configuration",startup:"Workspace startup failed. Check the Sandbox status",exists:"This project already exists. Open it from the project list",directory:"Project directory not found",configuration:"Configure the workspace Sandbox image first",state:"Could not check workspace status. Try again",list:"Could not restore the workspace or load projects. Try again",create:"Project initialization failed. Check that the image is available and try again",open:"Could not restore the workspace or open the project. Try again",connection:"Could not connect to the workspace. Try again",invalidWorkspaceUrl:"The workspace returned an invalid URL",operation:"Project operation failed. Try again",invalidProjectUrl:"The project URL is invalid",listFallback:"Could not load projects",connectionState:"Could not connect to the workspace. Try again"},Z8e={reporting:"Completing delivery details",packaging:"Preparing artifacts",savingVersion:"Saving version",finishing:"Finishing request",submitResult:"Submit build result",requestFailed:"Task request failed. Please retry.",invalidResponse:"Invalid task state response.",eventGap:"Restoring missing task output.",reconnecting:"Reconnecting. Existing output is preserved.",input:{pending:"Queued",sending:"Confirming delivery",delivered:"Delivered",withdrawn:"Not sent"},plan:"Execution plan",diff:"File changes",preparing:"Preparing task",preparingEnvironment:"Preparing development environment…",connectingEnvironment:"Connecting to development environment…",processing:"Processing request",thinking:"Thinking",read:"Read file · {{target}}",listFiles:"List directory · {{target}}",search:"Search · {{target}}",command:"Run command · {{target}}",editFiles:"Edit files · {{target}}",webSearch:"Search web · {{target}}",processSummary:"Processed {{count}} items",duration:"{{seconds}}s",durationUnits:{milliseconds:"{{value}} ms",hours:"{{value}} h",minutes:"{{value}} min",seconds:"{{value}} s"},failedTools:"{{count}} tools failed",toolFailed:"Failed",toolCalls:"{{count}} tool calls",turnDuration:"Turn elapsed {{duration}}",toolDuration:"Tool time {{duration}}",toolDurationPartial:"Recorded tool time {{duration}}",toolDurationHelp:"Sum of tool durations. Parallel calls can exceed turn elapsed time.",turnStatus:{completed:"Completed",failed:"Failed",interrupted:"Interrupted",cancelled:"Interrupted",unavailable:"Task ended"},notReported:"Not reported",partial:"Recorded",partialHelp:"Usage for this turn may be incomplete.",tokenDetails:"Turn token usage",model:"Turn model",totalTokens:"Total",inputTokens:"Input",cachedInputTokens:"Cached input",uncachedInputTokens:"Uncached input",cacheWriteInputTokens:"Cache write",outputTokens:"Output",reasoningOutputTokens:"Reasoning output",cacheHitRate:"Input cache hit rate",tokenHelp:"Cached input and reasoning output are subsets of input and output. Uncached input = input − cached input."},J8e={common:_8e,agentkitCli:R8e,cloudRegion:D8e,connections:L8e,feishuBot:M8e,requestError:I8e,runSse:P8e,runtimeLogs:N8e,search:B8e,skills:$8e,sse:F8e,identity:z8e,github:U8e,video:V8e,websiteIntegration:Q8e,knowledge:G8e,intelligentDevelopment:H8e,migrations:W8e,sandbox:Y8e,client:q8e,newChatCapabilities:j8e,jsonResponse:X8e,workspaceProjects:K8e,developmentRuns:Z8e},Ycr=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:R8e,client:q8e,cloudRegion:D8e,common:_8e,connections:L8e,default:J8e,developmentRuns:Z8e,feishuBot:M8e,github:U8e,identity:z8e,intelligentDevelopment:H8e,jsonResponse:X8e,knowledge:G8e,migrations:W8e,newChatCapabilities:j8e,requestError:I8e,runSse:P8e,runtimeLogs:N8e,sandbox:Y8e,search:B8e,skills:$8e,sse:F8e,video:V8e,websiteIntegration:Q8e,workspaceProjects:K8e},Symbol.toStringTag,{value:"Module"})),eBe="Agent reviews",tBe="Request access for everyone in your organization",rBe="Close",nBe="Refresh",iBe="Status",aBe="Applicant",oBe="Submitted",sBe="Current version",lBe="Model",cBe="Returned by",uBe="Approved by",hBe="Reviewed",dBe="Agent description",fBe="Application notes",pBe="Return reason",gBe="Review comment",mBe="Return reason (required)",vBe="Content changed after submission; return and submit again",yBe="Withdraw to edit this Agent, then submit a new request to publish it",bBe="Other users will lose access to this Agent. Unpublish it?",xBe="Cancel",wBe="Confirm",ABe="Saving",SBe="Unpublish",TBe="Withdraw request",CBe="Approve",OBe="Publish for everyone",kBe="Request publication",EBe="Everyone",_Be={pending:"Pending",approved:"Approved",returned:"Returned",withdrawn:"Withdrawn"},RBe="Search agents or applicants",DBe="Region",LBe="All statuses",MBe="Agent",IBe="Actions",PBe="Review application",NBe="Application details",BBe="No matching applications",$Be="No Agent review requests",FBe="{{count}} / {{limit}} characters",qcr=Object.freeze(Object.defineProperty({__proto__:null,actions:IBe,agent:MBe,all:LBe,approve:CBe,approvedBy:uBe,cancel:xBe,close:rBe,comment:gBe,confirm:wBe,contentChanged:vBe,default:{title:eBe,dialogDescription:tBe,close:rBe,refresh:nBe,statusTitle:iBe,submitter:aBe,submittedAt:oBe,version:sBe,model:lBe,returnedBy:cBe,approvedBy:uBe,reviewedAt:hBe,description:dBe,message:fBe,reason:pBe,comment:gBe,reasonRequired:mBe,contentChanged:vBe,withdrawConfirm:yBe,unpublishConfirm:bBe,cancel:xBe,confirm:wBe,saving:ABe,unpublish:SBe,withdraw:TBe,return:"Return",approve:CBe,publish:OBe,submit:kBe,private:"Private",enterprise:EBe,status:_Be,search:RBe,region:DBe,all:LBe,agent:MBe,actions:IBe,review:PBe,details:NBe,noMatches:BBe,empty:$Be,textCount:FBe},description:dBe,details:NBe,dialogDescription:tBe,empty:$Be,enterprise:EBe,message:fBe,model:lBe,noMatches:BBe,publish:OBe,reason:pBe,reasonRequired:mBe,refresh:nBe,region:DBe,returnedBy:cBe,review:PBe,reviewedAt:hBe,saving:ABe,search:RBe,status:_Be,statusTitle:iBe,submit:kBe,submittedAt:oBe,submitter:aBe,textCount:FBe,title:eBe,unpublish:SBe,unpublishConfirm:bBe,version:sBe,withdraw:TBe,withdrawConfirm:yBe},Symbol.toStringTag,{value:"Module"})),zBe={backToEvaluationCase:"Back to evaluation case",cancel:"Cancel",copied:"Copied",copy:"Copy",exportConversation:"Export conversation",retry:"Retry"},UBe={title:"How would you like to add an Agent?",subtitle:"Choose the approach that best fits your project.",quickCreate:{title:"Create from scratch",description:"Build an Agent with intelligent, custom, template, or workflow modes."},intelligent:{title:"Intelligent mode",description:"Describe your goal, then build, debug, and validate the Agent interactively."},package:{title:"Add and deploy a code package",description:"Upload an Agent project archive, review the code, and deploy it to AgentKit Runtime."},migrate:{title:"Migrate an existing project",description:"Migrate an existing LangChain, Dify, or similar project to AgentKit Runtime."}},VBe={subject:{file:"file changes",command:"command execution"},decision:{accept:"Allowed {{subject}} once",acceptForSession:"Allowed {{subject}} for this session",decline:"Declined {{subject}}",cancel:"Cancelled approval for {{subject}}"},details:{command:"Command",grantRoot:"Authorized path",cwd:"Working directory"}},QBe={noDescription:"No description",region:"Region",unknownAgent:"Unknown Agent"},GBe={agentTransfer:"Agent handoff",annotationHint:"Model response; select text to add an annotation",continueBranch:"Continue with “{{branch}}”",emptyResponse:"This response has no displayable content.",subagentDescription:"Working on a task handed off by the primary Agent."},HBe={title:"Configure {{provider}} credentials",prefix:"Agent Workspace requires {{provider}} credentials. Set",and:"and",suffix:"in the runtime environment, then retry."},WBe={buildRunning:{title:"A build is still running",description:"Leaving will stop this build. The session will remain available in your history.",confirm:"Stop and leave"},deleteThread:{title:"Delete Codex session",description:"Delete “{{name}}” and remove it from your session history?",confirm:"Delete"},returnToCreate:{title:"Return to the create page?",description:"Your current entries will be lost.",confirm:"Return"}},YBe={additionalAgentDeleteFailures:"; {{count}} more failed",agentDeleteFailures:"Failed to delete {{count}} Agents: {{failures}}{{suffix}}",agentToolsMissing:"This Agent is missing required tools: {{tools}}",buildStopUnconfirmed:"You left the development environment, but Studio could not confirm that the build stopped. It may still be running; check its status in session history later.",builtinAgentSendFailed:"Failed to send to the built-in Agent: {{message}}",bytePlusEvaluationUnsupported:"AgentKit evaluation sets are not currently supported on BytePlus",clipboardUnsupported:"This browser does not support writing to the clipboard.",cloudCodexEmptyReply:"The cloud Codex task ended without a response. Send the task again.",cloudCodexSessionMissing:"The cloud Codex session has not appeared in the list yet. Try again shortly.",deploymentRuntimeIdMissing:"Deployment completed without returning a Runtime ID.",environmentExpired:"The selected environment is no longer available. Refresh and select it again.",environmentsLoadFailed:"Failed to load environments",evaluationCaseSessionMissing:"This evaluation case has no session reference and cannot be opened.",evaluationUnsupportedForReply:"This response cannot be added to an evaluation set",firstFrameRequired:"Add a first-frame image before generating from first and last frames.",incompletePromptOptimization:"The prompt optimization result is incomplete. Run the optimization again.",intelligentCapabilityCheckFailed:"Failed to check intelligent development capabilities (HTTP {{status}})",intelligentSessionCreateFailed:"Failed to create the intelligent development session",invalidIntelligentCapability:"The intelligent development capability response is invalid.",localBffToolsNotConfigured:"No tools are configured for the local Studio BFF.",localToolsLoadFailed:"Failed to load local tools",loginPopupBlocked:"The browser blocked the sign-in window. Allow pop-ups and try again.",loginPopupClosed:"The sign-in window was closed. Sign in again to continue.",mediaTooLarge:"{{fileName}} exceeds this platform's media size limit.",mountEnvironmentFailed:"Failed to mount the environment",noConnectedSandbox:"No Sandbox is currently connected.",noCreateAgentPermission:"Your account does not have permission to add Agents.",noManageAgentPermission:"Your account does not have permission to manage Agents.",noOptimizationBaseline:"There is no pre-optimization version available for comparison.",oauthUrlMissing:"The event does not include an authorization URL.",onlyCloudAgentUpdatable:"Only deployed cloud Agents can be updated.",optimizationVersionMissing:"The project version for this optimization could not be found. It may have been deleted.",persistentStorageNotConfigured:"Persistent storage has not been configured by an administrator",readDraftFailed:"Unable to read local drafts. Try again.",runtimeAgentNameMissing:"The Runtime is missing an Agent name and cannot be updated.",runtimeBffToolsDisabled:"BFF tool capabilities are not enabled for this Runtime Agent.",runtimeDeploymentConfigUnavailable:"The Runtime's original deployment configuration cannot be restored, so it cannot be updated safely.",runtimeMissingForConnection:"Runtime information is missing, so the Agent cannot be connected.",runtimeRegionMissingForDelete:"The Runtime is missing region information and cannot be deleted.",runtimeRegionMissingForUpdate:"The Runtime is missing region information and cannot be updated.",runtimeUpdateUnsupported:"This Runtime does not support in-place updates.",sandboxRuntimeUnavailable:"This Agent does not have an available Sandbox Runtime.",sandboxToolsUnavailable:"The current Studio BFF does not provide Sandbox execution tools.",saveDraftLocationRejected:"The browser could not save the current draft location. Check site storage permissions and try again.",saveDraftRejected:"The browser could not save the draft. Try again.",selectSkillToOptimize:"Select a Skill to optimize first.",sessionMissingForMount:"The current session does not exist, so an environment cannot be mounted.",sessionNotReady:"The session is not ready yet.",sessionUnavailable:"The current session is unavailable. Close it and try again.",sourceNotReady:"The source is not ready yet. Return to the conversation to continue.",textVideoRejectsReferences:"Text-to-video does not use reference media. Remove the images or videos first.",videoEditRequiresVideo:"Add the video you want to edit first.",videoExtendRequiresVideo:"Add a source video before extending it.",videoGenerationFailed:"Video generation failed. Try again later.",videoModeUnsupported:"The selected video mode is not supported on this platform.",videoPreviewMissing:"The video task completed, but the server did not return a preview URL.",videoReferenceRequired:"Add at least one reference image or video."},qBe={like:"Like",removeLike:"Remove like",dislike:"Dislike",removeDislike:"Remove dislike",reportIssue:"Report an issue",traceFlameGraph:"Tracing flame graph"},jBe={0:"What would you like to work on today?",1:"How can I help?",2:"What would you like me to look into?",3:"Ask me anything",4:"Hi, let's get started",5:"Start a new conversation",6:"What should we tackle first?",7:"Tell me what you have in mind",8:"Where should we begin?",9:"What can I help you with?",10:"Ready to move this forward?",11:"What's most important right now?",12:"Let's get something done today",13:"I'm ready when you are",intelligentDevelopment:"Give your ideas room to grow"},XBe={agentCapabilities:"Checking Agent capabilities…",session:"Loading session…"},KBe={cancelled:"Authorization was cancelled.",pasteCallbackUrl:"After authorization, paste the full callback URL from your browser's address bar:",popupBlocked:"The browser blocked the authorization window. Allow pop-ups and try again.",unsupportedUrl:"The authorization URL is not HTTP or HTTPS and was blocked."},ZBe={volcengine:"Volcengine"},JBe={checkingPersistence:"Checking persistent storage…",exitDevelopment:"Exit development",fileUploaded:"Uploaded a file to the Sandbox",filesUploaded:"Uploaded {{count}} files to the Sandbox",intelligentDevelopment:"Intelligent development",mode:{readOnly:"Read only",workspaceWrite:"Workspace write",fullAccess:"Full access"},approvalPolicy:{untrusted:"Untrusted commands only",onRequest:"Ask when needed",never:"Never ask"},reviewer:{user:"Ask me",autoReview:"Automatic review"},labels:{approvalPolicy:"Approval policy",file:"File",fileNumber:"File {{number}}",mode:"Sandbox mode",networkAccess:"Network access",reviewer:"Approval method",workingDirectory:"Working directory"},network:{allowed:"Allowed",disabled:"Off"},permissionsUpdated:"Updated Codex permissions for this Sandbox session",persistenceUnknown:"Unable to verify persistent storage",stoppedReady:"Stopped. You can continue typing.",uploadedFilesPrompt:"The following files were uploaded to the current Sandbox workspace. Use them in this task:",workspaceUpdated:"Workspace updated"},e7e={addAgent:"Add Agent",addFromPackage:"Add from code package",agent:"Agent",automations:"Automations",createAgent:"Create Agent",createSkill:"Create Skill",cronJobs:"Cronjob",issueFeedback:"Issue feedback",library:"Library",migrateAgent:"Migrate Agent",newConversation:"New conversation",optimizeSkill:"Optimize {{name}}",search:"Search",skill:"Skill",skillLibrary:"Skill library",systemInfo:"System information",updateAgent:"Update {{name}}",codeProjects:"Code projects",reviewCenter:"Review center"},t7e={title:"Create from workspace",description:"Create and manage code projects, then develop and debug in VS Code"},r7e={actions:zBe,addAgent:UBe,approval:VBe,common:QBe,conversation:GBe,credentials:HBe,dialogs:WBe,errors:YBe,feedback:qBe,greetings:jBe,loading:XBe,oauth:KBe,providers:ZBe,sandbox:JBe,titles:e7e,workspaceProjectEntry:t7e},jcr=Object.freeze(Object.defineProperty({__proto__:null,actions:zBe,addAgent:UBe,approval:VBe,common:QBe,conversation:GBe,credentials:HBe,default:r7e,dialogs:WBe,errors:YBe,feedback:qBe,greetings:jBe,loading:XBe,oauth:KBe,providers:ZBe,sandbox:JBe,titles:e7e,workspaceProjectEntry:t7e},Symbol.toStringTag,{value:"Module"})),n7e="Automations",i7e="Connect development tools and extend your Agents with automated workflows",a7e="Search automations",o7e="Automation categories",s7e={development:"Development",channels:"Messaging channels"},l7e="{{category}} automations",c7e="Open {{name}}",u7e="Available only in local deployments",h7e="No matching automations",d7e="Try searching for another name",f7e="Back to automations",p7e={"coding-agents":{name:"Configure coding agents",badge:"Local",description:"Install built-in VeADK and AgentKit skills globally for Trae, Claude Code, or Codex."},template:{name:"Import starter project",description:"Create a minimal Agent project in your repository with continuous delivery to AgentKit Runtime.",title:"Import starter project",subtitle:"Add a ready-to-run basic Agent and continuous delivery configuration to your repository",panel:"This creates a pull request containing the basic project and AgentKit Runtime delivery workflow.",submitLabel:"Import template and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: import AgentKit basic template",description:"Import a basic Agent project with the AgentKit Studio App Server and add continuous delivery to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:"agentkit-basic-agent",help:"The basic project will be added here; app.py mounts the complete Studio App Server and serves as the entry point"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},delivery:{name:"AgentKit Runtime delivery",description:"Add a workflow that continuously delivers your repository to AgentKit Runtime.",title:"AgentKit Runtime delivery",subtitle:"Add continuous delivery to the repository through a pull request",panel:"This creates a release branch and opens a pull request containing the GitHub Actions workflow.",submitLabel:"Confirm and create PR",regionHelp:"Must match the target Runtime region",pullRequest:{title:"feat: continuously publish to AgentKit Runtime",description:"Add a GitHub Actions workflow that continuously publishes updates from the target branch to AgentKit Runtime. Configure the required {{provider}} secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},projectPath:{label:"Agent project directory",placeholder:".",help:"Defaults to the repository root; the directory must contain an app.py that mounts the complete Studio App Server"},runtimeName:{label:"Runtime name",placeholder:"support-agent",help:"Used by the AgentKit delivery configuration"},runtimeId:{label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"The AgentKit Runtime that will receive continuous updates"}}},review:{name:"Automated PR review",description:"Use a GitHub App to review pull requests in an isolated Sandbox.",title:"Automated PR review",subtitle:"Trigger Sandbox reviews through the GitHub App and publish results to pull requests",panel:"Install the GitHub App to target repositories, then enable automated review for each repository.",submitLabel:"Install GitHub App",regionHelp:"",pullRequest:{title:"chore: configure automated PR review",description:"Add a GitHub Actions workflow that reviews same-repository pull requests in an isolated Sandbox and publishes the result as a GitHub review. Configure the required workflow secrets before merging."},fields:{repository:{label:"GitHub Repo",placeholder:"owner/repository",help:"Enter owner/repository or a full github.com URL"},baseBranch:{label:"Target branch",placeholder:"main",help:"Defaults to main; the pull request will use this branch as its base"},sandboxToolId:{label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"The AgentKit CodeEnv used for each review"},modelName:{label:"Review model",placeholder:"review-model",help:"The code review model name injected into the Sandbox"},modelBaseUrl:{label:"Model API URL",placeholder:"https://ark.example.com/api/v3",help:"Must be an OpenAI-compatible HTTPS endpoint"}}},"gitlab-review":{name:"GitLab MR review",description:"Use a GitLab integration to review merge requests in an isolated Sandbox."},feishu:{name:"Feishu bot",badge:"Beta",description:"Create a Feishu bot and connect its messages directly to AgentKit Runtime."},"website-integration":{name:"Website integration",description:"Embed an AgentKit Runtime on your website as a floating chat window."}},g7e={required:"Required",optional:"Optional",region:"Region",tokenLabel:"GitHub Token",getToken:"Get token",createToken:"Create GitHub token",tokenPlaceholder:"Requires write access to repository contents and pull requests",tokenWorkflowPlaceholder:"Requires write access to contents, pull requests, and workflows",hideToken:"Hide token",showToken:"Show token",tokenHelp:"The token is used only for this submission. It is not stored in the browser or written to the pull request.",tokenWorkflowHelp:"This token is used only to create the configuration PR. It is not a general Sandbox requirement and is not stored in the browser or written to the PR.",prCreated:"PR #{{number}} created",configPrCreated:"Configuration PR #{{number}} created",configPrNextStep:"After it is merged, later pull requests in the same repository will trigger reviews automatically.",viewOnGitHub:"View on GitHub",viewConfigPr:"View configuration PR",secretsHeading:"Before merging the pull request, configure these GitHub Actions secrets in the repository:",secretsConfigHeading:"Before merging the configuration PR, add runtime secrets to the target repository",openSecrets:"Open Secrets settings",secretsPath:"Path: Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"A PR review configuration will be added for {{repository}}",repositoryReviewHelp:"GitHub App will validate pull requests for {{repository}}",secretPair:"{{accessKey}}, {{secretKey}} (required)",sessionToken:"{{sessionToken}} (required when using temporary credentials)",requiredSecret:"{{name}} (required)",temporaryCredentialRequired:" (required when using temporary credentials)",requiredSuffix:" (required)",submitting:"Creating PR…",validation:{required:"This field is required",repository:"Enter owner/repository or a full GitHub repository URL",baseBranch:"The target branch format is invalid",projectPath:"Enter a relative path within the repository",runtimeId:"The Runtime ID format is invalid",sandboxToolId:"The Sandbox Tool ID format is invalid",modelName:"The model name format is invalid",modelBaseUrlSafe:"Enter an HTTPS URL without credentials, query parameters, or fragments",modelBaseUrl:"Enter a valid HTTPS URL",runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}}},m7e={title:"Configure coding agents",description:"Install the AgentKit skills bundled with Studio globally for local coding clients.",retry:"Retry",clients:{ariaLabel:"Select coding agents",title:"Local clients",detectAgain:"Detect again",detecting:"Detecting local clients…",detected:"Client detected",available:"Available",unavailable:"Not detected"},skills:{ariaLabel:"Select bundled skills",title:"Bundled skills",viewFiles:"View files",items:{"veadk-agent-development":{name:"VeADK Agent development",description:"Build and refine Agents with VeADK."},"agentkit-cli":{name:"AgentKit CLI",description:"Manage and deploy AgentKit resources with AgentKit CLI."}}},global:{ariaLabel:"Global installation directories",title:"Global installation",description:"Available to other local projects after configuration",empty:"Select a client to see its installation directory."},success:"Configured {{skillCount}} skill(s) for {{agentCount}} client(s)",selection:"{{agentCount}} client(s) and {{skillCount}} skill(s) selected",selectClient:"Select a client first",configuring:"Configuring…",configure:"Configure",errors:{detect:"Failed to detect local clients",configure:"Configuration failed. Check permissions for your user directory and try again."},preview:{description:"Browse the skill files bundled with Studio in read-only mode",close:"Close file preview",loading:"Loading files…",error:"Failed to load skill files",skillFiles:"{{name}} files",files:"Files",fileContent:"File contents",notPreviewable:"This file is not previewable UTF-8 text.",noFiles:"No previewable files."}},v7e={title:"Feishu bot",description:"Create a Feishu Agent powered by AgentKit Runtime",panel:"Enter the credentials for a published Feishu app. Studio will generate a basic Agent, create a dedicated Runtime, and enable the persistent Feishu messaging connection.",agentName:"Agent name",agentNameHelp:"Used as the root Agent name in the new Runtime",region:"Deployment region",regionHelp:"The Runtime and build artifacts will be created in this region",regions:{"cn-beijing":"Beijing","cn-shanghai":"Shanghai"},appId:"Feishu App ID",appIdHelp:"Application credential from the Feishu Open Platform",appSecret:"Feishu App Secret",appSecretPlaceholder:"Enter the App Secret",appSecretHelp:"Written only to the environment variables of the new Runtime",hideSecret:"Hide App Secret",showSecret:"Show App Secret",hide:"Hide",show:"Show",confirmCancel:"Cancelling will stop the task and clean up any Runtime already created. Continue?",status:{preparing:"Generating the basic Agent",running:"Creating Runtime",cancelling:"Cancelling deployment",succeeded:"Feishu bot Runtime created",cancelled:"Deployment cancelled",failed:"Creation failed"},steps:{prepare:"Generate Agent",build:"Build image",deploy:"Create Runtime",publish:"Publish service"},openConsole:"Open Runtime console",credentials:{title:"Credential handling",description:"The App Secret is used only for this deployment. It is never written to generated source code or browser storage."},cancelDeployment:"Cancel deployment",creating:"Creating…",create:"Create Feishu bot Runtime",validation:{appId:"Enter the Feishu App ID",appSecret:"Enter the Feishu App Secret",agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name",characters:"Name must start with a letter or underscore and contain only letters, numbers, and underscores"}},generatedAgent:{description:"A helpful assistant that receives messages through Feishu.",instruction:"You are a helpful assistant serving users through Feishu. Understand each request accurately and provide concise, reliable answers. Ask clarifying questions when information is missing, and never invent facts."}},Xcr=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:f7e,cards:p7e,categories:s7e,categoriesLabel:o7e,codingAgents:m7e,default:{title:n7e,description:i7e,search:a7e,categoriesLabel:o7e,categories:s7e,resultsLabel:l7e,open:c7e,localOnly:u7e,emptyTitle:h7e,emptyDescription:d7e,backToAutomations:f7e,cards:p7e,github:g7e,codingAgents:m7e,feishu:v7e},description:i7e,emptyDescription:d7e,emptyTitle:h7e,feishu:v7e,github:g7e,localOnly:u7e,open:c7e,resultsLabel:l7e,search:a7e,title:n7e},Symbol.toStringTag,{value:"Module"})),y7e={"zh-CN":"简体中文","en-US":"English"},Kcr=Object.freeze(Object.defineProperty({__proto__:null,default:{languageNames:y7e},languageNames:y7e},Symbol.toStringTag,{value:"Module"})),b7e={selectedExcerptLabel:"Selected excerpt",commentLabel:"Annotation",commentSeparator:": ",successTitle:"Added to the Bad Case evaluation set",successDescription:"This annotation is linked to the current question and the complete model response.",done:"Done",ariaLabel:"Annotate the selected model response",title:"Add annotation",content:"Annotation",placeholder:"Describe the issue or the expected change",retryError:"{{error}}. Please try again.",cancel:"Cancel",submit:"Add to Bad Case"},x7e={attachment:"attachment",image:"image",preview:"Preview {{name}}",uploading:"Uploading",uploadFailed:"Upload failed",remove:"Remove {{name}}",previewDialog:"{{name}} preview",download:"Download",close:"Close",reading:"Loading document…",loadFailed:"Failed to load document: {{error}}"},w7e={errorTitle:"Cloud log error",copyError:"Copy complete error details",retry:"Retry",statuses:{live:"Live",connecting:"Connecting",retrying:"Reconnecting",idle:"Disconnected"},title:"Instance logs",description:"The VeFaaS instance handling the current conversation request",close:"Close instance logs",instanceId:"Instance ID",waitingInstance:"Waiting for instance",request:"Request {{id}}",ariaLabel:"Live VeFaaS instance logs",notCapturedTitle:"No instance captured yet",notCapturedDescription:"Send a message to see the instance that handles it and its live logs.",connectingTitle:"Connecting to instance logs",connectingDescription:"Establishing a secure log stream through the Studio BFF.",emptyTitle:"No logs yet",emptyDescription:"Connected to the instance and waiting for new log output.",retention:"Logs refresh automatically. Only the latest {{count}} lines are kept."},A7e={title:"Trace",statuses:{loading:"Loading",ready:"",collecting:"Collecting",disabled:"Disabled",forbidden:"Permission required",error:"Failed to load"},errors:{collecting:"The trace is still being collected. Please wait.",disabled:"Tracing is not enabled for this agent. Enable it in the console and try again.",forbidden:"Your account cannot read APMPlus traces. Ask an administrator for read access.",error:"Failed to load the trace. Please try again later."},callCount:"{{count}} calls · {{duration}} ms",close:"Close",loading:"Loading trace…",retryNow:"Retry now",reload:"Reload",empty:"No trace is available for this session yet.",attributes:"Attributes",selectCall:"Select a call on the left to view its details"},S7e={exportNote:"This conversation was exported from AgentKit Studio for reference only.",imageFailed:"Failed to generate the image. Please try again.",browserUnsupported:"This browser cannot generate a conversation image. Please try again.",copyUnsupported:"This browser cannot copy images. Download the image instead.",exportFailed:"Export failed. Please try again.",title:"Export conversation",description:"Choose a format and download all inputs and outputs through the current response.",close:"Close",generatingContent:"Preparing export…",retry:"Try again",previewPage:"Previewing page 1 of {{count}}",previewAlt:"Conversation export page 1 of {{count}}",format:"Export format",generatingFormat:"Generating {{format}}…",copying:"Copying…",copiedFirst:"First page copied",copied:"Copied",copyFirst:"Copy first page",copyImage:"Copy image",generating:"Generating…",downloadArchive:"Download PNG archive ({{count}} pages)",downloadFormat:"Download {{format}}"},T7e={unsupportedComponent:"Unsupported component: {{component}}",sandboxIdentity:"Codex Sandbox execution identifiers",useSkill:"Use the {{name}} skill",thinkingDone:"Finished thinking",thinking:"Thinking",justNow:"Just now",sourceUnavailable:"The generated source is temporarily unavailable. Please try again later.",downloadStarted:"Download started",verifiedDelivery:"Verified deliverable",generatedSource:"Generated agent source",entryPoint:"Entry point",fileCount:"Files",size:"Size",validationTime:"Validated",generationTime:"Generated",checksPassed:"{{count}} checks passed",sourceReady:"Source is ready to deploy",sourceGuidance:"The source is ready to view, download, or deploy. Confirm the runtime configuration before deployment.",viewSource:"View source",preparing:"Preparing…",viewChanges:"View changes",downloadSource:"Download source",sourceNotReady:"The source is not ready yet",manualDeploy:"Deploy manually to Runtime",deployAgent:"Deploy Agent",beforeOptimization:"Before optimization",afterOptimization:"After optimization",planStatuses:{pending:"Pending",in_progress:"In progress",completed:"Completed",failed:"Incomplete"},renderUi:"Render UI",truncated:"… (truncated)",agentAdjusting:"Agent is adjusting",sandboxDetails:"Detailed Codex Sandbox output",waitingCodex:"Waiting for Codex output",arguments:"Arguments",result:"Result",artifacts:"Artifacts",downloadNamed:"Download {{name}}",powerpoint:"PowerPoint presentation",preview:"Preview",download:"Download",previewDialog:"{{name}} preview",closePreview:"Close preview",slidePreview:"{{name}} slide preview",mcpToolset:"MCP toolset",authorized:"Authorized · {{tool}}",authorizationRequired:"{{tool}} requires authorization",oauthDescription:"The {{tool}} toolset is protected by OAuth and requires sign-in before use.",oauthProvider:"You will be redirected to {{provider}} to sign in.",oauthContinue:"The conversation will continue automatically after authorization.",waitingAuthorization:"Waiting for authorization…",authorize:"Authorize",missingAuthorizationUrl:"No authorization URL was found in the event.",tools:{web_search:{running:"Searching the web",done:"Web search complete"},link_reader:{running:"Reading webpage",done:"Webpage read complete"},run_code:{running:"Running code in the AgentKit sandbox",done:"Code execution completed in the AgentKit sandbox"},list_envs:{running:"Checking available environments",done:"Available environments loaded"},get_env_manifest:{running:"Loading the environment manifest",done:"Environment manifest loaded"},execute_in_sandbox:{running:"Running a command in the environment",done:"Command completed in the environment"},delegate_to_codex_sandbox:{running:"Codex Sandbox is running",done:"Codex Sandbox completed",failed:"Codex Sandbox failed"},image_generate:{running:"Generating image",done:"Image generated"},video_generate:{running:"Generating video",done:"Video generated"},ppt_generate:{running:"Generating presentation",done:"Presentation generated"},load_memory:{running:"Searching long-term memory",done:"Memory search complete"},load_knowledgebase:{running:"Searching the knowledge base",done:"Knowledge base search complete"},load_skill:{running:"Loading skill",done:"Skill loaded"},collect_resources:{running:"Collecting available resources",done:"Resource collection complete",failed:"Resource collection failed"},create_agents:{running:"Creating and running agents",done:"Agent creation complete",failed:"Agent creation failed"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit Skill Center",knowledge_base:"Knowledge base",tool:"Tools"},agentTypes:{llm:"LLM Agent",sequential:"Sequential Agent",parallel:"Parallel Agent",loop:"Loop Agent",workflow:"Workflow"},skill:"Skill",subAgents:"Sub-agents",builtinTool:"Built-in tool",skillCenter:"AgentKit Skill Center",selfAuthoredTools:"Custom tools",dependencies:"Dependencies: {{items}}",fullCode:"Complete code for {{name}}",itemCount:"{{label}}: {{count}} items",collectionAria:"Retrieved resource information",retrieving:"Retrieving resources",retrievalFailed:"Resource retrieval did not complete",checkConfig:"Check the resource service configuration and try again.",notSearched:"Not searched",notConfigured:"Not configured",resourceList:"{{label}} resource list",searchKeywords:"Search keywords",skillHubSkipped:"No search keywords were provided, so Skill Hub was not searched.",sourceSkipped:"{{label}} is not configured, so this source was not searched.",noResources:"No resources in this category were returned.",resultAria:"Agent creation results",creationFailed:"Agent creation did not complete",agentResources:"Resources available to {{name}}",knowledgeBase:"Knowledge base",toolsLabel:"Tools",creating:"Creating agents",noAgents:"No agents to display",noAgentResult:"The tool response did not include an agent configuration or execution result.",sourceLabels:{tool:"Tools",knowledge:"AgentKit Knowledge Base",skillCenter:"AgentKit Skill Center",unknown:"Unknown source"},unnamedResource:"Unnamed resource",unnamedAgent:"Unnamed agent"},branchCompare:{ariaLabel:"Compare branches",selectDirection:"Select a direction",continue:"Continue in this direction"},codexProgress:{planTitle:"Codex execution plan",fallback:{fileChange:"Modify files",approval:"Waiting for approval",status:"Codex status",command:"Run command"},planSummary:"{{completed}}/{{total}} completed",command:{running:"Running command",completed:"Command completed",failed:"Command failed"},projectFiles:"{{count}} project files",projectFile:"project files",fileChange:{running:"Updating {{subject}}",completed:"Updated {{subject}}",failed:"Failed to update {{subject}}"},externalTool:"external tool",mcp:{running:"Calling {{tool}}",completed:"Called {{tool}}",failed:"{{tool}} call did not complete"},collaboration:{spawn_agent:{running:"Starting subtask",completed:"Subtask started",failed:"Failed to start subtask"},send_input:{running:"Sending information to subtask",completed:"Information sent to subtask",failed:"Failed to send information to subtask"},wait:{running:"Waiting for subtask",completed:"Subtask wait complete",failed:"Subtask wait failed"},close_agent:{running:"Ending subtask",completed:"Subtask ended",failed:"Failed to end subtask"},default:{running:"Coordinating subtasks",completed:"Subtask collaboration complete",failed:"Subtask collaboration failed"}},webSearch:{running:"Searching the web",completed:"Web search complete",failed:"Web search did not complete"},errorDetail:"Codex execution did not complete.",errorTitle:"Codex encountered an error"}},C7e={segments:{system:"System and tools",input:"Input and history",output:"Output and reasoning",remaining:"Remaining"},modelUnavailable:"Model information unavailable",promptWithSystem:"Prompt (including system)",systemUnknown:"System and tool usage unknown",systemApprox:"System and tools approximately {{count}} tokens",ariaKnown:"Context {{percentage}}% used, {{system}}, {{inputLabel}} {{input}} tokens, output and reasoning {{output}} tokens, remaining {{remaining}} tokens",ariaUnknown:"{{model}}, context window unknown, {{count}} cumulative session tokens used",composition:"Context composition",percentageUsed:"{{percentage}}% used",gridAria:"100-cell context composition chart. Each cell represents one percent of the context window.",estimated:"Estimated",unknown:"Unknown",summaryPercentage:"{{used}} used, {{remaining}} remaining",summaryTokens:"{{used}} used, {{remaining}} remaining, {{total}} total",overflow:"Context exceeded by {{count}} tokens",title:"Context usage",unknownModel:"The context window for this model is not available",unknownRuntime:"The current runtime did not provide model information"},O7e={title:"Add AgentKit agent",noAgents:"Connected successfully, but no agents were found at this address (/list-apps was empty).",connectionFailed:"Connection failed: {{error}}. Check the URL, API key, and whether the gateway allows cross-origin requests.",description:"Enter the URL and API key of an AgentKit deployment to connect through the ADK protocol. Connected agents will appear in the selector in the upper-left corner.",url:"Endpoint URL",apiKeyHint:"Connect using Authorization: Bearer",displayName:"Display name (optional)",displayNameHint:"Uses the URL hostname by default",cancel:"Cancel",connecting:"Connecting…",connect:"Connect and add"},k7e={placeholder:"Type a message…",inputAria:"Message",generating:"Generating",send:"Send"},E7e={ariaLabel:"Invocation context for this turn",removeSkill:"Remove skill {{name}}",removeAgent:"Remove agent {{name}}"},_7e={cardAria:"{{label}} chart",viewAria:"{{label}} display mode",preview:"Preview",code:"Code",invalidEcharts:"The ECharts configuration is not a valid, safe data object. Switch to Code to inspect it.",renderFailed:"The chart cannot be rendered right now. Switch to Code to inspect it.",echartsAria:"ECharts preview",rendering:"Rendering chart…",mermaidFailed:"The chart cannot be rendered right now. Switch to Code to inspect the Mermaid source.",mermaidAria:"Mermaid preview"},R7e={playVideo:"Play video: {{name}}",enlargeImage:"Enlarge image preview: {{name}}",image:"image",enlargeVideo:"Enlarge video",videoPreview:"Video preview",downloadVideo:"Download video",close:"Close"},D7e={annotation:b7e,media:x7e,runtimeLogs:w7e,trace:A7e,share:S7e,blocks:T7e,tokenUsage:C7e,addAgentKit:O7e,composer:k7e,invocation:E7e,visualization:_7e,markdown:R7e},Zcr=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:O7e,annotation:b7e,blocks:T7e,composer:k7e,default:D7e,invocation:E7e,markdown:R7e,media:x7e,runtimeLogs:w7e,share:S7e,tokenUsage:C7e,trace:A7e,visualization:_7e},Symbol.toStringTag,{value:"Module"})),L7e={back:"Back",cancel:"Cancel",deploy:"Deploy",delete:"Delete",loading:"Loading…",next:"Next",notSupported:"Not supported",previous:"Previous",required:"Required",retry:"Retry",actions:"Actions",value:"Value",disabled:"Off",enabled:"Enabled",none:"None",close:"Close",name:"Name",description:"Description",send:"Send"},M7e={heading:"VeADK agent structure configuration",importHint:"Reload this file from Import YAML on the Create Agent page."},I7e={agentName:{required:"Name is required",reserved:"user is reserved by Google ADK. Choose another name.",characters:"Start with a letter or underscore and use only letters, numbers, and underscores"},runtimeName:{required:"Runtime name is required",characters:"Runtime name can contain only letters, numbers, underscores, and hyphens",length:"Runtime name must be 4–64 characters"}},P7e={description:"A VeADK-powered assistant that understands user intent and uses the right tools to complete tasks.",instruction:`You are a professional and reliable assistant. Your goal is to understand the user's request accurately and provide clear, concise, and useful answers. @@ -71,7 +71,7 @@ Original error: {{message}}`,unavailable:"Connection unavailable",requestFailed: 原始响应: {{response}}`,errorWithRawResponse:`{{context}} 原始响应: -{{response}}`,loadArkApiKeysFailed:"加载 Ark API Key 失败",loadModelsFailed:"加载模型列表失败",runtimeAccessDenied:"当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。",privateRuntimeUnavailable:"Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",runtimeTemporarilyUnavailable:"Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",runtimeConnectionUnsupported:"该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",runtimeConnectionDenied:"Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。",listAgentsFailed:"读取 Agent 列表失败",invalidListAppsJson:"Runtime /list-apps 返回了无法解析的 JSON 响应。",invalidListAppsFormat:"Runtime /list-apps 返回格式无效,应为非空字符串数组。",createSessionFailedWithStatus:"创建会话失败 ({{status}})",createSessionFailed:"创建会话失败",getSessionFailed:"读取会话失败",getSessionFailedWithDetail:"读取会话失败:{{status}}:{{detail}}",feedbackRuntimeOnly:"只有连接到 AgentKit Runtime 的会话支持反馈回流",feedbackRegionMissing:"Runtime 缺少地域信息,无法提交反馈",submitFeedbackFailed:"提交反馈失败",loadEvaluationSetsFailed:"读取评测集失败",loadAutoEvaluationStatusFailed:"读取自动评测状态失败",loadOptimizationsFailed:"读取优化项失败",deleteEvaluationCaseFailed:"删除评测案例失败",downloadFileFailed:"下载文件失败",fileUnavailable:"文件内容不可用",uploadFileFailed:"文件上传失败",traceDisabled:"该 Agent 暂未开启链路观测,请到控制台打开后使用。",loadTraceFailed:"加载调用链路失败",contentTypeMissing:"Content-Type 缺失",traceNonJson:"加载调用链路失败:服务端返回了非 JSON 响应({{contentType}}),请检查 Studio API 代理配置",invalidTraceFormat:"加载调用链路失败:返回格式无效",submitIssueFeedbackFailed:"问题反馈上报失败",issueFeedbackNotConfirmed:"问题反馈上报失败:服务端未确认提交结果",noPreviewableAgent:"该 Runtime 未提供可预览的 Agent。",agentSearchFailed:"Agent 检索失败",emptySseBody:"HTTP 200,SSE 响应体为空。",noDisplayableSseReply:"HTTP 200,SSE 响应中没有可展示的模型回复。",firstSseEventTimeout:"60 秒内未收到首个 SSE 事件。请稍后重试,或查看 Runtime、模型、网关日志定位原因。",runSessionFailed:"运行会话失败",runSseFailedWithDetail:"运行会话失败:{{status}}:{{detail}}",checkRuntimeNameFailed:"检查 Runtime 名称失败",invalidRuntimeNameCheck:"检查 Runtime 名称失败:服务返回格式错误",loadCloudResourcesFailed:"加载云资源失败",invalidCloudResources:"云资源列表响应格式无效",invalidEnvironmentMount:"挂载环境响应格式无效",environmentMountMismatch:"挂载环境响应与请求不一致",environmentMountNetworkFailed:"无法连接 Studio 服务,环境挂载未完成。请检查网络后重试。",environmentMountFailed:"挂载环境失败",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",clipboardWriteFailed:"无法写入剪贴板,请检查剪贴板权限。",loadSystemInfoFailed:"加载系统信息失败",invalidSystemInfo:"系统信息响应格式无效",invalidEnvironmentBuild:"环境构建响应格式无效",invalidEnvironmentBuildStep:"环境构建步骤响应格式无效",invalidEnvironmentManifest:"环境 Manifest 响应格式无效",invalidImageRepository:"环境镜像仓库响应格式无效",invalidCodeRepository:"环境代码仓库响应格式无效",invalidImageSource:"环境镜像来源响应格式无效",invalidEnvironment:"环境响应格式无效",invalidWorkspace:"工作区响应格式无效",loadWorkspacesFailed:"加载工作区失败",invalidWorkspaceList:"工作区列表响应格式无效",saveWorkspaceFailed:"保存工作区失败",deleteWorkspaceFailed:"删除工作区失败",loadEnvironmentsFailed:"加载环境失败",invalidEnvironmentList:"环境列表响应格式无效",probeRepositoryFailed:"探查代码仓库失败",invalidRepositoryProbe:"代码仓库探查响应格式无效",exportEnvironmentCodeFailed:"导出环境分享码失败",invalidEnvironmentCode:"环境分享码响应格式无效",inspectEnvironmentCodeFailed:"检测环境分享码失败",invalidEnvironmentCodeInspection:"环境分享码检测响应格式无效",importEnvironmentCodeFailed:"导入环境分享码失败",invalidEnvironmentCodeImport:"环境分享码导入响应格式无效",studioUnavailable:"无法连接 Studio 服务,请确认后端已启动后重试。",saveEnvironmentFailed:"保存环境失败",deleteEnvironmentFailed:"删除环境失败",startEnvironmentBuildFailed:"启动环境构建失败",loadEnvironmentBuildFailed:"读取环境构建详情失败",loadEnvironmentManifestFailed:"读取环境 Manifest 失败",invalidEnvironmentResource:"环境资源响应格式无效",loadEnvironmentResourcesFailed:"加载环境构建资源失败",updateCodexSandboxFailed:"更新 Codex Sandbox 失败",invalidCodexSandboxUpdate:"Codex Sandbox 更新响应格式无效",loadUserPoolsFailed:"加载用户池失败",invalidUserPoolList:"用户池列表响应格式无效",syncGithubFailed:"同步 GitHub 代码失败 ({{status}})",validatingMigrationArtifact:"正在校验迁移产物",uploadingCodePackage:"正在上传代码包",migrationArtifactValidated:"迁移产物校验完成",codePackageUploaded:"代码包上传完成",deploymentProgress:{preparing:"正在准备部署",uploading:"正在上传代码包",building:"正在构建镜像",buildLogsSyncing:"正在构建镜像,构建日志已同步。",buildLogsComplete:"构建日志同步完成。",buildFailedLogsSynced:"镜像构建失败,最终构建日志已同步。",buildLogsUnavailable:"暂时无法读取构建日志。",finalBuildLogsUnavailable:"暂时无法读取最终构建日志。",deploying:"正在部署服务",publishing:"正在发布服务",evaluating:"正在创建评测集",updating:"正在更新 Runtime 配置",completing:"正在完成部署",github:"正在配置 GitHub 持续交付",inProgress:"正在部署"},deploymentFailed:"部署失败",deploymentDisconnected:"部署失败:连接中断",deploymentMissingAgentName:"部署失败:返回缺少 Agent 名称",deploymentMissingConnection:"部署失败:返回缺少 AgentKit 连接信息",cancelDeploymentFailed:"取消部署失败 ({{status}})",loadFailed:"加载失败 ({{status}})",loadPermissionsFailed:"加载权限失败 ({{status}})",invalidPermissionResponse:"权限服务返回了无法解析的响应",checkStudioUpdateFailed:"检查 Studio 更新失败 ({{status}})",studioUpdatePreflightFailed:"Studio 更新权限预检失败 ({{status}})",submitStudioUpdateFailed:"提交 Studio 更新失败 ({{status}})",loadAgentUsageFailed:"加载 Agent 用量失败",notProvided:"未提供",agentUsageNonJson:"加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP {{status}},Content-Type: {{contentType}})。",checkStudioGateway:"请确认当前服务以 Studio 模式启动,并检查代理或网关配置。",agentUsageInvalidJson:"加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP {{status}},Content-Type: {{contentType}})。",retryCheckGateway:"请稍后重试;若问题持续,请检查代理或网关配置。",loadCronJobsFailed:"加载定时任务失败",loadCronJobFailed:"加载定时任务详情失败",createCronJobFailed:"创建定时任务失败",updateCronJobFailed:"更新定时任务失败",enableCronJobFailed:"启用定时任务失败",pauseCronJobFailed:"暂停定时任务失败",runCronJobFailed:"立即执行定时任务失败",loadCronHistoryFailed:"加载执行历史失败",stopCronRunFailed:"终止执行失败",deleteCronJobFailed:"删除定时任务失败",loadRuntimeFailed:"加载 Runtime 失败",loadLocalToolsFailed:"读取本地工具失败",connectDynamicRouteFailed:"连接 Studio 动态路由失败",a2aProbeDenied:"Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。",loadA2aCardFailed:"读取 A2A Agent Card 失败",loadRuntimeApiKeyFailed:"读取 Runtime API Key 失败",runtimeApiKeyMissing:"Runtime 未返回可用的 API Key",loadMcpCredentialsFailed:"读取 MCP 认证信息失败",invalidMcpCredentials:"Studio 返回的 MCP 认证信息格式无效",deleteFailed:"删除失败 ({{status}})",runtimeManageForbidden:"当前账号没有管理该 Runtime 的权限。",runtimeNotFound:"该 Runtime 不存在或已被删除。",runtimeUnavailable:"当前账号无法访问该 Runtime。",checkRuntimeUpdateFailed:"检查 Runtime 更新能力失败(HTTP {{status}}),请稍后重试。",loadRuntimeDetailFailed:"加载 Runtime 详情失败",generateProjectFailed:"生成项目失败",generateAgentConfigFailed:"生成 Agent 配置失败",createDebugRunFailed:"创建调试运行失败",createDebugSessionFailed:"创建调试会话失败",loadDebugTraceFailed:"加载调试调用链路失败",invalidDebugTrace:"加载调试调用链路失败:返回格式无效",debugRunFailed:"调试运行失败",cleanupDebugRunFailed:"清理调试运行失败"},WUe={loadFailed:"读取会话模式能力失败(HTTP {{status}})",invalidResponse:"会话模式能力响应格式错误"},YUe={nonJson:"{{fallback}}:服务端返回非 JSON 响应(HTTP {{status}},{{contentType}}){{detail}}"},qUe={busy:"工作区正在处理较多请求,请稍后重试",notFound:"工作区不存在",duplicates:"检测到多个个人工作区会话,请联系管理员处理",timeout:"工作区恢复超时,项目仍保留,请重试",unavailable:"工作区暂时无法恢复,原项目仍保留,请重试",persistence:"当前 Sandbox 未启用持久化快照,请检查工作区配置",startup:"个人工作区启动失败,请检查 Sandbox 状态",exists:"项目名称已存在,请从项目列表打开",directory:"项目目录不存在",configuration:"请先配置工作区 Sandbox 镜像",state:"暂时无法确认工作区状态,请重试",list:"恢复工作区或读取项目列表失败,请重试",create:"项目初始化失败,请确认镜像可用后重试",open:"恢复工作区或打开项目失败,请重试",connection:"工作区暂时无法连接,请重试",invalidWorkspaceUrl:"工作区返回了无效的访问地址",operation:"项目操作失败,请重试",invalidProjectUrl:"项目访问地址无效",listFallback:"读取项目列表失败",connectionState:"暂时无法连接工作区,请重试"},jUe={reporting:"正在补齐交付信息",packaging:"正在整理产物",savingVersion:"正在保存版本",finishing:"正在完成请求",submitResult:"提交构建结果",requestFailed:"任务请求失败,请重试。",invalidResponse:"任务状态响应无效。",eventGap:"正在补齐任务输出。",reconnecting:"连接暂时中断,正在重连。已有输出已保留。",input:{pending:"等待送达",sending:"正在确认送达",delivered:"已送达",withdrawn:"已停止发送"},plan:"执行计划",diff:"文件变更",preparing:"正在准备任务",preparingEnvironment:"正在准备开发环境…",connectingEnvironment:"正在连接开发环境…",processing:"正在处理请求",thinking:"正在思考",read:"读取文件 · {{target}}",listFiles:"查看目录 · {{target}}",search:"搜索 · {{target}}",command:"执行命令 · {{target}}",editFiles:"修改文件 · {{target}}",webSearch:"搜索网页 · {{target}}",processSummary:"已处理 {{count}} 项",duration:"{{seconds}} 秒",durationUnits:{milliseconds:"{{value}} 毫秒",hours:"{{value}} 小时",minutes:"{{value}} 分",seconds:"{{value}} 秒"},failedTools:"{{count}} 项执行失败",toolFailed:"执行失败",toolCalls:"{{count}} 次工具调用",turnDuration:"本轮耗时 {{duration}}",toolDuration:"工具累计耗时 {{duration}}",toolDurationPartial:"已记录工具耗时 {{duration}}",toolDurationHelp:"各工具执行耗时之和;并行调用可能使累计耗时超过本轮耗时。",turnStatus:{completed:"已完成",failed:"未完成",interrupted:"已中断",cancelled:"已中断",unavailable:"任务已结束"},notReported:"未上报",partial:"已记录",partialHelp:"本轮记录可能不完整。",tokenDetails:"本轮 Token 用量",model:"本轮模型",totalTokens:"总量",inputTokens:"输入",cachedInputTokens:"缓存命中输入",uncachedInputTokens:"未命中输入",cacheWriteInputTokens:"缓存写入",outputTokens:"输出",reasoningOutputTokens:"推理输出",cacheHitRate:"输入缓存命中率",tokenHelp:"缓存命中属于输入,推理输出属于输出,不重复计入总量。未命中输入 = 输入 − 缓存命中。"},XUe={common:OUe,agentkitCli:kUe,cloudRegion:EUe,connections:_Ue,feishuBot:RUe,requestError:DUe,runSse:LUe,runtimeLogs:MUe,search:IUe,skills:PUe,sse:NUe,identity:BUe,github:$Ue,video:FUe,websiteIntegration:zUe,knowledge:UUe,intelligentDevelopment:VUe,migrations:QUe,sandbox:GUe,client:HUe,newChatCapabilities:WUe,jsonResponse:YUe,workspaceProjects:qUe,developmentRuns:jUe},pur=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:kUe,client:HUe,cloudRegion:EUe,common:OUe,connections:_Ue,default:XUe,developmentRuns:jUe,feishuBot:RUe,github:$Ue,identity:BUe,intelligentDevelopment:VUe,jsonResponse:YUe,knowledge:UUe,migrations:QUe,newChatCapabilities:WUe,requestError:DUe,runSse:LUe,runtimeLogs:MUe,sandbox:GUe,search:IUe,skills:PUe,sse:NUe,video:FUe,websiteIntegration:zUe,workspaceProjects:qUe},Symbol.toStringTag,{value:"Module"})),KUe="智能体审核",ZUe="申请企业内全员使用,审批后生效",JUe="关闭",eVe="刷新",tVe="状态",rVe="申请人",nVe="申请时间",iVe="当前版本",aVe="模型",oVe="退回人",sVe="通过人",lVe="审批时间",cVe="智能体描述",uVe="申请说明",hVe="退回理由",dVe="审批意见",fVe="退回理由(必填)",pVe="提交后内容已变化,请退回并重新申请",gVe="撤回后可以修改 Agent,需要公开时重新申请",mVe="取消公开后其他用户将无法继续使用,确定取消公开吗?",vVe="取消",yVe="确认",bVe="正在保存",xVe="取消公开",wVe="撤回申请",AVe="通过",SVe="直接公开",TVe="申请公开",CVe="全员可见",OVe={pending:"待审核",approved:"已通过",returned:"已退回",withdrawn:"已撤回"},kVe="搜索智能体或申请人",EVe="地域",_Ve="全部状态",RVe="智能体",DVe="操作",LVe="查看并审批",MVe="申请详情",IVe="没有符合条件的申请",PVe="暂无智能体审核申请",NVe="{{count}} / {{limit}} 字",gur=Object.freeze(Object.defineProperty({__proto__:null,actions:DVe,agent:RVe,all:_Ve,approve:AVe,approvedBy:sVe,cancel:vVe,close:JUe,comment:dVe,confirm:yVe,contentChanged:pVe,default:{title:KUe,dialogDescription:ZUe,close:JUe,refresh:eVe,statusTitle:tVe,submitter:rVe,submittedAt:nVe,version:iVe,model:aVe,returnedBy:oVe,approvedBy:sVe,reviewedAt:lVe,description:cVe,message:uVe,reason:hVe,comment:dVe,reasonRequired:fVe,contentChanged:pVe,withdrawConfirm:gVe,unpublishConfirm:mVe,cancel:vVe,confirm:yVe,saving:bVe,unpublish:xVe,withdraw:wVe,return:"退回",approve:AVe,publish:SVe,submit:TVe,private:"仅自己可见",enterprise:CVe,status:OVe,search:kVe,region:EVe,all:_Ve,agent:RVe,actions:DVe,review:LVe,details:MVe,noMatches:IVe,empty:PVe,textCount:NVe},description:cVe,details:MVe,dialogDescription:ZUe,empty:PVe,enterprise:CVe,message:uVe,model:aVe,noMatches:IVe,publish:SVe,reason:hVe,reasonRequired:fVe,refresh:eVe,region:EVe,returnedBy:oVe,review:LVe,reviewedAt:lVe,saving:bVe,search:kVe,status:OVe,statusTitle:tVe,submit:TVe,submittedAt:nVe,submitter:rVe,textCount:NVe,title:KUe,unpublish:xVe,unpublishConfirm:mVe,version:iVe,withdraw:wVe,withdrawConfirm:gVe},Symbol.toStringTag,{value:"Module"})),BVe={backToEvaluationCase:"返回评测案例",cancel:"取消",copied:"已复制",copy:"复制",exportConversation:"导出会话",retry:"重试"},$Ve={title:"您想以哪种方式添加 Agent 来运行?",subtitle:"选择最适合你的方式,下一步即可开始",quickCreate:{title:"从 0 快速创建",description:"用智能、自定义、模板或工作流的方式从零创建一个 Agent。"},intelligent:{title:"智能模式",description:"描述目标,按你的意图构建、调试并验证 Agent。"},package:{title:"从代码包添加和部署",description:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。"},migrate:{title:"从存量迁移",description:"从您的 LangChain、Dify 等存量项目迁移至 AgentKit Runtime。"}},FVe={subject:{file:"文件修改",command:"命令执行"},decision:{accept:"已允许本次{{subject}}",acceptForSession:"已在本会话中允许{{subject}}",decline:"已拒绝{{subject}}",cancel:"已取消{{subject}}审批"},details:{command:"命令",grantRoot:"授权路径",cwd:"执行目录"}},zVe={noDescription:"暂无描述",region:"地域",unknownAgent:"未知 Agent"},UVe={agentTransfer:"智能体移交",annotationHint:"模型回复;选中文字后可添加批注",continueBranch:"继续“{{branch}}”这个方向",emptyResponse:"本次没有返回可显示的内容。",subagentDescription:"正在执行主 Agent 移交的任务。"},VVe={title:"需要配置 {{provider}} AK/SK",prefix:"智能体工作台需要 {{provider}} 凭据才能使用。请在运行环境中设置",and:"与",suffix:"后重试。"},QVe={buildRunning:{title:"当前构建仍在进行",description:"离开将停止本轮构建;当前会话仍会保留,可稍后从历史会话重新进入。",confirm:"停止并离开"},deleteThread:{title:"删除 Codex 历史会话",description:"将删除“{{name}}”,并从历史会话中移除。",confirm:"确认删除"},returnToCreate:{title:"返回创建首页?",description:"返回后当前填写的内容将会丢失,确定要返回吗?",confirm:"确定返回"}},GVe={additionalAgentDeleteFailures:";另有 {{count}} 个失败",agentDeleteFailures:"{{count}} 个 Agent 删除失败:{{failures}}{{suffix}}",agentToolsMissing:"当前 Agent 缺少任务工具:{{tools}}",buildStopUnconfirmed:"已离开开发环境,但未能确认本轮构建已停止。任务可能仍在运行,请稍后从历史会话检查状态。",builtinAgentSendFailed:"内置智能体发送失败:{{message}}",bytePlusEvaluationUnsupported:"BytePlus 暂不支持 AgentKit 评测集",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",cloudCodexEmptyReply:"云端 Codex 已结束,但没有生成回复,请重新发送任务。",cloudCodexSessionMissing:"云端 Codex Session 暂未出现在列表中,请稍后重试。",deploymentRuntimeIdMissing:"部署完成,但未返回 Runtime ID。",environmentExpired:"所选环境已失效,请刷新后重新选择。",environmentsLoadFailed:"读取环境失败",evaluationCaseSessionMissing:"这条案例缺少会话定位信息,无法跳转。",evaluationUnsupportedForReply:"当前回复暂不支持加入评测集",firstFrameRequired:"首尾帧生成需要先添加首帧图片。",incompletePromptOptimization:"提示词优化结果不完整,请重新优化后再试。",intelligentCapabilityCheckFailed:"智能开发能力检查失败(HTTP {{status}})",intelligentSessionCreateFailed:"智能开发会话创建失败",invalidIntelligentCapability:"智能开发模型能力格式错误。",localBffToolsNotConfigured:"本地 Studio BFF 没有配置工具。",localToolsLoadFailed:"读取本地工具失败",loginPopupBlocked:"登录窗口被浏览器拦截,请允许弹出窗口后重试。",loginPopupClosed:"登录窗口已关闭,请重新登录以继续当前操作。",mediaTooLarge:"{{fileName}} 超出当前平台允许的素材大小。",mountEnvironmentFailed:"挂载环境失败",noConnectedSandbox:"当前没有已连接的 Sandbox。",noCreateAgentPermission:"当前账号没有添加 Agent 的权限。",noManageAgentPermission:"当前账号没有管理 Agent 的权限。",noOptimizationBaseline:"当前版本没有可对比的优化前版本。",oauthUrlMissing:"事件中没有授权地址。",onlyCloudAgentUpdatable:"仅支持更新已部署的云端智能体。",optimizationVersionMissing:"无法找到本次优化对应的项目版本,可能已被删除。",persistentStorageNotConfigured:"管理员未配置持久化存储",readDraftFailed:"无法读取本机草稿,请稍后重试。",runtimeAgentNameMissing:"Runtime 缺少智能体名称,无法更新。",runtimeBffToolsDisabled:"当前 Runtime Agent 未开启 BFF 工具能力。",runtimeDeploymentConfigUnavailable:"该 Runtime 的原发布配置不可恢复,无法安全更新。",runtimeMissingForConnection:"缺少 Runtime 信息,无法连接智能体。",runtimeRegionMissingForDelete:"Runtime 缺少地域信息,无法删除",runtimeRegionMissingForUpdate:"Runtime 缺少地域信息,无法更新。",runtimeUpdateUnsupported:"当前 Runtime 不支持原地更新。",sandboxRuntimeUnavailable:"当前 Agent 没有可用的 Sandbox Runtime。",sandboxToolsUnavailable:"当前 Studio BFF 未提供 Sandbox 执行工具。",saveDraftLocationRejected:"浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。",saveDraftRejected:"浏览器拒绝保存草稿,请稍后重试。",selectSkillToOptimize:"请先选择需要优化的 Skill。",sessionMissingForMount:"当前会话不存在,无法挂载环境。",sessionNotReady:"会话尚未就绪。",sessionUnavailable:"当前会话不可用,请关闭后重试。",sourceNotReady:"该源码尚未准备好,请返回对话继续处理。",textVideoRejectsReferences:"文生视频不使用参考素材,请先移除已添加的图片或视频。",videoEditRequiresVideo:"视频编辑需要先添加待编辑视频。",videoExtendRequiresVideo:"视频续写需要先添加基础视频。",videoGenerationFailed:"视频生成失败,请稍后重试。",videoModeUnsupported:"当前平台暂不支持所选视频任务模式。",videoPreviewMissing:"视频任务已完成,但服务端未返回预览地址。",videoReferenceRequired:"参考素材生视频需要至少添加一项参考图片或参考视频。"},HVe={like:"赞",removeLike:"取消点赞",dislike:"踩",removeDislike:"取消点踩",reportIssue:"问题反馈",traceFlameGraph:"Tracing 火焰图"},WVe={0:"今天想做点什么?",1:"有什么可以帮你的?",2:"需要我帮你查点什么吗?",3:"有问题尽管问我",4:"嗨,我们开始吧",5:"开始一段新对话吧",6:"今天想先解决哪件事?",7:"把你的想法告诉我吧",8:"我们从哪里开始?",9:"有什么任务交给我?",10:"准备好一起推进了吗?",11:"说说你现在最关心的问题",12:"今天也一起把事情做好",13:"我在,随时可以开始",intelligentDevelopment:"让灵感自由生长"},YVe={agentCapabilities:"正在检查 Agent 能力…",session:"加载会话…"},qVe={cancelled:"授权已取消。",pasteCallbackUrl:"授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:",popupBlocked:"弹窗被拦截,请允许弹窗后重试。",unsupportedUrl:"授权链接不是 http/https 地址,已阻止打开。"},jVe={volcengine:"火山引擎"},XVe={checkingPersistence:"正在检查持久化能力…",exitDevelopment:"退出开发环境",fileUploaded:"已上传文件到 Sandbox",filesUploaded:"已上传 {{count}} 个文件到 Sandbox",intelligentDevelopment:"智能开发",mode:{readOnly:"只读",workspaceWrite:"工作区写入",fullAccess:"完全访问"},approvalPolicy:{untrusted:"仅不可信命令",onRequest:"按需审批",never:"不审批"},reviewer:{user:"由我审批",autoReview:"自动审查"},labels:{approvalPolicy:"审批策略",file:"文件",fileNumber:"文件 {{number}}",mode:"沙箱模式",networkAccess:"网络访问",reviewer:"审批方式",workingDirectory:"工作目录"},network:{allowed:"允许",disabled:"关闭"},permissionsUpdated:"已更新当前 Sandbox Session 的 Codex 权限",persistenceUnknown:"暂时无法确认持久化能力",stoppedReady:"已停止,可继续输入",uploadedFilesPrompt:"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",workspaceUpdated:"已更新工作空间"},KVe={addAgent:"添加智能体",addFromPackage:"从代码包添加",agent:"智能体",automations:"自动化",createAgent:"创建智能体",createSkill:"创建技能",cronJobs:"定时任务",issueFeedback:"问题反馈",library:"资源库",migrateAgent:"迁移智能体",newConversation:"新会话",optimizeSkill:"优化 {{name}}",search:"搜索",skill:"技能",skillLibrary:"技能库",systemInfo:"系统信息",updateAgent:"更新 {{name}}",codeProjects:"代码项目",reviewCenter:"审核中心"},ZVe={title:"从工作区新建",description:"创建和管理代码项目,在 VS Code 中编写和调试"},JVe={actions:BVe,addAgent:$Ve,approval:FVe,common:zVe,conversation:UVe,credentials:VVe,dialogs:QVe,errors:GVe,feedback:HVe,greetings:WVe,loading:YVe,oauth:qVe,providers:jVe,sandbox:XVe,titles:KVe,workspaceProjectEntry:ZVe},mur=Object.freeze(Object.defineProperty({__proto__:null,actions:BVe,addAgent:$Ve,approval:FVe,common:zVe,conversation:UVe,credentials:VVe,default:JVe,dialogs:QVe,errors:GVe,feedback:HVe,greetings:WVe,loading:YVe,oauth:qVe,providers:jVe,sandbox:XVe,titles:KVe,workspaceProjectEntry:ZVe},Symbol.toStringTag,{value:"Module"})),eQe="自动化",tQe="连接研发工具,为智能体扩展自动化工作流",rQe="搜索自动化",nQe="自动化分类",iQe={development:"研发",channels:"消息渠道"},aQe="{{category}}自动化列表",oQe="打开{{name}}",sQe="仅本地部署可用",lQe="没有匹配的自动化",cQe="请尝试搜索其他名称",uQe="返回自动化列表",hQe={"coding-agents":{name:"配置 Coding Agents",badge:"本地",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},template:{name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},delivery:{name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},review:{name:"GitHub PR 自动评审",description:"通过 GitHub App 在隔离 Sandbox 中评审 Pull Request。",title:"GitHub PR 自动评审",subtitle:"通过 GitHub App 触发 Sandbox 评审,并将结果发布到 Pull Request",panel:"请先将 GitHub App 安装到目标仓库,再为每个仓库启用自动评审。",submitLabel:"安装 GitHub App",regionHelp:"",pullRequest:{title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},sandboxToolId:{label:"沙箱工具 ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv"},modelName:{label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称"},modelBaseUrl:{label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址"}}},"gitlab-review":{name:"GitLab MR 自动评审",description:"通过 GitLab 集成在隔离 Sandbox 中评审 Merge Request。"},feishu:{name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},"website-integration":{name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"}},dQe={required:"必填",optional:"可选",region:"地域",tokenLabel:"GitHub Token",getToken:"获取 Token",createToken:"创建 GitHub Token",tokenPlaceholder:"需要仓库 Contents 与 Pull requests 写权限",tokenWorkflowPlaceholder:"需要 Contents、Pull requests、Workflows 写权限",hideToken:"隐藏 Token",showToken:"显示 Token",tokenHelp:"Token 仅用于本次提交,不会保存在浏览器或写入 PR",tokenWorkflowHelp:"此处 Token 用于创建配置 PR;它不是 Sandbox 的通用必填项,且不会保存在浏览器或写入 PR",prCreated:"PR #{{number}} 已创建",configPrCreated:"配置 PR #{{number}} 已创建",configPrNextStep:"合并后,后续同仓库 PR 会自动触发评审。",viewOnGitHub:"在 GitHub 查看",viewConfigPr:"查看配置 PR",secretsHeading:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:",secretsConfigHeading:"合并配置 PR 前,请在目标仓库添加运行时密钥",openSecrets:"打开 Secrets 设置",secretsPath:"路径:Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"将为 {{repository}} 添加 PR 自动评审配置",repositoryReviewHelp:"将使用 GitHub App 校验 {{repository}} 的 Pull Request",secretPair:"{{accessKey}}、{{secretKey}}(必填)",sessionToken:"{{sessionToken}}(使用临时凭据时必填)",requiredSecret:"{{name}}(必填)",temporaryCredentialRequired:"(使用临时凭据时必填)",requiredSuffix:"(必填)",submitting:"提交 PR 中…",validation:{required:"此项不能为空",repository:"请输入 owner/repository 或完整 GitHub 仓库 URL",baseBranch:"目标分支格式不正确",projectPath:"请输入仓库内的相对目录",runtimeId:"运行时 ID 格式不正确",sandboxToolId:"沙箱工具 ID 格式不正确",modelName:"模型名称格式不正确",modelBaseUrlSafe:"请输入不含凭据、查询参数或锚点的 HTTPS 地址",modelBaseUrl:"请输入有效的 HTTPS 地址",runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}}},fQe={title:"配置 Coding Agents",description:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。",retry:"重试",clients:{ariaLabel:"选择 Coding Agent",title:"本机客户端",detectAgain:"重新检测",detecting:"正在检测本机客户端…",detected:"已检测到客户端",available:"可用",unavailable:"未检测到"},skills:{ariaLabel:"选择内置 Skill",title:"内置 Skills",viewFiles:"查看文件",items:{"veadk-agent-development":{name:"VeADK Agent 开发",description:"使用 VeADK 开发和完善 Agent。"},"agentkit-cli":{name:"AgentKit CLI",description:"通过 AgentKit CLI 管理和部署 AgentKit 资源。"}}},global:{ariaLabel:"全局安装目录",title:"全局安装",description:"配置后可在本机其他项目中使用",empty:"选择客户端后显示对应安装目录。"},success:"已为 {{agentCount}} 个客户端配置 {{skillCount}} 个 Skill",selection:"已选择 {{agentCount}} 个客户端、{{skillCount}} 个 Skill",selectClient:"请先选择客户端",configuring:"正在配置…",configure:"配置",errors:{detect:"检测本机客户端失败",configure:"配置失败,请检查用户目录权限后重试"},preview:{description:"只读浏览随 Studio 提供的 Skill 文件",close:"关闭文件预览",loading:"正在读取文件…",error:"读取 Skill 文件失败",skillFiles:"{{name}} 文件",files:"文件",fileContent:"文件内容",notPreviewable:"此文件不是可预览的 UTF-8 文本。",noFiles:"没有可预览的文件。"}},pQe={title:"飞书机器人",description:"创建一个由 AgentKit Runtime 驱动的飞书智能体",panel:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。",agentName:"智能体名称",agentNameHelp:"将作为新 Runtime 中的根智能体名称",region:"部署地域",regionHelp:"Runtime 与构建产物将创建在该地域",regions:{"cn-beijing":"北京","cn-shanghai":"上海"},appId:"飞书 App ID",appIdHelp:"来自飞书开放平台的应用凭证",appSecret:"飞书 App Secret",appSecretPlaceholder:"请输入 App Secret",appSecretHelp:"仅写入新 Runtime 的环境变量",hideSecret:"隐藏 App Secret",showSecret:"显示 App Secret",hide:"隐藏",show:"显示",confirmCancel:"取消部署将停止任务并清理已创建的 Runtime,确定继续吗?",status:{preparing:"正在生成 basic 智能体",running:"正在创建 Runtime",cancelling:"正在取消部署",succeeded:"飞书机器人 Runtime 已创建",cancelled:"部署已取消",failed:"创建失败"},steps:{prepare:"生成智能体",build:"构建镜像",deploy:"创建 Runtime",publish:"发布服务"},openConsole:"打开 Runtime 控制台",credentials:{title:"凭据处理",description:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"},cancelDeployment:"取消部署",creating:"正在创建…",create:"创建飞书机器人 Runtime",validation:{appId:"请输入飞书 App ID",appSecret:"请输入飞书 App Secret",agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}},generatedAgent:{description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。"}},vur=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:uQe,cards:hQe,categories:iQe,categoriesLabel:nQe,codingAgents:fQe,default:{title:eQe,description:tQe,search:rQe,categoriesLabel:nQe,categories:iQe,resultsLabel:aQe,open:oQe,localOnly:sQe,emptyTitle:lQe,emptyDescription:cQe,backToAutomations:uQe,cards:hQe,github:dQe,codingAgents:fQe,feishu:pQe},description:tQe,emptyDescription:cQe,emptyTitle:lQe,feishu:pQe,github:dQe,localOnly:sQe,open:oQe,resultsLabel:aQe,search:rQe,title:eQe},Symbol.toStringTag,{value:"Module"})),gQe={"zh-CN":"简体中文","en-US":"English"},yur=Object.freeze(Object.defineProperty({__proto__:null,default:{languageNames:gQe},languageNames:gQe},Symbol.toStringTag,{value:"Module"})),mQe={selectedExcerptLabel:"选中片段",commentLabel:"批注",commentSeparator:":",successTitle:"已加入 Bad case 评测集",successDescription:"这条批注已关联当前问题和完整模型回复。",done:"完成",ariaLabel:"批注选中的模型回复",title:"添加批注",content:"批注内容",placeholder:"说明问题或期望的修改方式",retryError:"{{error}},请重试。",cancel:"取消",submit:"加入 Bad Case"},vQe={attachment:"附件",image:"图片",preview:"预览 {{name}}",uploading:"上传中",uploadFailed:"上传失败",remove:"移除 {{name}}",previewDialog:"{{name}}预览",download:"下载",close:"关闭",reading:"正在读取文档…",loadFailed:"文档加载失败:{{error}}"},yQe={errorTitle:"云端日志错误",copyError:"复制完整错误信息",retry:"重试",statuses:{live:"实时",connecting:"连接中",retrying:"重连中",idle:"未连接"},title:"实例日志",description:"当前对话请求所在的 VeFaaS 实例",close:"关闭实例日志",instanceId:"实例 ID",waitingInstance:"等待实例",request:"请求 {{id}}",ariaLabel:"VeFaaS 实例实时日志",notCapturedTitle:"尚未捕获到实例",notCapturedDescription:"发送一条消息后,这里会显示实际处理请求的实例和实时日志。",connectingTitle:"正在连接实例日志",connectingDescription:"正在通过 Studio BFF 建立安全日志流。",emptyTitle:"暂无日志",emptyDescription:"已连接实例,等待新的日志输出。",retention:"日志自动刷新,仅保留最近 {{count}} 行"},bQe={title:"调用链路观测",statuses:{loading:"加载中",ready:"",collecting:"采集中",disabled:"未开启",forbidden:"权限不足",error:"加载失败"},errors:{collecting:"调用链路仍在采集中,请稍候。",disabled:"该 Agent 未开启链路观测,请到控制台开启后重试。",forbidden:"当前账号无权读取 APMPlus 调用链路,请联系管理员补充只读权限。",error:"调用链路加载失败,请稍后重试。"},callCount:"{{count}} 个调用 · {{duration}} ms",close:"关闭",loading:"加载调用链路…",retryNow:"立即重试",reload:"重新加载",empty:"该会话暂无调用链路(可能尚未产生调用)。",attributes:"属性",selectCall:"选择左侧的一个调用查看详情"},xQe={exportNote:"上述会话由 AgentKit Studio 导出,仅供参考",imageFailed:"图片生成失败,请重试。",browserUnsupported:"浏览器无法生成会话图片,请重试。",copyUnsupported:"当前浏览器不支持复制图片,请下载后使用。",exportFailed:"导出失败,请重试。",title:"导出会话",description:"选择格式并下载截至当前回复的全部输入与输出。",close:"关闭",generatingContent:"正在生成导出内容…",retry:"重试生成",previewPage:"预览第 1 页,共 {{count}} 页",previewAlt:"会话导出内容第 1 页,共 {{count}} 页",format:"导出格式",generatingFormat:"正在生成 {{format}}…",copying:"正在复制…",copiedFirst:"已复制第一页",copied:"已复制",copyFirst:"复制第一页",copyImage:"复制图片",generating:"正在生成…",downloadArchive:"下载 PNG 压缩包({{count}} 页)",downloadFormat:"下载 {{format}}"},wQe={unsupportedComponent:"不支持的组件:{{component}}",sandboxIdentity:"Codex Sandbox 执行标识",useSkill:"使用 {{name}} 技能",thinkingDone:"已完成思考",thinking:"思考中",justNow:"刚刚",sourceUnavailable:"暂时无法读取生成的源码,请稍后重试。",downloadStarted:"已开始下载",verifiedDelivery:"已验证交付物",generatedSource:"生成的 Agent 源码",entryPoint:"入口",fileCount:"文件数",size:"大小",validationTime:"验证时间",generationTime:"生成时间",checksPassed:"{{count}} 项检查通过",sourceReady:"源码已准备好,可部署",sourceGuidance:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。",viewSource:"查看源码",preparing:"正在准备…",viewChanges:"查看本次变更",downloadSource:"下载源码",sourceNotReady:"源码尚未准备好",manualDeploy:"手动部署到 Runtime",deployAgent:"部署 Agent",beforeOptimization:"优化前",afterOptimization:"优化后",planStatuses:{pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"},renderUi:"渲染 UI",truncated:"…(已截断)",agentAdjusting:"Agent 正在调整",sandboxDetails:"Codex Sandbox 详细输出",waitingCodex:"正在等待 Codex 输出",arguments:"参数",result:"返回",artifacts:"产物",downloadNamed:"下载 {{name}}",powerpoint:"PowerPoint 演示文稿",preview:"预览",download:"下载",previewDialog:"{{name}} 预览",closePreview:"关闭预览",slidePreview:"{{name}} 幻灯片预览",mcpToolset:"MCP 工具集",authorized:"已授权 · {{tool}}",authorizationRequired:"{{tool}} 需要授权",oauthDescription:"工具集 {{tool}} 使用 OAuth 保护,需登录授权后方可调用。",oauthProvider:"将跳转至 {{provider}} 完成登录。",oauthContinue:"授权完成后对话自动继续。",waitingAuthorization:"等待授权…",authorize:"去授权",missingAuthorizationUrl:"未在事件中找到授权地址。",tools:{web_search:{running:"正在进行网络搜索",done:"已完成网络搜索"},link_reader:{running:"正在读取网页",done:"已完成网页读取"},run_code:{running:"正在 AgentKit 沙箱中执行代码",done:"已在 AgentKit 沙箱中完成代码执行"},list_envs:{running:"正在查看可用环境",done:"已读取可用环境"},get_env_manifest:{running:"正在读取环境 Manifest",done:"已读取环境 Manifest"},execute_in_sandbox:{running:"正在环境中执行命令",done:"已在环境中完成命令执行"},delegate_to_codex_sandbox:{running:"Codex Sandbox 正在执行",done:"Codex Sandbox 已完成",failed:"Codex Sandbox 执行失败"},image_generate:{running:"正在生成图片",done:"已完成图片生成"},video_generate:{running:"正在生成视频",done:"已完成视频生成"},ppt_generate:{running:"正在生成 PPT",done:"已完成 PPT 生成"},load_memory:{running:"正在检索长期记忆",done:"已完成记忆检索"},load_knowledgebase:{running:"正在检索知识库",done:"已完成知识库检索"},load_skill:{running:"正在加载技能",done:"已加载技能"},collect_resources:{running:"正在收集可用资源",done:"已完成资源收集",failed:"资源收集失败"},create_agents:{running:"正在创建并运行 Agent",done:"已完成 Agent 创建",failed:"Agent 创建失败"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit 技能中心",knowledge_base:"知识库",tool:"工具"},agentTypes:{llm:"LLM 智能体",sequential:"顺序智能体",parallel:"并行智能体",loop:"循环智能体",workflow:"工作流"},skill:"技能",subAgents:"子智能体",builtinTool:"内置工具",skillCenter:"AgentKit 技能中心",selfAuthoredTools:"自写工具",dependencies:"依赖:{{items}}",fullCode:"{{name}} 完整代码",itemCount:"{{label}} {{count}} 项",collectionAria:"召回资源信息",retrieving:"正在检索资源",retrievalFailed:"资源检索未完成",checkConfig:"请检查资源服务配置后重试。",notSearched:"未检索",notConfigured:"未配置",resourceList:"{{label}}资源列表",searchKeywords:"检索关键词",skillHubSkipped:"未提供检索关键词,本次未检索 Skill Hub。",sourceSkipped:"未配置 {{label}},本次未检索该来源。",noResources:"本次检索未返回该类别的资源。",resultAria:"创建 Agent 结果",creationFailed:"Agent 创建未完成",agentResources:"{{name}} 具备的资源",knowledgeBase:"知识库",toolsLabel:"工具",creating:"正在创建 Agent",noAgents:"没有可展示的 Agent",noAgentResult:"工具返回中未包含 Agent 配置或执行结果。",sourceLabels:{tool:"工具",knowledge:"AgentKit 知识库",skillCenter:"AgentKit 技能中心",unknown:"未知来源"},unnamedResource:"未命名资源",unnamedAgent:"未命名 Agent"},branchCompare:{ariaLabel:"分支对比",selectDirection:"选择方向",continue:"继续这个方向"},codexProgress:{planTitle:"Codex 执行计划",fallback:{fileChange:"修改文件",approval:"等待操作批准",status:"Codex 状态",command:"运行命令"},planSummary:"已完成 {{completed}}/{{total}} 项",command:{running:"正在执行命令",completed:"命令执行完成",failed:"命令执行失败"},projectFiles:"{{count}} 个项目文件",projectFile:"项目文件",fileChange:{running:"正在更新{{subject}}",completed:"已更新{{subject}}",failed:"更新{{subject}}失败"},externalTool:"外部工具",mcp:{running:"正在调用工具 {{tool}}",completed:"已调用工具 {{tool}}",failed:"工具 {{tool}} 调用未完成"},collaboration:{spawn_agent:{running:"正在启动子任务",completed:"子任务已启动",failed:"子任务启动失败"},send_input:{running:"正在向子任务发送信息",completed:"已向子任务发送信息",failed:"向子任务发送信息失败"},wait:{running:"正在等待子任务",completed:"子任务等待已结束",failed:"等待子任务失败"},close_agent:{running:"正在结束子任务",completed:"子任务已结束",failed:"子任务结束失败"},default:{running:"正在协调子任务",completed:"子任务协作已完成",failed:"子任务协作失败"}},webSearch:{running:"正在进行网络搜索",completed:"已完成网络搜索",failed:"网络搜索未完成"},errorDetail:"Codex 执行未完成。",errorTitle:"Codex 执行遇到错误"}},AQe={segments:{system:"系统与工具",input:"输入与历史",output:"输出与思考",remaining:"剩余"},modelUnavailable:"模型信息未提供",promptWithSystem:"提示词(含系统)",systemUnknown:"系统与工具占用未知",systemApprox:"系统与工具约 {{count}} Token",ariaKnown:"上下文已使用 {{percentage}}%,{{system}},{{inputLabel}} {{input}} Token,输出与思考 {{output}} Token,剩余 {{remaining}} Token",ariaUnknown:"{{model}},上下文窗口未知,会话累计使用 {{count}} Token",composition:"上下文构成",percentageUsed:"{{percentage}}% 已用",gridAria:"100 格上下文构成图,每格代表上下文窗口的百分之一",estimated:"估算",unknown:"未知",summaryPercentage:"{{used}} 已用,剩余 {{remaining}}",summaryTokens:"{{used}} 已用,剩余 {{remaining}},总计 {{total}}",overflow:"已超出上下文 {{count}} Token",title:"上下文用量",unknownModel:"暂未收录该模型的上下文窗口",unknownRuntime:"当前 Runtime 未提供模型信息"},SQe={title:"添加 AgentKit 智能体",noAgents:"连接成功,但该地址未发现任何 Agent(/list-apps 为空)。",connectionFailed:"连接失败:{{error}}。请检查 URL、API Key,以及该网关是否允许跨域。",description:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。",url:"访问地址 URL",apiKeyHint:"以 Authorization: Bearer 方式连接",displayName:"显示名称(可选)",displayNameHint:"默认取 URL 的主机名",cancel:"取消",connecting:"连接中…",connect:"连接并添加"},TQe={placeholder:"输入消息…",inputAria:"输入消息",generating:"正在生成",send:"发送"},CQe={ariaLabel:"本轮调用上下文",removeSkill:"移除技能 {{name}}",removeAgent:"移除 Agent {{name}}"},OQe={cardAria:"{{label}} 图表",viewAria:"{{label}} 显示方式",preview:"预览",code:"代码",invalidEcharts:"ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。",renderFailed:"图表暂时无法渲染,请切换到代码检查内容。",echartsAria:"ECharts 图表预览",rendering:"正在渲染图表…",mermaidFailed:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。",mermaidAria:"Mermaid 图表预览"},kQe={playVideo:"点击播放视频:{{name}}",enlargeImage:"放大预览:{{name}}",image:"图片",enlargeVideo:"点击放大视频",videoPreview:"视频预览",downloadVideo:"下载视频",close:"关闭"},EQe={annotation:mQe,media:vQe,runtimeLogs:yQe,trace:bQe,share:xQe,blocks:wQe,tokenUsage:AQe,addAgentKit:SQe,composer:TQe,invocation:CQe,visualization:OQe,markdown:kQe},bur=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:SQe,annotation:mQe,blocks:wQe,composer:TQe,default:EQe,invocation:CQe,markdown:kQe,media:vQe,runtimeLogs:yQe,share:xQe,tokenUsage:AQe,trace:bQe,visualization:OQe},Symbol.toStringTag,{value:"Module"})),_Qe={back:"返回",cancel:"取消",deploy:"部署",delete:"删除",loading:"读取中…",next:"下一步",notSupported:"暂不支持",previous:"上一步",required:"必填",retry:"重试",actions:"操作",value:"值",disabled:"关闭",enabled:"已开启",none:"无",close:"关闭",name:"名称",description:"描述",send:"发送"},RQe={heading:"VeADK Agent 结构配置",importHint:"可在「创建 Agent」页通过「导入 YAML」重新载入。"},DQe={agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"},runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}},LQe={description:"一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",instruction:`你是一个专业、可靠的智能助手。 +{{response}}`,loadArkApiKeysFailed:"加载 Ark API Key 失败",loadModelsFailed:"加载模型列表失败",runtimeAccessDenied:"当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。",privateRuntimeUnavailable:"Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",runtimeTemporarilyUnavailable:"Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",runtimeConnectionUnsupported:"该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",runtimeConnectionDenied:"Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。",listAgentsFailed:"读取 Agent 列表失败",invalidListAppsJson:"Runtime /list-apps 返回了无法解析的 JSON 响应。",invalidListAppsFormat:"Runtime /list-apps 返回格式无效,应为非空字符串数组。",createSessionFailedWithStatus:"创建会话失败 ({{status}})",createSessionFailed:"创建会话失败",getSessionFailed:"读取会话失败",getSessionFailedWithDetail:"读取会话失败:{{status}}:{{detail}}",feedbackRuntimeOnly:"只有连接到 AgentKit Runtime 的会话支持反馈回流",feedbackRegionMissing:"Runtime 缺少地域信息,无法提交反馈",submitFeedbackFailed:"提交反馈失败",loadEvaluationSetsFailed:"读取评测集失败",loadAutoEvaluationStatusFailed:"读取自动评测状态失败",loadOptimizationsFailed:"读取优化项失败",deleteEvaluationCaseFailed:"删除评测案例失败",downloadFileFailed:"下载文件失败",fileUnavailable:"文件内容不可用",uploadFileFailed:"文件上传失败",traceDisabled:"该 Agent 暂未开启链路观测,请到控制台打开后使用。",loadTraceFailed:"加载调用链路失败",contentTypeMissing:"Content-Type 缺失",traceNonJson:"加载调用链路失败:服务端返回了非 JSON 响应({{contentType}}),请检查 Studio API 代理配置",invalidTraceFormat:"加载调用链路失败:返回格式无效",submitIssueFeedbackFailed:"问题反馈上报失败",issueFeedbackNotConfirmed:"问题反馈上报失败:服务端未确认提交结果",noPreviewableAgent:"该 Runtime 未提供可预览的 Agent。",agentSearchFailed:"Agent 检索失败",emptySseBody:"HTTP 200,SSE 响应体为空。",noDisplayableSseReply:"HTTP 200,SSE 响应中没有可展示的模型回复。",firstSseEventTimeout:"60 秒内未收到首个 SSE 事件。请稍后重试,或查看 Runtime、模型、网关日志定位原因。",runSessionFailed:"运行会话失败",runSseFailedWithDetail:"运行会话失败:{{status}}:{{detail}}",checkRuntimeNameFailed:"检查 Runtime 名称失败",invalidRuntimeNameCheck:"检查 Runtime 名称失败:服务返回格式错误",loadCloudResourcesFailed:"加载云资源失败",invalidCloudResources:"云资源列表响应格式无效",invalidEnvironmentMount:"挂载环境响应格式无效",environmentMountMismatch:"挂载环境响应与请求不一致",environmentMountNetworkFailed:"无法连接 Studio 服务,环境挂载未完成。请检查网络后重试。",environmentMountFailed:"挂载环境失败",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",clipboardWriteFailed:"无法写入剪贴板,请检查剪贴板权限。",loadSystemInfoFailed:"加载系统信息失败",invalidSystemInfo:"系统信息响应格式无效",invalidEnvironmentBuild:"环境构建响应格式无效",invalidEnvironmentBuildStep:"环境构建步骤响应格式无效",invalidEnvironmentManifest:"环境 Manifest 响应格式无效",invalidImageRepository:"环境镜像仓库响应格式无效",invalidCodeRepository:"环境代码仓库响应格式无效",invalidImageSource:"环境镜像来源响应格式无效",invalidEnvironment:"环境响应格式无效",invalidWorkspace:"工作区响应格式无效",loadWorkspacesFailed:"加载工作区失败",invalidWorkspaceList:"工作区列表响应格式无效",saveWorkspaceFailed:"保存工作区失败",deleteWorkspaceFailed:"删除工作区失败",loadEnvironmentsFailed:"加载环境失败",invalidEnvironmentList:"环境列表响应格式无效",probeRepositoryFailed:"探查代码仓库失败",invalidRepositoryProbe:"代码仓库探查响应格式无效",exportEnvironmentCodeFailed:"导出环境分享码失败",invalidEnvironmentCode:"环境分享码响应格式无效",inspectEnvironmentCodeFailed:"检测环境分享码失败",invalidEnvironmentCodeInspection:"环境分享码检测响应格式无效",importEnvironmentCodeFailed:"导入环境分享码失败",invalidEnvironmentCodeImport:"环境分享码导入响应格式无效",studioUnavailable:"无法连接 Studio 服务,请确认后端已启动后重试。",saveEnvironmentFailed:"保存环境失败",deleteEnvironmentFailed:"删除环境失败",startEnvironmentBuildFailed:"启动环境构建失败",loadEnvironmentBuildFailed:"读取环境构建详情失败",loadEnvironmentManifestFailed:"读取环境 Manifest 失败",invalidEnvironmentResource:"环境资源响应格式无效",loadEnvironmentResourcesFailed:"加载环境构建资源失败",updateCodexSandboxFailed:"更新 Codex Sandbox 失败",invalidCodexSandboxUpdate:"Codex Sandbox 更新响应格式无效",loadUserPoolsFailed:"加载用户池失败",invalidUserPoolList:"用户池列表响应格式无效",syncGithubFailed:"同步 GitHub 代码失败 ({{status}})",validatingMigrationArtifact:"正在校验迁移产物",uploadingCodePackage:"正在上传代码包",migrationArtifactValidated:"迁移产物校验完成",codePackageUploaded:"代码包上传完成",deploymentProgress:{preparing:"正在准备部署",uploading:"正在上传代码包",building:"正在构建镜像",buildLogsSyncing:"正在构建镜像,构建日志已同步。",buildLogsComplete:"构建日志同步完成。",buildFailedLogsSynced:"镜像构建失败,最终构建日志已同步。",buildLogsUnavailable:"暂时无法读取构建日志。",finalBuildLogsUnavailable:"暂时无法读取最终构建日志。",deploying:"正在部署服务",publishing:"正在发布服务",evaluating:"正在创建评测集",updating:"正在更新 Runtime 配置",completing:"正在完成部署",github:"正在配置 GitHub 持续交付",inProgress:"正在部署"},deploymentFailed:"部署失败",deploymentDisconnected:"部署失败:连接中断",deploymentMissingAgentName:"部署失败:返回缺少 Agent 名称",deploymentMissingConnection:"部署失败:返回缺少 AgentKit 连接信息",cancelDeploymentFailed:"取消部署失败 ({{status}})",loadFailed:"加载失败 ({{status}})",loadPermissionsFailed:"加载权限失败 ({{status}})",invalidPermissionResponse:"权限服务返回了无法解析的响应",checkStudioUpdateFailed:"检查 Studio 更新失败 ({{status}})",studioUpdatePreflightFailed:"Studio 更新权限预检失败 ({{status}})",submitStudioUpdateFailed:"提交 Studio 更新失败 ({{status}})",loadAgentUsageFailed:"加载 Agent 用量失败",notProvided:"未提供",agentUsageNonJson:"加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP {{status}},Content-Type: {{contentType}})。",checkStudioGateway:"请确认当前服务以 Studio 模式启动,并检查代理或网关配置。",agentUsageInvalidJson:"加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP {{status}},Content-Type: {{contentType}})。",retryCheckGateway:"请稍后重试;若问题持续,请检查代理或网关配置。",loadCronJobsFailed:"加载定时任务失败",loadCronJobFailed:"加载定时任务详情失败",createCronJobFailed:"创建定时任务失败",updateCronJobFailed:"更新定时任务失败",enableCronJobFailed:"启用定时任务失败",pauseCronJobFailed:"暂停定时任务失败",runCronJobFailed:"立即执行定时任务失败",loadCronHistoryFailed:"加载执行历史失败",stopCronRunFailed:"终止执行失败",deleteCronJobFailed:"删除定时任务失败",loadRuntimeFailed:"加载 Runtime 失败",loadLocalToolsFailed:"读取本地工具失败",connectDynamicRouteFailed:"连接 Studio 动态路由失败",a2aProbeDenied:"Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。",loadA2aCardFailed:"读取 A2A Agent Card 失败",loadRuntimeApiKeyFailed:"读取 Runtime API Key 失败",runtimeApiKeyMissing:"Runtime 未返回可用的 API Key",loadMcpCredentialsFailed:"读取 MCP 认证信息失败",invalidMcpCredentials:"Studio 返回的 MCP 认证信息格式无效",deleteFailed:"删除失败 ({{status}})",runtimeManageForbidden:"当前账号没有管理该 Runtime 的权限。",runtimeNotFound:"该 Runtime 不存在或已被删除。",runtimeUnavailable:"当前账号无法访问该 Runtime。",checkRuntimeUpdateFailed:"检查 Runtime 更新能力失败(HTTP {{status}}),请稍后重试。",loadRuntimeDetailFailed:"加载 Runtime 详情失败",generateProjectFailed:"生成项目失败",generateProjectTimedOut:"生成发布预览项目超时,请稍后重试。",generateAgentConfigFailed:"生成 Agent 配置失败",createDebugRunFailed:"创建调试运行失败",createDebugSessionFailed:"创建调试会话失败",loadDebugTraceFailed:"加载调试调用链路失败",invalidDebugTrace:"加载调试调用链路失败:返回格式无效",debugRunFailed:"调试运行失败",cleanupDebugRunFailed:"清理调试运行失败"},WUe={loadFailed:"读取会话模式能力失败(HTTP {{status}})",invalidResponse:"会话模式能力响应格式错误"},YUe={nonJson:"{{fallback}}:服务端返回非 JSON 响应(HTTP {{status}},{{contentType}}){{detail}}"},qUe={busy:"工作区正在处理较多请求,请稍后重试",notFound:"工作区不存在",duplicates:"检测到多个个人工作区会话,请联系管理员处理",timeout:"工作区恢复超时,项目仍保留,请重试",unavailable:"工作区暂时无法恢复,原项目仍保留,请重试",persistence:"当前 Sandbox 未启用持久化快照,请检查工作区配置",startup:"个人工作区启动失败,请检查 Sandbox 状态",exists:"项目名称已存在,请从项目列表打开",directory:"项目目录不存在",configuration:"请先配置工作区 Sandbox 镜像",state:"暂时无法确认工作区状态,请重试",list:"恢复工作区或读取项目列表失败,请重试",create:"项目初始化失败,请确认镜像可用后重试",open:"恢复工作区或打开项目失败,请重试",connection:"工作区暂时无法连接,请重试",invalidWorkspaceUrl:"工作区返回了无效的访问地址",operation:"项目操作失败,请重试",invalidProjectUrl:"项目访问地址无效",listFallback:"读取项目列表失败",connectionState:"暂时无法连接工作区,请重试"},jUe={reporting:"正在补齐交付信息",packaging:"正在整理产物",savingVersion:"正在保存版本",finishing:"正在完成请求",submitResult:"提交构建结果",requestFailed:"任务请求失败,请重试。",invalidResponse:"任务状态响应无效。",eventGap:"正在补齐任务输出。",reconnecting:"连接暂时中断,正在重连。已有输出已保留。",input:{pending:"等待送达",sending:"正在确认送达",delivered:"已送达",withdrawn:"已停止发送"},plan:"执行计划",diff:"文件变更",preparing:"正在准备任务",preparingEnvironment:"正在准备开发环境…",connectingEnvironment:"正在连接开发环境…",processing:"正在处理请求",thinking:"正在思考",read:"读取文件 · {{target}}",listFiles:"查看目录 · {{target}}",search:"搜索 · {{target}}",command:"执行命令 · {{target}}",editFiles:"修改文件 · {{target}}",webSearch:"搜索网页 · {{target}}",processSummary:"已处理 {{count}} 项",duration:"{{seconds}} 秒",durationUnits:{milliseconds:"{{value}} 毫秒",hours:"{{value}} 小时",minutes:"{{value}} 分",seconds:"{{value}} 秒"},failedTools:"{{count}} 项执行失败",toolFailed:"执行失败",toolCalls:"{{count}} 次工具调用",turnDuration:"本轮耗时 {{duration}}",toolDuration:"工具累计耗时 {{duration}}",toolDurationPartial:"已记录工具耗时 {{duration}}",toolDurationHelp:"各工具执行耗时之和;并行调用可能使累计耗时超过本轮耗时。",turnStatus:{completed:"已完成",failed:"未完成",interrupted:"已中断",cancelled:"已中断",unavailable:"任务已结束"},notReported:"未上报",partial:"已记录",partialHelp:"本轮记录可能不完整。",tokenDetails:"本轮 Token 用量",model:"本轮模型",totalTokens:"总量",inputTokens:"输入",cachedInputTokens:"缓存命中输入",uncachedInputTokens:"未命中输入",cacheWriteInputTokens:"缓存写入",outputTokens:"输出",reasoningOutputTokens:"推理输出",cacheHitRate:"输入缓存命中率",tokenHelp:"缓存命中属于输入,推理输出属于输出,不重复计入总量。未命中输入 = 输入 − 缓存命中。"},XUe={common:OUe,agentkitCli:kUe,cloudRegion:EUe,connections:_Ue,feishuBot:RUe,requestError:DUe,runSse:LUe,runtimeLogs:MUe,search:IUe,skills:PUe,sse:NUe,identity:BUe,github:$Ue,video:FUe,websiteIntegration:zUe,knowledge:UUe,intelligentDevelopment:VUe,migrations:QUe,sandbox:GUe,client:HUe,newChatCapabilities:WUe,jsonResponse:YUe,workspaceProjects:qUe,developmentRuns:jUe},pur=Object.freeze(Object.defineProperty({__proto__:null,agentkitCli:kUe,client:HUe,cloudRegion:EUe,common:OUe,connections:_Ue,default:XUe,developmentRuns:jUe,feishuBot:RUe,github:$Ue,identity:BUe,intelligentDevelopment:VUe,jsonResponse:YUe,knowledge:UUe,migrations:QUe,newChatCapabilities:WUe,requestError:DUe,runSse:LUe,runtimeLogs:MUe,sandbox:GUe,search:IUe,skills:PUe,sse:NUe,video:FUe,websiteIntegration:zUe,workspaceProjects:qUe},Symbol.toStringTag,{value:"Module"})),KUe="智能体审核",ZUe="申请企业内全员使用,审批后生效",JUe="关闭",eVe="刷新",tVe="状态",rVe="申请人",nVe="申请时间",iVe="当前版本",aVe="模型",oVe="退回人",sVe="通过人",lVe="审批时间",cVe="智能体描述",uVe="申请说明",hVe="退回理由",dVe="审批意见",fVe="退回理由(必填)",pVe="提交后内容已变化,请退回并重新申请",gVe="撤回后可以修改 Agent,需要公开时重新申请",mVe="取消公开后其他用户将无法继续使用,确定取消公开吗?",vVe="取消",yVe="确认",bVe="正在保存",xVe="取消公开",wVe="撤回申请",AVe="通过",SVe="直接公开",TVe="申请公开",CVe="全员可见",OVe={pending:"待审核",approved:"已通过",returned:"已退回",withdrawn:"已撤回"},kVe="搜索智能体或申请人",EVe="地域",_Ve="全部状态",RVe="智能体",DVe="操作",LVe="查看并审批",MVe="申请详情",IVe="没有符合条件的申请",PVe="暂无智能体审核申请",NVe="{{count}} / {{limit}} 字",gur=Object.freeze(Object.defineProperty({__proto__:null,actions:DVe,agent:RVe,all:_Ve,approve:AVe,approvedBy:sVe,cancel:vVe,close:JUe,comment:dVe,confirm:yVe,contentChanged:pVe,default:{title:KUe,dialogDescription:ZUe,close:JUe,refresh:eVe,statusTitle:tVe,submitter:rVe,submittedAt:nVe,version:iVe,model:aVe,returnedBy:oVe,approvedBy:sVe,reviewedAt:lVe,description:cVe,message:uVe,reason:hVe,comment:dVe,reasonRequired:fVe,contentChanged:pVe,withdrawConfirm:gVe,unpublishConfirm:mVe,cancel:vVe,confirm:yVe,saving:bVe,unpublish:xVe,withdraw:wVe,return:"退回",approve:AVe,publish:SVe,submit:TVe,private:"仅自己可见",enterprise:CVe,status:OVe,search:kVe,region:EVe,all:_Ve,agent:RVe,actions:DVe,review:LVe,details:MVe,noMatches:IVe,empty:PVe,textCount:NVe},description:cVe,details:MVe,dialogDescription:ZUe,empty:PVe,enterprise:CVe,message:uVe,model:aVe,noMatches:IVe,publish:SVe,reason:hVe,reasonRequired:fVe,refresh:eVe,region:EVe,returnedBy:oVe,review:LVe,reviewedAt:lVe,saving:bVe,search:kVe,status:OVe,statusTitle:tVe,submit:TVe,submittedAt:nVe,submitter:rVe,textCount:NVe,title:KUe,unpublish:xVe,unpublishConfirm:mVe,version:iVe,withdraw:wVe,withdrawConfirm:gVe},Symbol.toStringTag,{value:"Module"})),BVe={backToEvaluationCase:"返回评测案例",cancel:"取消",copied:"已复制",copy:"复制",exportConversation:"导出会话",retry:"重试"},$Ve={title:"您想以哪种方式添加 Agent 来运行?",subtitle:"选择最适合你的方式,下一步即可开始",quickCreate:{title:"从 0 快速创建",description:"用智能、自定义、模板或工作流的方式从零创建一个 Agent。"},intelligent:{title:"智能模式",description:"描述目标,按你的意图构建、调试并验证 Agent。"},package:{title:"从代码包添加和部署",description:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。"},migrate:{title:"从存量迁移",description:"从您的 LangChain、Dify 等存量项目迁移至 AgentKit Runtime。"}},FVe={subject:{file:"文件修改",command:"命令执行"},decision:{accept:"已允许本次{{subject}}",acceptForSession:"已在本会话中允许{{subject}}",decline:"已拒绝{{subject}}",cancel:"已取消{{subject}}审批"},details:{command:"命令",grantRoot:"授权路径",cwd:"执行目录"}},zVe={noDescription:"暂无描述",region:"地域",unknownAgent:"未知 Agent"},UVe={agentTransfer:"智能体移交",annotationHint:"模型回复;选中文字后可添加批注",continueBranch:"继续“{{branch}}”这个方向",emptyResponse:"本次没有返回可显示的内容。",subagentDescription:"正在执行主 Agent 移交的任务。"},VVe={title:"需要配置 {{provider}} AK/SK",prefix:"智能体工作台需要 {{provider}} 凭据才能使用。请在运行环境中设置",and:"与",suffix:"后重试。"},QVe={buildRunning:{title:"当前构建仍在进行",description:"离开将停止本轮构建;当前会话仍会保留,可稍后从历史会话重新进入。",confirm:"停止并离开"},deleteThread:{title:"删除 Codex 历史会话",description:"将删除“{{name}}”,并从历史会话中移除。",confirm:"确认删除"},returnToCreate:{title:"返回创建首页?",description:"返回后当前填写的内容将会丢失,确定要返回吗?",confirm:"确定返回"}},GVe={additionalAgentDeleteFailures:";另有 {{count}} 个失败",agentDeleteFailures:"{{count}} 个 Agent 删除失败:{{failures}}{{suffix}}",agentToolsMissing:"当前 Agent 缺少任务工具:{{tools}}",buildStopUnconfirmed:"已离开开发环境,但未能确认本轮构建已停止。任务可能仍在运行,请稍后从历史会话检查状态。",builtinAgentSendFailed:"内置智能体发送失败:{{message}}",bytePlusEvaluationUnsupported:"BytePlus 暂不支持 AgentKit 评测集",clipboardUnsupported:"当前浏览器不支持写入剪贴板。",cloudCodexEmptyReply:"云端 Codex 已结束,但没有生成回复,请重新发送任务。",cloudCodexSessionMissing:"云端 Codex Session 暂未出现在列表中,请稍后重试。",deploymentRuntimeIdMissing:"部署完成,但未返回 Runtime ID。",environmentExpired:"所选环境已失效,请刷新后重新选择。",environmentsLoadFailed:"读取环境失败",evaluationCaseSessionMissing:"这条案例缺少会话定位信息,无法跳转。",evaluationUnsupportedForReply:"当前回复暂不支持加入评测集",firstFrameRequired:"首尾帧生成需要先添加首帧图片。",incompletePromptOptimization:"提示词优化结果不完整,请重新优化后再试。",intelligentCapabilityCheckFailed:"智能开发能力检查失败(HTTP {{status}})",intelligentSessionCreateFailed:"智能开发会话创建失败",invalidIntelligentCapability:"智能开发模型能力格式错误。",localBffToolsNotConfigured:"本地 Studio BFF 没有配置工具。",localToolsLoadFailed:"读取本地工具失败",loginPopupBlocked:"登录窗口被浏览器拦截,请允许弹出窗口后重试。",loginPopupClosed:"登录窗口已关闭,请重新登录以继续当前操作。",mediaTooLarge:"{{fileName}} 超出当前平台允许的素材大小。",mountEnvironmentFailed:"挂载环境失败",noConnectedSandbox:"当前没有已连接的 Sandbox。",noCreateAgentPermission:"当前账号没有添加 Agent 的权限。",noManageAgentPermission:"当前账号没有管理 Agent 的权限。",noOptimizationBaseline:"当前版本没有可对比的优化前版本。",oauthUrlMissing:"事件中没有授权地址。",onlyCloudAgentUpdatable:"仅支持更新已部署的云端智能体。",optimizationVersionMissing:"无法找到本次优化对应的项目版本,可能已被删除。",persistentStorageNotConfigured:"管理员未配置持久化存储",readDraftFailed:"无法读取本机草稿,请稍后重试。",runtimeAgentNameMissing:"Runtime 缺少智能体名称,无法更新。",runtimeBffToolsDisabled:"当前 Runtime Agent 未开启 BFF 工具能力。",runtimeDeploymentConfigUnavailable:"该 Runtime 的原发布配置不可恢复,无法安全更新。",runtimeMissingForConnection:"缺少 Runtime 信息,无法连接智能体。",runtimeRegionMissingForDelete:"Runtime 缺少地域信息,无法删除",runtimeRegionMissingForUpdate:"Runtime 缺少地域信息,无法更新。",runtimeUpdateUnsupported:"当前 Runtime 不支持原地更新。",sandboxRuntimeUnavailable:"当前 Agent 没有可用的 Sandbox Runtime。",sandboxToolsUnavailable:"当前 Studio BFF 未提供 Sandbox 执行工具。",saveDraftLocationRejected:"浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。",saveDraftRejected:"浏览器拒绝保存草稿,请稍后重试。",selectSkillToOptimize:"请先选择需要优化的 Skill。",sessionMissingForMount:"当前会话不存在,无法挂载环境。",sessionNotReady:"会话尚未就绪。",sessionUnavailable:"当前会话不可用,请关闭后重试。",sourceNotReady:"该源码尚未准备好,请返回对话继续处理。",textVideoRejectsReferences:"文生视频不使用参考素材,请先移除已添加的图片或视频。",videoEditRequiresVideo:"视频编辑需要先添加待编辑视频。",videoExtendRequiresVideo:"视频续写需要先添加基础视频。",videoGenerationFailed:"视频生成失败,请稍后重试。",videoModeUnsupported:"当前平台暂不支持所选视频任务模式。",videoPreviewMissing:"视频任务已完成,但服务端未返回预览地址。",videoReferenceRequired:"参考素材生视频需要至少添加一项参考图片或参考视频。"},HVe={like:"赞",removeLike:"取消点赞",dislike:"踩",removeDislike:"取消点踩",reportIssue:"问题反馈",traceFlameGraph:"Tracing 火焰图"},WVe={0:"今天想做点什么?",1:"有什么可以帮你的?",2:"需要我帮你查点什么吗?",3:"有问题尽管问我",4:"嗨,我们开始吧",5:"开始一段新对话吧",6:"今天想先解决哪件事?",7:"把你的想法告诉我吧",8:"我们从哪里开始?",9:"有什么任务交给我?",10:"准备好一起推进了吗?",11:"说说你现在最关心的问题",12:"今天也一起把事情做好",13:"我在,随时可以开始",intelligentDevelopment:"让灵感自由生长"},YVe={agentCapabilities:"正在检查 Agent 能力…",session:"加载会话…"},qVe={cancelled:"授权已取消。",pasteCallbackUrl:"授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:",popupBlocked:"弹窗被拦截,请允许弹窗后重试。",unsupportedUrl:"授权链接不是 http/https 地址,已阻止打开。"},jVe={volcengine:"火山引擎"},XVe={checkingPersistence:"正在检查持久化能力…",exitDevelopment:"退出开发环境",fileUploaded:"已上传文件到 Sandbox",filesUploaded:"已上传 {{count}} 个文件到 Sandbox",intelligentDevelopment:"智能开发",mode:{readOnly:"只读",workspaceWrite:"工作区写入",fullAccess:"完全访问"},approvalPolicy:{untrusted:"仅不可信命令",onRequest:"按需审批",never:"不审批"},reviewer:{user:"由我审批",autoReview:"自动审查"},labels:{approvalPolicy:"审批策略",file:"文件",fileNumber:"文件 {{number}}",mode:"沙箱模式",networkAccess:"网络访问",reviewer:"审批方式",workingDirectory:"工作目录"},network:{allowed:"允许",disabled:"关闭"},permissionsUpdated:"已更新当前 Sandbox Session 的 Codex 权限",persistenceUnknown:"暂时无法确认持久化能力",stoppedReady:"已停止,可继续输入",uploadedFilesPrompt:"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",workspaceUpdated:"已更新工作空间"},KVe={addAgent:"添加智能体",addFromPackage:"从代码包添加",agent:"智能体",automations:"自动化",createAgent:"创建智能体",createSkill:"创建技能",cronJobs:"定时任务",issueFeedback:"问题反馈",library:"资源库",migrateAgent:"迁移智能体",newConversation:"新会话",optimizeSkill:"优化 {{name}}",search:"搜索",skill:"技能",skillLibrary:"技能库",systemInfo:"系统信息",updateAgent:"更新 {{name}}",codeProjects:"代码项目",reviewCenter:"审核中心"},ZVe={title:"从工作区新建",description:"创建和管理代码项目,在 VS Code 中编写和调试"},JVe={actions:BVe,addAgent:$Ve,approval:FVe,common:zVe,conversation:UVe,credentials:VVe,dialogs:QVe,errors:GVe,feedback:HVe,greetings:WVe,loading:YVe,oauth:qVe,providers:jVe,sandbox:XVe,titles:KVe,workspaceProjectEntry:ZVe},mur=Object.freeze(Object.defineProperty({__proto__:null,actions:BVe,addAgent:$Ve,approval:FVe,common:zVe,conversation:UVe,credentials:VVe,default:JVe,dialogs:QVe,errors:GVe,feedback:HVe,greetings:WVe,loading:YVe,oauth:qVe,providers:jVe,sandbox:XVe,titles:KVe,workspaceProjectEntry:ZVe},Symbol.toStringTag,{value:"Module"})),eQe="自动化",tQe="连接研发工具,为智能体扩展自动化工作流",rQe="搜索自动化",nQe="自动化分类",iQe={development:"研发",channels:"消息渠道"},aQe="{{category}}自动化列表",oQe="打开{{name}}",sQe="仅本地部署可用",lQe="没有匹配的自动化",cQe="请尝试搜索其他名称",uQe="返回自动化列表",hQe={"coding-agents":{name:"配置 Coding Agents",badge:"本地",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},template:{name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},delivery:{name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",regionHelp:"必须与目标 Runtime 所在地域一致",pullRequest:{title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 {{provider}} Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},projectPath:{label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py"},runtimeName:{label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置"},runtimeId:{label:"运行时 ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime"}}},review:{name:"GitHub PR 自动评审",description:"通过 GitHub App 在隔离 Sandbox 中评审 Pull Request。",title:"GitHub PR 自动评审",subtitle:"通过 GitHub App 触发 Sandbox 评审,并将结果发布到 Pull Request",panel:"请先将 GitHub App 安装到目标仓库,再为每个仓库启用自动评审。",submitLabel:"安装 GitHub App",regionHelp:"",pullRequest:{title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},fields:{repository:{label:"GitHub 仓库",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL"},baseBranch:{label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base"},sandboxToolId:{label:"沙箱工具 ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv"},modelName:{label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称"},modelBaseUrl:{label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址"}}},"gitlab-review":{name:"GitLab MR 自动评审",description:"通过 GitLab 集成在隔离 Sandbox 中评审 Merge Request。"},feishu:{name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},"website-integration":{name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"}},dQe={required:"必填",optional:"可选",region:"地域",tokenLabel:"GitHub Token",getToken:"获取 Token",createToken:"创建 GitHub Token",tokenPlaceholder:"需要仓库 Contents 与 Pull requests 写权限",tokenWorkflowPlaceholder:"需要 Contents、Pull requests、Workflows 写权限",hideToken:"隐藏 Token",showToken:"显示 Token",tokenHelp:"Token 仅用于本次提交,不会保存在浏览器或写入 PR",tokenWorkflowHelp:"此处 Token 用于创建配置 PR;它不是 Sandbox 的通用必填项,且不会保存在浏览器或写入 PR",prCreated:"PR #{{number}} 已创建",configPrCreated:"配置 PR #{{number}} 已创建",configPrNextStep:"合并后,后续同仓库 PR 会自动触发评审。",viewOnGitHub:"在 GitHub 查看",viewConfigPr:"查看配置 PR",secretsHeading:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:",secretsConfigHeading:"合并配置 PR 前,请在目标仓库添加运行时密钥",openSecrets:"打开 Secrets 设置",secretsPath:"路径:Settings → Secrets and variables → Actions → Repository secrets",repositoryConfigHelp:"将为 {{repository}} 添加 PR 自动评审配置",repositoryReviewHelp:"将使用 GitHub App 校验 {{repository}} 的 Pull Request",secretPair:"{{accessKey}}、{{secretKey}}(必填)",sessionToken:"{{sessionToken}}(使用临时凭据时必填)",requiredSecret:"{{name}}(必填)",temporaryCredentialRequired:"(使用临时凭据时必填)",requiredSuffix:"(必填)",submitting:"提交 PR 中…",validation:{required:"此项不能为空",repository:"请输入 owner/repository 或完整 GitHub 仓库 URL",baseBranch:"目标分支格式不正确",projectPath:"请输入仓库内的相对目录",runtimeId:"运行时 ID 格式不正确",sandboxToolId:"沙箱工具 ID 格式不正确",modelName:"模型名称格式不正确",modelBaseUrlSafe:"请输入不含凭据、查询参数或锚点的 HTTPS 地址",modelBaseUrl:"请输入有效的 HTTPS 地址",runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}}},fQe={title:"配置 Coding Agents",description:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。",retry:"重试",clients:{ariaLabel:"选择 Coding Agent",title:"本机客户端",detectAgain:"重新检测",detecting:"正在检测本机客户端…",detected:"已检测到客户端",available:"可用",unavailable:"未检测到"},skills:{ariaLabel:"选择内置 Skill",title:"内置 Skills",viewFiles:"查看文件",items:{"veadk-agent-development":{name:"VeADK Agent 开发",description:"使用 VeADK 开发和完善 Agent。"},"agentkit-cli":{name:"AgentKit CLI",description:"通过 AgentKit CLI 管理和部署 AgentKit 资源。"}}},global:{ariaLabel:"全局安装目录",title:"全局安装",description:"配置后可在本机其他项目中使用",empty:"选择客户端后显示对应安装目录。"},success:"已为 {{agentCount}} 个客户端配置 {{skillCount}} 个 Skill",selection:"已选择 {{agentCount}} 个客户端、{{skillCount}} 个 Skill",selectClient:"请先选择客户端",configuring:"正在配置…",configure:"配置",errors:{detect:"检测本机客户端失败",configure:"配置失败,请检查用户目录权限后重试"},preview:{description:"只读浏览随 Studio 提供的 Skill 文件",close:"关闭文件预览",loading:"正在读取文件…",error:"读取 Skill 文件失败",skillFiles:"{{name}} 文件",files:"文件",fileContent:"文件内容",notPreviewable:"此文件不是可预览的 UTF-8 文本。",noFiles:"没有可预览的文件。"}},pQe={title:"飞书机器人",description:"创建一个由 AgentKit Runtime 驱动的飞书智能体",panel:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。",agentName:"智能体名称",agentNameHelp:"将作为新 Runtime 中的根智能体名称",region:"部署地域",regionHelp:"Runtime 与构建产物将创建在该地域",regions:{"cn-beijing":"北京","cn-shanghai":"上海"},appId:"飞书 App ID",appIdHelp:"来自飞书开放平台的应用凭证",appSecret:"飞书 App Secret",appSecretPlaceholder:"请输入 App Secret",appSecretHelp:"仅写入新 Runtime 的环境变量",hideSecret:"隐藏 App Secret",showSecret:"显示 App Secret",hide:"隐藏",show:"显示",confirmCancel:"取消部署将停止任务并清理已创建的 Runtime,确定继续吗?",status:{preparing:"正在生成 basic 智能体",running:"正在创建 Runtime",cancelling:"正在取消部署",succeeded:"飞书机器人 Runtime 已创建",cancelled:"部署已取消",failed:"创建失败"},steps:{prepare:"生成智能体",build:"构建镜像",deploy:"创建 Runtime",publish:"发布服务"},openConsole:"打开 Runtime 控制台",credentials:{title:"凭据处理",description:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"},cancelDeployment:"取消部署",creating:"正在创建…",create:"创建飞书机器人 Runtime",validation:{appId:"请输入飞书 App ID",appSecret:"请输入飞书 App Secret",agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}},generatedAgent:{description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。"}},vur=Object.freeze(Object.defineProperty({__proto__:null,backToAutomations:uQe,cards:hQe,categories:iQe,categoriesLabel:nQe,codingAgents:fQe,default:{title:eQe,description:tQe,search:rQe,categoriesLabel:nQe,categories:iQe,resultsLabel:aQe,open:oQe,localOnly:sQe,emptyTitle:lQe,emptyDescription:cQe,backToAutomations:uQe,cards:hQe,github:dQe,codingAgents:fQe,feishu:pQe},description:tQe,emptyDescription:cQe,emptyTitle:lQe,feishu:pQe,github:dQe,localOnly:sQe,open:oQe,resultsLabel:aQe,search:rQe,title:eQe},Symbol.toStringTag,{value:"Module"})),gQe={"zh-CN":"简体中文","en-US":"English"},yur=Object.freeze(Object.defineProperty({__proto__:null,default:{languageNames:gQe},languageNames:gQe},Symbol.toStringTag,{value:"Module"})),mQe={selectedExcerptLabel:"选中片段",commentLabel:"批注",commentSeparator:":",successTitle:"已加入 Bad case 评测集",successDescription:"这条批注已关联当前问题和完整模型回复。",done:"完成",ariaLabel:"批注选中的模型回复",title:"添加批注",content:"批注内容",placeholder:"说明问题或期望的修改方式",retryError:"{{error}},请重试。",cancel:"取消",submit:"加入 Bad Case"},vQe={attachment:"附件",image:"图片",preview:"预览 {{name}}",uploading:"上传中",uploadFailed:"上传失败",remove:"移除 {{name}}",previewDialog:"{{name}}预览",download:"下载",close:"关闭",reading:"正在读取文档…",loadFailed:"文档加载失败:{{error}}"},yQe={errorTitle:"云端日志错误",copyError:"复制完整错误信息",retry:"重试",statuses:{live:"实时",connecting:"连接中",retrying:"重连中",idle:"未连接"},title:"实例日志",description:"当前对话请求所在的 VeFaaS 实例",close:"关闭实例日志",instanceId:"实例 ID",waitingInstance:"等待实例",request:"请求 {{id}}",ariaLabel:"VeFaaS 实例实时日志",notCapturedTitle:"尚未捕获到实例",notCapturedDescription:"发送一条消息后,这里会显示实际处理请求的实例和实时日志。",connectingTitle:"正在连接实例日志",connectingDescription:"正在通过 Studio BFF 建立安全日志流。",emptyTitle:"暂无日志",emptyDescription:"已连接实例,等待新的日志输出。",retention:"日志自动刷新,仅保留最近 {{count}} 行"},bQe={title:"调用链路观测",statuses:{loading:"加载中",ready:"",collecting:"采集中",disabled:"未开启",forbidden:"权限不足",error:"加载失败"},errors:{collecting:"调用链路仍在采集中,请稍候。",disabled:"该 Agent 未开启链路观测,请到控制台开启后重试。",forbidden:"当前账号无权读取 APMPlus 调用链路,请联系管理员补充只读权限。",error:"调用链路加载失败,请稍后重试。"},callCount:"{{count}} 个调用 · {{duration}} ms",close:"关闭",loading:"加载调用链路…",retryNow:"立即重试",reload:"重新加载",empty:"该会话暂无调用链路(可能尚未产生调用)。",attributes:"属性",selectCall:"选择左侧的一个调用查看详情"},xQe={exportNote:"上述会话由 AgentKit Studio 导出,仅供参考",imageFailed:"图片生成失败,请重试。",browserUnsupported:"浏览器无法生成会话图片,请重试。",copyUnsupported:"当前浏览器不支持复制图片,请下载后使用。",exportFailed:"导出失败,请重试。",title:"导出会话",description:"选择格式并下载截至当前回复的全部输入与输出。",close:"关闭",generatingContent:"正在生成导出内容…",retry:"重试生成",previewPage:"预览第 1 页,共 {{count}} 页",previewAlt:"会话导出内容第 1 页,共 {{count}} 页",format:"导出格式",generatingFormat:"正在生成 {{format}}…",copying:"正在复制…",copiedFirst:"已复制第一页",copied:"已复制",copyFirst:"复制第一页",copyImage:"复制图片",generating:"正在生成…",downloadArchive:"下载 PNG 压缩包({{count}} 页)",downloadFormat:"下载 {{format}}"},wQe={unsupportedComponent:"不支持的组件:{{component}}",sandboxIdentity:"Codex Sandbox 执行标识",useSkill:"使用 {{name}} 技能",thinkingDone:"已完成思考",thinking:"思考中",justNow:"刚刚",sourceUnavailable:"暂时无法读取生成的源码,请稍后重试。",downloadStarted:"已开始下载",verifiedDelivery:"已验证交付物",generatedSource:"生成的 Agent 源码",entryPoint:"入口",fileCount:"文件数",size:"大小",validationTime:"验证时间",generationTime:"生成时间",checksPassed:"{{count}} 项检查通过",sourceReady:"源码已准备好,可部署",sourceGuidance:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。",viewSource:"查看源码",preparing:"正在准备…",viewChanges:"查看本次变更",downloadSource:"下载源码",sourceNotReady:"源码尚未准备好",manualDeploy:"手动部署到 Runtime",deployAgent:"部署 Agent",beforeOptimization:"优化前",afterOptimization:"优化后",planStatuses:{pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"},renderUi:"渲染 UI",truncated:"…(已截断)",agentAdjusting:"Agent 正在调整",sandboxDetails:"Codex Sandbox 详细输出",waitingCodex:"正在等待 Codex 输出",arguments:"参数",result:"返回",artifacts:"产物",downloadNamed:"下载 {{name}}",powerpoint:"PowerPoint 演示文稿",preview:"预览",download:"下载",previewDialog:"{{name}} 预览",closePreview:"关闭预览",slidePreview:"{{name}} 幻灯片预览",mcpToolset:"MCP 工具集",authorized:"已授权 · {{tool}}",authorizationRequired:"{{tool}} 需要授权",oauthDescription:"工具集 {{tool}} 使用 OAuth 保护,需登录授权后方可调用。",oauthProvider:"将跳转至 {{provider}} 完成登录。",oauthContinue:"授权完成后对话自动继续。",waitingAuthorization:"等待授权…",authorize:"去授权",missingAuthorizationUrl:"未在事件中找到授权地址。",tools:{web_search:{running:"正在进行网络搜索",done:"已完成网络搜索"},link_reader:{running:"正在读取网页",done:"已完成网页读取"},run_code:{running:"正在 AgentKit 沙箱中执行代码",done:"已在 AgentKit 沙箱中完成代码执行"},list_envs:{running:"正在查看可用环境",done:"已读取可用环境"},get_env_manifest:{running:"正在读取环境 Manifest",done:"已读取环境 Manifest"},execute_in_sandbox:{running:"正在环境中执行命令",done:"已在环境中完成命令执行"},delegate_to_codex_sandbox:{running:"Codex Sandbox 正在执行",done:"Codex Sandbox 已完成",failed:"Codex Sandbox 执行失败"},image_generate:{running:"正在生成图片",done:"已完成图片生成"},video_generate:{running:"正在生成视频",done:"已完成视频生成"},ppt_generate:{running:"正在生成 PPT",done:"已完成 PPT 生成"},load_memory:{running:"正在检索长期记忆",done:"已完成记忆检索"},load_knowledgebase:{running:"正在检索知识库",done:"已完成知识库检索"},load_skill:{running:"正在加载技能",done:"已加载技能"},collect_resources:{running:"正在收集可用资源",done:"已完成资源收集",failed:"资源收集失败"},create_agents:{running:"正在创建并运行 Agent",done:"已完成 Agent 创建",failed:"Agent 创建失败"}},createAgents:{categories:{skill_hub:"Skill Hub",skill_space:"AgentKit 技能中心",knowledge_base:"知识库",tool:"工具"},agentTypes:{llm:"LLM 智能体",sequential:"顺序智能体",parallel:"并行智能体",loop:"循环智能体",workflow:"工作流"},skill:"技能",subAgents:"子智能体",builtinTool:"内置工具",skillCenter:"AgentKit 技能中心",selfAuthoredTools:"自写工具",dependencies:"依赖:{{items}}",fullCode:"{{name}} 完整代码",itemCount:"{{label}} {{count}} 项",collectionAria:"召回资源信息",retrieving:"正在检索资源",retrievalFailed:"资源检索未完成",checkConfig:"请检查资源服务配置后重试。",notSearched:"未检索",notConfigured:"未配置",resourceList:"{{label}}资源列表",searchKeywords:"检索关键词",skillHubSkipped:"未提供检索关键词,本次未检索 Skill Hub。",sourceSkipped:"未配置 {{label}},本次未检索该来源。",noResources:"本次检索未返回该类别的资源。",resultAria:"创建 Agent 结果",creationFailed:"Agent 创建未完成",agentResources:"{{name}} 具备的资源",knowledgeBase:"知识库",toolsLabel:"工具",creating:"正在创建 Agent",noAgents:"没有可展示的 Agent",noAgentResult:"工具返回中未包含 Agent 配置或执行结果。",sourceLabels:{tool:"工具",knowledge:"AgentKit 知识库",skillCenter:"AgentKit 技能中心",unknown:"未知来源"},unnamedResource:"未命名资源",unnamedAgent:"未命名 Agent"},branchCompare:{ariaLabel:"分支对比",selectDirection:"选择方向",continue:"继续这个方向"},codexProgress:{planTitle:"Codex 执行计划",fallback:{fileChange:"修改文件",approval:"等待操作批准",status:"Codex 状态",command:"运行命令"},planSummary:"已完成 {{completed}}/{{total}} 项",command:{running:"正在执行命令",completed:"命令执行完成",failed:"命令执行失败"},projectFiles:"{{count}} 个项目文件",projectFile:"项目文件",fileChange:{running:"正在更新{{subject}}",completed:"已更新{{subject}}",failed:"更新{{subject}}失败"},externalTool:"外部工具",mcp:{running:"正在调用工具 {{tool}}",completed:"已调用工具 {{tool}}",failed:"工具 {{tool}} 调用未完成"},collaboration:{spawn_agent:{running:"正在启动子任务",completed:"子任务已启动",failed:"子任务启动失败"},send_input:{running:"正在向子任务发送信息",completed:"已向子任务发送信息",failed:"向子任务发送信息失败"},wait:{running:"正在等待子任务",completed:"子任务等待已结束",failed:"等待子任务失败"},close_agent:{running:"正在结束子任务",completed:"子任务已结束",failed:"子任务结束失败"},default:{running:"正在协调子任务",completed:"子任务协作已完成",failed:"子任务协作失败"}},webSearch:{running:"正在进行网络搜索",completed:"已完成网络搜索",failed:"网络搜索未完成"},errorDetail:"Codex 执行未完成。",errorTitle:"Codex 执行遇到错误"}},AQe={segments:{system:"系统与工具",input:"输入与历史",output:"输出与思考",remaining:"剩余"},modelUnavailable:"模型信息未提供",promptWithSystem:"提示词(含系统)",systemUnknown:"系统与工具占用未知",systemApprox:"系统与工具约 {{count}} Token",ariaKnown:"上下文已使用 {{percentage}}%,{{system}},{{inputLabel}} {{input}} Token,输出与思考 {{output}} Token,剩余 {{remaining}} Token",ariaUnknown:"{{model}},上下文窗口未知,会话累计使用 {{count}} Token",composition:"上下文构成",percentageUsed:"{{percentage}}% 已用",gridAria:"100 格上下文构成图,每格代表上下文窗口的百分之一",estimated:"估算",unknown:"未知",summaryPercentage:"{{used}} 已用,剩余 {{remaining}}",summaryTokens:"{{used}} 已用,剩余 {{remaining}},总计 {{total}}",overflow:"已超出上下文 {{count}} Token",title:"上下文用量",unknownModel:"暂未收录该模型的上下文窗口",unknownRuntime:"当前 Runtime 未提供模型信息"},SQe={title:"添加 AgentKit 智能体",noAgents:"连接成功,但该地址未发现任何 Agent(/list-apps 为空)。",connectionFailed:"连接失败:{{error}}。请检查 URL、API Key,以及该网关是否允许跨域。",description:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。",url:"访问地址 URL",apiKeyHint:"以 Authorization: Bearer 方式连接",displayName:"显示名称(可选)",displayNameHint:"默认取 URL 的主机名",cancel:"取消",connecting:"连接中…",connect:"连接并添加"},TQe={placeholder:"输入消息…",inputAria:"输入消息",generating:"正在生成",send:"发送"},CQe={ariaLabel:"本轮调用上下文",removeSkill:"移除技能 {{name}}",removeAgent:"移除 Agent {{name}}"},OQe={cardAria:"{{label}} 图表",viewAria:"{{label}} 显示方式",preview:"预览",code:"代码",invalidEcharts:"ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。",renderFailed:"图表暂时无法渲染,请切换到代码检查内容。",echartsAria:"ECharts 图表预览",rendering:"正在渲染图表…",mermaidFailed:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。",mermaidAria:"Mermaid 图表预览"},kQe={playVideo:"点击播放视频:{{name}}",enlargeImage:"放大预览:{{name}}",image:"图片",enlargeVideo:"点击放大视频",videoPreview:"视频预览",downloadVideo:"下载视频",close:"关闭"},EQe={annotation:mQe,media:vQe,runtimeLogs:yQe,trace:bQe,share:xQe,blocks:wQe,tokenUsage:AQe,addAgentKit:SQe,composer:TQe,invocation:CQe,visualization:OQe,markdown:kQe},bur=Object.freeze(Object.defineProperty({__proto__:null,addAgentKit:SQe,annotation:mQe,blocks:wQe,composer:TQe,default:EQe,invocation:CQe,markdown:kQe,media:vQe,runtimeLogs:yQe,share:xQe,tokenUsage:AQe,trace:bQe,visualization:OQe},Symbol.toStringTag,{value:"Module"})),_Qe={back:"返回",cancel:"取消",deploy:"部署",delete:"删除",loading:"读取中…",next:"下一步",notSupported:"暂不支持",previous:"上一步",required:"必填",retry:"重试",actions:"操作",value:"值",disabled:"关闭",enabled:"已开启",none:"无",close:"关闭",name:"名称",description:"描述",send:"发送"},RQe={heading:"VeADK Agent 结构配置",importHint:"可在「创建 Agent」页通过「导入 YAML」重新载入。"},DQe={agentName:{required:"名称为必填项",reserved:"user 是 Google ADK 保留名称,请使用其他名称",characters:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"},runtimeName:{required:"Runtime 名称为必填项",characters:"Runtime 名称只能包含英文字母、数字、下划线和连字符",length:"Runtime 名称长度须为 4-64 个字符"}},LQe={description:"一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",instruction:`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。